linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch]blk-mq: suppress a warning
@ 2014-07-04 11:26 Shaohua Li
  2014-07-04 15:35 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Shaohua Li @ 2014-07-04 11:26 UTC (permalink / raw)
  To: linux-kernel; +Cc: axboe


The warning is hit when cpu hotplug is running. After scheduler puts a cpu
online and before blk-mq mapping reinit, a task can queue a request and run the
queue. At that time the cpu isn't in hctx->cpumask, but the cpu is mapped into
hctx 0. When the race happens, hctx->cpumask doesn't set the cpu and
ctx->index_hw/hctx->nr_ctx isn't correct, but it doesn't cause any problem. So
just suppress the warning here.

Signed-off-by: Shaohua Li <shli@fusionio.com>

diff --git a/block/blk-mq.c b/block/blk-mq.c
index ad69ef6..22f314e 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -724,7 +724,7 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
 	LIST_HEAD(rq_list);
 	int queued;
 
-	WARN_ON(!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask));
+	WARN_ON(q->mq_ops->map_queue(q, raw_smp_processor_id()) != hctx);
 
 	if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state)))
 		return;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch]blk-mq: suppress a warning
  2014-07-04 11:26 [patch]blk-mq: suppress a warning Shaohua Li
@ 2014-07-04 15:35 ` Jens Axboe
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2014-07-04 15:35 UTC (permalink / raw)
  To: Shaohua Li, linux-kernel

On 07/04/2014 05:26 AM, Shaohua Li wrote:
> 
> The warning is hit when cpu hotplug is running. After scheduler puts a cpu
> online and before blk-mq mapping reinit, a task can queue a request and run the
> queue. At that time the cpu isn't in hctx->cpumask, but the cpu is mapped into
> hctx 0. When the race happens, hctx->cpumask doesn't set the cpu and
> ctx->index_hw/hctx->nr_ctx isn't correct, but it doesn't cause any problem. So
> just suppress the warning here.

Thanks Shaohua, I think that is an improvement. Not super fond of having
to do an extra map, but it's saner than the CPU test in that it uses the
same mechanism to verify it's correct. And we can probably kill this
WARN_ON() in a revision or two.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [patch] blk-mq: suppress a warning
@ 2015-01-06 16:04 Jeff Moyer
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Moyer @ 2015-01-06 16:04 UTC (permalink / raw)
  To: Jens Axboe, Shaohua Li; +Cc: linux-kernel

Jens,

Is there any reason the following patch from Shaohua didn't go in?  We
are hitting this WARN_ON during hotplug testing, and this patch fixes
the problem.  The previous posting is located here:

http://linux-kernel.2935.n7.nabble.com/patch-blk-mq-suppress-a-warning-td895340.html

Cheers,
Jeff

From: Shaohua Li <shli@kernel.org>

The warning is hit when cpu hotplug is running. After scheduler puts a cpu
online and before blk-mq mapping reinit, a task can queue a request and run the
queue. At that time the cpu isn't in hctx->cpumask, but the cpu is mapped into
hctx 0. When the race happens, hctx->cpumask doesn't set the cpu and
ctx->index_hw/hctx->nr_ctx isn't correct, but it doesn't cause any problem. So
just suppress the warning here.

Signed-off-by: Shaohua Li <shli@kernel.org>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

diff --git a/block/blk-mq.c b/block/blk-mq.c
index da1ab56..491beb7 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -702,7 +702,7 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
 	struct list_head *dptr;
 	int queued;
 
-	WARN_ON(!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask));
+	WARN_ON(q->mq_ops->map_queue(q, raw_smp_processor_id()) != hctx);
 
 	if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state)))
 		return;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-06 16:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-04 11:26 [patch]blk-mq: suppress a warning Shaohua Li
2014-07-04 15:35 ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2015-01-06 16:04 [patch] blk-mq: " Jeff Moyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).