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>
This commit is contained in:
committed by
Thomas Gleixner
parent
75e12ed653
commit
9a659f43df
@@ -78,30 +78,21 @@ static int raise_blk_irq(int cpu, struct request *rq)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int blk_cpu_notify(struct notifier_block *self, unsigned long action,
|
static int blk_softirq_cpu_dead(unsigned int cpu)
|
||||||
void *hcpu)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If a CPU goes away, splice its entries to the current CPU
|
* If a CPU goes away, splice its entries to the current CPU
|
||||||
* and trigger a run of the softirq
|
* and trigger a run of the softirq
|
||||||
*/
|
*/
|
||||||
if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) {
|
|
||||||
int cpu = (unsigned long) hcpu;
|
|
||||||
|
|
||||||
local_irq_disable();
|
local_irq_disable();
|
||||||
list_splice_init(&per_cpu(blk_cpu_done, cpu),
|
list_splice_init(&per_cpu(blk_cpu_done, cpu),
|
||||||
this_cpu_ptr(&blk_cpu_done));
|
this_cpu_ptr(&blk_cpu_done));
|
||||||
raise_softirq_irqoff(BLOCK_SOFTIRQ);
|
raise_softirq_irqoff(BLOCK_SOFTIRQ);
|
||||||
local_irq_enable();
|
local_irq_enable();
|
||||||
}
|
|
||||||
|
|
||||||
return NOTIFY_OK;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct notifier_block blk_cpu_notifier = {
|
|
||||||
.notifier_call = blk_cpu_notify,
|
|
||||||
};
|
|
||||||
|
|
||||||
void __blk_complete_request(struct request *req)
|
void __blk_complete_request(struct request *req)
|
||||||
{
|
{
|
||||||
int ccpu, cpu;
|
int ccpu, cpu;
|
||||||
@@ -180,7 +171,9 @@ static __init int blk_softirq_init(void)
|
|||||||
INIT_LIST_HEAD(&per_cpu(blk_cpu_done, i));
|
INIT_LIST_HEAD(&per_cpu(blk_cpu_done, i));
|
||||||
|
|
||||||
open_softirq(BLOCK_SOFTIRQ, blk_done_softirq);
|
open_softirq(BLOCK_SOFTIRQ, blk_done_softirq);
|
||||||
register_hotcpu_notifier(&blk_cpu_notifier);
|
cpuhp_setup_state_nocalls(CPUHP_BLOCK_SOFTIRQ_DEAD,
|
||||||
|
"block/softirq:dead", NULL,
|
||||||
|
blk_softirq_cpu_dead);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
subsys_initcall(blk_softirq_init);
|
subsys_initcall(blk_softirq_init);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ enum cpuhp_state {
|
|||||||
CPUHP_ARM64_FPSIMD_DEAD,
|
CPUHP_ARM64_FPSIMD_DEAD,
|
||||||
CPUHP_ARM_OMAP_WAKE_DEAD,
|
CPUHP_ARM_OMAP_WAKE_DEAD,
|
||||||
CPUHP_IRQ_POLL_DEAD,
|
CPUHP_IRQ_POLL_DEAD,
|
||||||
|
CPUHP_BLOCK_SOFTIRQ_DEAD,
|
||||||
CPUHP_WORKQUEUE_PREP,
|
CPUHP_WORKQUEUE_PREP,
|
||||||
CPUHP_POWER_NUMA_PREPARE,
|
CPUHP_POWER_NUMA_PREPARE,
|
||||||
CPUHP_HRTIMERS_PREPARE,
|
CPUHP_HRTIMERS_PREPARE,
|
||||||
|
|||||||
Reference in New Issue
Block a user