Skip to contentSkip to conversation

blk-mq: Remove 'running from the wrong CPU' warning

PATCH Applied Daniel Wagner 4 participants 5 messages Nov 30, 2020 – Dec 16, 2020 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 blk-mq: Remove 'running from the wrong CPU' warning

It's guaranteed that no request is in flight when a hctx is going offline. This warning is only triggered when the wq's CPU is hot plugged and the blk-mq is not synced up yet.

As this state is temporary and the request is still processed correctly, better remove the warning as this is the fast path.

---

v2:
- remove the warning as suggested by Ming
v1:
- initial version

    https://lore.kernel.org/linux-block/[email protected]/
 block/blk-mq.c | 25 -------------------------
 1 file changed, 25 deletions(-)
block/blk-mq.c +0 -25
index 55bcee5dc032..7e6761804f86 100644
@@ -1495,31 +1495,6 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
 {
 	int srcu_idx;
 
-	/*
-	 * We should be running this queue from one of the CPUs that
-	 * are mapped to it.
-	 *
-	 * There are at least two related races now between setting
-	 * hctx->next_cpu from blk_mq_hctx_next_cpu() and running
-	 * __blk_mq_run_hw_queue():
-	 *
-	 * - hctx->next_cpu is found offline in blk_mq_hctx_next_cpu(),
-	 *   but later it becomes online, then this warning is harmless
-	 *   at all
-	 *
-	 * - hctx->next_cpu is found online in blk_mq_hctx_next_cpu(),
-	 *   but later it becomes offline, then the warning can't be
-	 *   triggered, and we depend on blk-mq timeout handler to
-	 *   handle dispatched requests to this hctx
-	 */
-	if (!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask) &&
-		cpu_online(hctx->next_cpu)) {
-		printk(KERN_WARNING "run queue from wrong CPU %d, hctx %s\n",
-			raw_smp_processor_id(),
-			cpumask_empty(hctx->cpumask) ? "inactive": "active");
-		dump_stack();
-	}
-
 	/*
 	 * We can't run the queue inline with ints disabled. Ensure that
 	 * we catch bad users of this early.
Signature · 1 line
2.16.4
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Daniel Wagner

It's guaranteed that no request is in flight when a hctx is going offline. This warning is only triggered when the wq's CPU is hot plugged and the blk-mq is not synced up yet.

As this state is temporary and the request is still processed correctly, better remove the warning as this is the fast path.

Looks good,

#2 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 7 lines · Daniel Wagner

It's guaranteed that no request is in flight when a hctx is going offline. This warning is only triggered when the wq's CPU is hot plugged and the blk-mq is not synced up yet.

As this state is temporary and the request is still processed correctly, better remove the warning as this is the fast path.

Quoted 6 lines
Quoted 2 lines

Looks good,

Jens, any chance you queue this one up?

Thanks,
Daniel

Reviewed-by on v2 1/1
#3 lore raw
In reply to Daniel Wagner
Quoted 59 lines · Daniel Wagner

It's guaranteed that no request is in flight when a hctx is going offline. This warning is only triggered when the wq's CPU is hot plugged and the blk-mq is not synced up yet.

As this state is temporary and the request is still processed correctly, better remove the warning as this is the fast path.

---

v2:
- remove the warning as suggested by Ming
v1:
- initial version

    https://lore.kernel.org/linux-block/[email protected]/
 block/blk-mq.c | 25 -------------------------
 1 file changed, 25 deletions(-)
block/blk-mq.c +0 -25
index 55bcee5dc032..7e6761804f86 100644
@@ -1495,31 +1495,6 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
 {
 	int srcu_idx;
 
-	/*
-	 * We should be running this queue from one of the CPUs that
-	 * are mapped to it.
-	 *
-	 * There are at least two related races now between setting
-	 * hctx->next_cpu from blk_mq_hctx_next_cpu() and running
-	 * __blk_mq_run_hw_queue():
-	 *
-	 * - hctx->next_cpu is found offline in blk_mq_hctx_next_cpu(),
-	 *   but later it becomes online, then this warning is harmless
-	 *   at all
-	 *
-	 * - hctx->next_cpu is found online in blk_mq_hctx_next_cpu(),
-	 *   but later it becomes offline, then the warning can't be
-	 *   triggered, and we depend on blk-mq timeout handler to
-	 *   handle dispatched requests to this hctx
-	 */
-	if (!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask) &&
-		cpu_online(hctx->next_cpu)) {
-		printk(KERN_WARNING "run queue from wrong CPU %d, hctx %s\n",
-			raw_smp_processor_id(),
-			cpumask_empty(hctx->cpumask) ? "inactive": "active");
-		dump_stack();
-	}
-
 	/*
 	 * We can't run the queue inline with ints disabled. Ensure that
 	 * we catch bad users of this early.
Signature · 1 line
2.16.4

Thanks,
Ming

maintainer Applied
#4 lore raw
In reply to Daniel Wagner
Quoted 6 lines · Daniel Wagner

It's guaranteed that no request is in flight when a hctx is going offline. This warning is only triggered when the wq's CPU is hot plugged and the blk-mq is not synced up yet.

As this state is temporary and the request is still processed correctly, better remove the warning as this is the fast path.

Applied, thanks.

Signature · 1 line
Jens Axboe