diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2016-09-06 13:04:43 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-09-19 15:44:27 -0400 |
commit | 75e12ed65312a56401f3b286ac7e12994301371c (patch) | |
tree | ad2121dc417660da76e2b6bd56976ee4ca23bb07 | |
parent | 29bd7fbc071598e939526f782293dbe137be3768 (diff) |
lib/irq_poll: Convert to hotplug state machine
Install the callbacks via the state machine.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160906170457.32393-8-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | include/linux/cpuhotplug.h | 1 | ||||
-rw-r--r-- | lib/irq_poll.c | 26 |
2 files changed, 10 insertions, 17 deletions
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 8dec2a236af3..2ca7b34871e0 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h | |||
@@ -22,6 +22,7 @@ enum cpuhp_state { | |||
22 | CPUHP_CPUIDLE_DEAD, | 22 | CPUHP_CPUIDLE_DEAD, |
23 | CPUHP_ARM64_FPSIMD_DEAD, | 23 | CPUHP_ARM64_FPSIMD_DEAD, |
24 | CPUHP_ARM_OMAP_WAKE_DEAD, | 24 | CPUHP_ARM_OMAP_WAKE_DEAD, |
25 | CPUHP_IRQ_POLL_DEAD, | ||
25 | CPUHP_WORKQUEUE_PREP, | 26 | CPUHP_WORKQUEUE_PREP, |
26 | CPUHP_POWER_NUMA_PREPARE, | 27 | CPUHP_POWER_NUMA_PREPARE, |
27 | CPUHP_HRTIMERS_PREPARE, | 28 | CPUHP_HRTIMERS_PREPARE, |
diff --git a/lib/irq_poll.c b/lib/irq_poll.c index 836f7db4e548..2be55692aa43 100644 --- a/lib/irq_poll.c +++ b/lib/irq_poll.c | |||
@@ -184,30 +184,21 @@ void irq_poll_init(struct irq_poll *iop, int weight, irq_poll_fn *poll_fn) | |||
184 | } | 184 | } |
185 | EXPORT_SYMBOL(irq_poll_init); | 185 | EXPORT_SYMBOL(irq_poll_init); |
186 | 186 | ||
187 | static int irq_poll_cpu_notify(struct notifier_block *self, | 187 | static int irq_poll_cpu_dead(unsigned int cpu) |
188 | unsigned long action, void *hcpu) | ||
189 | { | 188 | { |
190 | /* | 189 | /* |
191 | * If a CPU goes away, splice its entries to the current CPU | 190 | * If a CPU goes away, splice its entries to the current CPU |
192 | * and trigger a run of the softirq | 191 | * and trigger a run of the softirq |
193 | */ | 192 | */ |
194 | if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) { | 193 | local_irq_disable(); |
195 | int cpu = (unsigned long) hcpu; | 194 | list_splice_init(&per_cpu(blk_cpu_iopoll, cpu), |
196 | 195 | this_cpu_ptr(&blk_cpu_iopoll)); | |
197 | local_irq_disable(); | 196 | __raise_softirq_irqoff(IRQ_POLL_SOFTIRQ); |
198 | list_splice_init(&per_cpu(blk_cpu_iopoll, cpu), | 197 | local_irq_enable(); |
199 | this_cpu_ptr(&blk_cpu_iopoll)); | ||
200 | __raise_softirq_irqoff(IRQ_POLL_SOFTIRQ); | ||
201 | local_irq_enable(); | ||
202 | } | ||
203 | 198 | ||
204 | return NOTIFY_OK; | 199 | return 0; |
205 | } | 200 | } |
206 | 201 | ||
207 | static struct notifier_block irq_poll_cpu_notifier = { | ||
208 | .notifier_call = irq_poll_cpu_notify, | ||
209 | }; | ||
210 | |||
211 | static __init int irq_poll_setup(void) | 202 | static __init int irq_poll_setup(void) |
212 | { | 203 | { |
213 | int i; | 204 | int i; |
@@ -216,7 +207,8 @@ static __init int irq_poll_setup(void) | |||
216 | INIT_LIST_HEAD(&per_cpu(blk_cpu_iopoll, i)); | 207 | INIT_LIST_HEAD(&per_cpu(blk_cpu_iopoll, i)); |
217 | 208 | ||
218 | open_softirq(IRQ_POLL_SOFTIRQ, irq_poll_softirq); | 209 | open_softirq(IRQ_POLL_SOFTIRQ, irq_poll_softirq); |
219 | register_hotcpu_notifier(&irq_poll_cpu_notifier); | 210 | cpuhp_setup_state_nocalls(CPUHP_IRQ_POLL_DEAD, "irq_poll:dead", NULL, |
211 | irq_poll_cpu_dead); | ||
220 | return 0; | 212 | return 0; |
221 | } | 213 | } |
222 | subsys_initcall(irq_poll_setup); | 214 | subsys_initcall(irq_poll_setup); |