aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2016-09-06 13:04:44 -0400
committerThomas Gleixner <tglx@linutronix.de>2016-09-19 15:44:28 -0400
commit9a659f43dfea27cca423d4e80809be447f4c9ce7 (patch)
tree199546092aa55bb1ed17bfb4b0a9badb21b9f6da
parent75e12ed65312a56401f3b286ac7e12994301371c (diff)
block/softirq: 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-9-bigeasy@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--block/blk-softirq.c27
-rw-r--r--include/linux/cpuhotplug.h1
2 files changed, 11 insertions, 17 deletions
diff --git a/block/blk-softirq.c b/block/blk-softirq.c
index 53b1737e978d..96631e6a22b9 100644
--- a/block/blk-softirq.c
+++ b/block/blk-softirq.c
@@ -78,30 +78,21 @@ static int raise_blk_irq(int cpu, struct request *rq)
78} 78}
79#endif 79#endif
80 80
81static int blk_cpu_notify(struct notifier_block *self, unsigned long action, 81static int blk_softirq_cpu_dead(unsigned int cpu)
82 void *hcpu)
83{ 82{
84 /* 83 /*
85 * If a CPU goes away, splice its entries to the current CPU 84 * If a CPU goes away, splice its entries to the current CPU
86 * and trigger a run of the softirq 85 * and trigger a run of the softirq
87 */ 86 */
88 if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) { 87 local_irq_disable();
89 int cpu = (unsigned long) hcpu; 88 list_splice_init(&per_cpu(blk_cpu_done, cpu),
90 89 this_cpu_ptr(&blk_cpu_done));
91 local_irq_disable(); 90 raise_softirq_irqoff(BLOCK_SOFTIRQ);
92 list_splice_init(&per_cpu(blk_cpu_done, cpu), 91 local_irq_enable();
93 this_cpu_ptr(&blk_cpu_done));
94 raise_softirq_irqoff(BLOCK_SOFTIRQ);
95 local_irq_enable();
96 }
97 92
98 return NOTIFY_OK; 93 return 0;
99} 94}
100 95
101static struct notifier_block blk_cpu_notifier = {
102 .notifier_call = blk_cpu_notify,
103};
104
105void __blk_complete_request(struct request *req) 96void __blk_complete_request(struct request *req)
106{ 97{
107 int ccpu, cpu; 98 int ccpu, cpu;
@@ -180,7 +171,9 @@ static __init int blk_softirq_init(void)
180 INIT_LIST_HEAD(&per_cpu(blk_cpu_done, i)); 171 INIT_LIST_HEAD(&per_cpu(blk_cpu_done, i));
181 172
182 open_softirq(BLOCK_SOFTIRQ, blk_done_softirq); 173 open_softirq(BLOCK_SOFTIRQ, blk_done_softirq);
183 register_hotcpu_notifier(&blk_cpu_notifier); 174 cpuhp_setup_state_nocalls(CPUHP_BLOCK_SOFTIRQ_DEAD,
175 "block/softirq:dead", NULL,
176 blk_softirq_cpu_dead);
184 return 0; 177 return 0;
185} 178}
186subsys_initcall(blk_softirq_init); 179subsys_initcall(blk_softirq_init);
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 2ca7b34871e0..d4274d51fe27 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -23,6 +23,7 @@ enum cpuhp_state {
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_IRQ_POLL_DEAD,
26 CPUHP_BLOCK_SOFTIRQ_DEAD,
26 CPUHP_WORKQUEUE_PREP, 27 CPUHP_WORKQUEUE_PREP,
27 CPUHP_POWER_NUMA_PREPARE, 28 CPUHP_POWER_NUMA_PREPARE,
28 CPUHP_HRTIMERS_PREPARE, 29 CPUHP_HRTIMERS_PREPARE,