Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 349835
b: refs/heads/master
c: c0e980a
h: refs/heads/master
i:
  349833: 5a14e4f
  349831: 8e76da0
v: v3
  • Loading branch information
Steven Rostedt authored and Frederic Weisbecker committed Nov 17, 2012
1 parent 4e3377d commit de7765c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 00b42959106a9ca1c2899e591ae4e9a83ad6af05
refs/heads/master: c0e980a4bd7fc5c9b748f2f0209d2a48c0fdf0ab
51 changes: 45 additions & 6 deletions trunk/kernel/irq_work.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <linux/percpu.h>
#include <linux/hardirq.h>
#include <linux/irqflags.h>
#include <linux/cpu.h>
#include <linux/notifier.h>
#include <asm/processor.h>

/*
Expand Down Expand Up @@ -110,11 +112,7 @@ bool irq_work_needs_cpu(void)
return true;
}

/*
* Run the irq_work entries on this cpu. Requires to be ran from hardirq
* context with local IRQs disabled.
*/
void irq_work_run(void)
static void __irq_work_run(void)
{
struct irq_work *work;
struct llist_head *this_list;
Expand All @@ -124,7 +122,6 @@ void irq_work_run(void)
if (llist_empty(this_list))
return;

BUG_ON(!in_irq());
BUG_ON(!irqs_disabled());

llnode = llist_del_all(this_list);
Expand All @@ -149,6 +146,16 @@ void irq_work_run(void)
(void)cmpxchg(&work->flags, IRQ_WORK_BUSY, 0);
}
}

/*
* Run the irq_work entries on this cpu. Requires to be ran from hardirq
* context with local IRQs disabled.
*/
void irq_work_run(void)
{
BUG_ON(!in_irq());
__irq_work_run();
}
EXPORT_SYMBOL_GPL(irq_work_run);

/*
Expand All @@ -163,3 +170,35 @@ void irq_work_sync(struct irq_work *work)
cpu_relax();
}
EXPORT_SYMBOL_GPL(irq_work_sync);

#ifdef CONFIG_HOTPLUG_CPU
static int irq_work_cpu_notify(struct notifier_block *self,
unsigned long action, void *hcpu)
{
long cpu = (long)hcpu;

switch (action) {
case CPU_DYING:
/* Called from stop_machine */
if (WARN_ON_ONCE(cpu != smp_processor_id()))
break;
__irq_work_run();
break;
default:
break;
}
return NOTIFY_OK;
}

static struct notifier_block cpu_notify;

static __init int irq_work_init_cpu_notifier(void)
{
cpu_notify.notifier_call = irq_work_cpu_notify;
cpu_notify.priority = 0;
register_cpu_notifier(&cpu_notify);
return 0;
}
device_initcall(irq_work_init_cpu_notifier);

#endif /* CONFIG_HOTPLUG_CPU */

0 comments on commit de7765c

Please sign in to comment.