1 From b4a2c96654d8ba0599c138e5340cf6647f85d8bd Mon Sep 17 00:00:00 2001
2 From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
3 Date: Sat, 3 May 2014 11:00:29 +0200
4 Subject: [PATCH 164/366] blk-mq: revert raw locks, post pone notifier to
7 The blk_mq_cpu_notify_lock should be raw because some CPU down levels
8 are called with interrupts off. The notifier itself calls currently one
9 function that is blk_mq_hctx_notify().
10 That function acquires the ctx->lock lock which is sleeping and I would
11 prefer to keep it that way. That function only moves IO-requests from
12 the CPU that is going offline to another CPU and it is currently the
13 only one. Therefore I revert the list lock back to sleeping spinlocks
14 and let the notifier run at POST_DEAD time.
16 Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
18 block/blk-mq-cpu.c | 17 ++++++++++-------
20 2 files changed, 11 insertions(+), 8 deletions(-)
22 diff --git a/block/blk-mq-cpu.c b/block/blk-mq-cpu.c
23 index bb3ed48..628c6c1 100644
24 --- a/block/blk-mq-cpu.c
25 +++ b/block/blk-mq-cpu.c
29 static LIST_HEAD(blk_mq_cpu_notify_list);
30 -static DEFINE_RAW_SPINLOCK(blk_mq_cpu_notify_lock);
31 +static DEFINE_SPINLOCK(blk_mq_cpu_notify_lock);
33 static int blk_mq_main_cpu_notify(struct notifier_block *self,
34 unsigned long action, void *hcpu)
35 @@ -25,7 +25,10 @@ static int blk_mq_main_cpu_notify(struct notifier_block *self,
36 struct blk_mq_cpu_notifier *notify;
39 - raw_spin_lock(&blk_mq_cpu_notify_lock);
40 + if (action != CPU_POST_DEAD)
43 + spin_lock(&blk_mq_cpu_notify_lock);
45 list_for_each_entry(notify, &blk_mq_cpu_notify_list, list) {
46 ret = notify->notify(notify->data, action, cpu);
47 @@ -33,7 +36,7 @@ static int blk_mq_main_cpu_notify(struct notifier_block *self,
51 - raw_spin_unlock(&blk_mq_cpu_notify_lock);
52 + spin_unlock(&blk_mq_cpu_notify_lock);
56 @@ -41,16 +44,16 @@ void blk_mq_register_cpu_notifier(struct blk_mq_cpu_notifier *notifier)
58 BUG_ON(!notifier->notify);
60 - raw_spin_lock(&blk_mq_cpu_notify_lock);
61 + spin_lock(&blk_mq_cpu_notify_lock);
62 list_add_tail(¬ifier->list, &blk_mq_cpu_notify_list);
63 - raw_spin_unlock(&blk_mq_cpu_notify_lock);
64 + spin_unlock(&blk_mq_cpu_notify_lock);
67 void blk_mq_unregister_cpu_notifier(struct blk_mq_cpu_notifier *notifier)
69 - raw_spin_lock(&blk_mq_cpu_notify_lock);
70 + spin_lock(&blk_mq_cpu_notify_lock);
71 list_del(¬ifier->list);
72 - raw_spin_unlock(&blk_mq_cpu_notify_lock);
73 + spin_unlock(&blk_mq_cpu_notify_lock);
76 void blk_mq_init_cpu_notifier(struct blk_mq_cpu_notifier *notifier,
77 diff --git a/block/blk-mq.c b/block/blk-mq.c
78 index 0345b44..fe026b6 100644
81 @@ -1642,7 +1642,7 @@ static int blk_mq_hctx_notify(void *data, unsigned long action,
83 struct blk_mq_hw_ctx *hctx = data;
85 - if (action == CPU_DEAD || action == CPU_DEAD_FROZEN)
86 + if (action == CPU_POST_DEAD)
87 return blk_mq_hctx_cpu_offline(hctx, cpu);