All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	Bart Van Assche <bvanassche@acm.org>,
	djeffery@redhat.com, stefanha@redhat.com,
	linux-block@vger.kernel.org, linux-scsi@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: Re: [Bug] double ->queue_rq() because of timeout in ->queue_rq()
Date: Fri, 21 Oct 2022 08:32:31 -0600	[thread overview]
Message-ID: <Y1Ktf2jRTlPMQwJR@kbusch-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <Y1EQdafQlKNAsutk@T590>

On Thu, Oct 20, 2022 at 05:10:13PM +0800, Ming Lei wrote:
> @@ -1593,10 +1598,17 @@ static void blk_mq_timeout_work(struct work_struct *work)
>  	if (!percpu_ref_tryget(&q->q_usage_counter))
>  		return;
>  
> -	blk_mq_queue_tag_busy_iter(q, blk_mq_check_expired, &next);
> +	/* Before walking tags, we must ensure any submit started before the
> +	 * current time has finished. Since the submit uses srcu or rcu, wait
> +	 * for a synchronization point to ensure all running submits have
> +	 * finished
> +	 */
> +	blk_mq_wait_quiesce_done(q);
> +
> +	blk_mq_queue_tag_busy_iter(q, blk_mq_check_expired, &expired);

The blk_mq_wait_quiesce_done() will only wait for tasks that entered
just before calling that function. It will not wait for tasks that
entered immediately after.

If I correctly understand the problem you're describing, the hypervisor
may prevent any guest process from running. If so, the timeout work may
be stalled after the quiesce, and if a queue_rq() process also stalled
after starting quiesce_done(), then we're in the same situation you're
trying to prevent, right?

I agree with your idea that this is a lower level driver responsibility:
it should reclaim all started requests before allowing new queuing.
Perhaps the block layer should also raise a clear warning if it's
queueing a request that's already started.

  parent reply	other threads:[~2022-10-21 14:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20  9:10 [Bug] double ->queue_rq() because of timeout in ->queue_rq() Ming Lei
2022-10-20  9:10 ` Ming Lei
2022-10-20 20:01 ` Stefan Hajnoczi
2022-10-20 20:01   ` Stefan Hajnoczi
2022-10-21  2:23   ` Ming Lei
2022-10-21  2:23     ` Ming Lei
2022-10-24 15:30     ` Stefan Hajnoczi
2022-10-24 15:30       ` Stefan Hajnoczi
2022-10-24 15:41       ` Ming Lei
2022-10-24 15:41         ` Ming Lei
2022-10-20 20:26 ` Bart Van Assche
2022-10-20 20:26   ` Bart Van Assche
2022-10-21  0:57   ` Ming Lei
2022-10-21  0:57     ` Ming Lei
2022-10-21 14:32 ` Keith Busch [this message]
2022-10-21 15:22   ` Ming Lei
2022-10-21 15:22     ` Ming Lei
2022-10-21 18:33     ` David Jeffery
2022-10-22  4:27       ` Ming Lei
2022-10-22  4:27         ` Ming Lei
2022-10-21 18:21   ` David Jeffery

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1Ktf2jRTlPMQwJR@kbusch-mbp.dhcp.thefacebook.com \
    --to=kbusch@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=djeffery@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.