linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] blk-mq: Remove 'running from the wrong CPU' warning
@ 2020-11-30 10:19 Daniel Wagner
  2020-11-30 17:17 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Daniel Wagner @ 2020-11-30 10:19 UTC (permalink / raw)
  To: linux-block; +Cc: Jens Axboe, linux-kernel, Ming Lei, 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.

Suggested-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---

v2:
  - remove the warning as suggested by Ming
v1:
  - initial version
    https://lore.kernel.org/linux-block/20201126095152.19151-1-dwagner@suse.de/

 block/blk-mq.c | 25 -------------------------
 1 file changed, 25 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 55bcee5dc032..7e6761804f86 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -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.
-- 
2.16.4


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

* Re: [PATCH v2] blk-mq: Remove 'running from the wrong CPU' warning
  2020-11-30 10:19 [PATCH v2] blk-mq: Remove 'running from the wrong CPU' warning Daniel Wagner
@ 2020-11-30 17:17 ` Christoph Hellwig
  2020-12-16 15:35   ` Daniel Wagner
  2020-12-01  2:09 ` Ming Lei
  2020-12-16 15:47 ` Jens Axboe
  2 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2020-11-30 17:17 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: linux-block, Jens Axboe, linux-kernel, Ming Lei

On Mon, Nov 30, 2020 at 11:19:21AM +0100, Daniel Wagner wrote:
> 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.
> 
> Suggested-by: Ming Lei <ming.lei@redhat.com>
> Signed-off-by: Daniel Wagner <dwagner@suse.de>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH v2] blk-mq: Remove 'running from the wrong CPU' warning
  2020-11-30 10:19 [PATCH v2] blk-mq: Remove 'running from the wrong CPU' warning Daniel Wagner
  2020-11-30 17:17 ` Christoph Hellwig
@ 2020-12-01  2:09 ` Ming Lei
  2020-12-16 15:47 ` Jens Axboe
  2 siblings, 0 replies; 5+ messages in thread
From: Ming Lei @ 2020-12-01  2:09 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: linux-block, Jens Axboe, linux-kernel

On Mon, Nov 30, 2020 at 11:19:21AM +0100, Daniel Wagner wrote:
> 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.
> 
> Suggested-by: Ming Lei <ming.lei@redhat.com>
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
> 
> v2:
>   - remove the warning as suggested by Ming
> v1:
>   - initial version
>     https://lore.kernel.org/linux-block/20201126095152.19151-1-dwagner@suse.de/
> 
>  block/blk-mq.c | 25 -------------------------
>  1 file changed, 25 deletions(-)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 55bcee5dc032..7e6761804f86 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -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.
> -- 
> 2.16.4
> 

Reviewed-by: Ming Lei <ming.lei@redhat.com>

Thanks,
Ming


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

* Re: [PATCH v2] blk-mq: Remove 'running from the wrong CPU' warning
  2020-11-30 17:17 ` Christoph Hellwig
@ 2020-12-16 15:35   ` Daniel Wagner
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Wagner @ 2020-12-16 15:35 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Christoph Hellwig, linux-kernel, Ming Lei

On Mon, Nov 30, 2020 at 05:17:48PM +0000, Christoph Hellwig wrote:
> On Mon, Nov 30, 2020 at 11:19:21AM +0100, Daniel Wagner wrote:
> > 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.
> > 
> > Suggested-by: Ming Lei <ming.lei@redhat.com>
> > Signed-off-by: Daniel Wagner <dwagner@suse.de>
> 
> Looks good,
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Jens, any chance you queue this one up?

Thanks,
Daniel

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

* Re: [PATCH v2] blk-mq: Remove 'running from the wrong CPU' warning
  2020-11-30 10:19 [PATCH v2] blk-mq: Remove 'running from the wrong CPU' warning Daniel Wagner
  2020-11-30 17:17 ` Christoph Hellwig
  2020-12-01  2:09 ` Ming Lei
@ 2020-12-16 15:47 ` Jens Axboe
  2 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2020-12-16 15:47 UTC (permalink / raw)
  To: Daniel Wagner, linux-block; +Cc: linux-kernel, Ming Lei

On 11/30/20 3:19 AM, Daniel Wagner wrote:
> 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.

-- 
Jens Axboe


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

end of thread, other threads:[~2020-12-16 15:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-30 10:19 [PATCH v2] blk-mq: Remove 'running from the wrong CPU' warning Daniel Wagner
2020-11-30 17:17 ` Christoph Hellwig
2020-12-16 15:35   ` Daniel Wagner
2020-12-01  2:09 ` Ming Lei
2020-12-16 15:47 ` Jens Axboe

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).