From: Ming Lei <ming.lei@redhat.com>
To: Yufen Yu <yuyufen@huawei.com>
Cc: axboe@kernel.dk, yukuai3@huawei.com, linux-block@vger.kernel.org
Subject: Re: [PATCH v2] blk-mq: run queue no matter whether the request is the last request
Date: Wed, 27 Jul 2022 10:06:46 +0800 [thread overview]
Message-ID: <YuCdtr/J172j2ZkK@T590> (raw)
In-Reply-To: <20220726110111.1557859-1-yuyufen@huawei.com>
On Tue, Jul 26, 2022 at 07:01:11PM +0800, Yufen Yu wrote:
> We do test on a virtio scsi device (/dev/sda) and the default mq
> scheduler is 'none'. We found a IO hung as following:
>
> blk_finish_plug
> blk_mq_plug_issue_direct
> scsi_mq_get_budget
> //get budget_token fail and sdev->restarts=1
>
> scsi_end_request
> scsi_run_queue_async
> //sdev->restart=0 and run queue
>
> blk_mq_request_bypass_insert
> //add request to hctx->dispatch list
>
> //continue to dispath plug list
> blk_mq_dispatch_plug_list
> blk_mq_try_issue_list_directly
> //success issue all requests from plug list
>
> After .get_budget fail, scsi_mq_get_budget will increase 'restarts'.
> Normally, it will run hw queue when io complete and set 'restarts'
> as 0. But if we run queue before adding request to the dispatch list
> and blk_mq_dispatch_plug_list also success issue all requests, then
> on one will run queue, and the request will be stall in the dispatch
> list and cannot complete forever.
The story isn't related with scsi actually.
>
> It is wrong to use last request of plug list to decide if run queue is
> needed since all the remained requests in plug list may be from other
> hctxs. To fix the bug, pass run_queue as true always to
> blk_mq_request_bypass_insert().
>
> Fix-suggested-by: Ming Lei <ming.lei@redhat.com>
> Signed-off-by: Yufen Yu <yuyufen@huawei.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Thanks,
Ming
prev parent reply other threads:[~2022-07-27 2:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-26 11:01 [PATCH v2] blk-mq: run queue no matter whether the request is the last request Yufen Yu
2022-07-27 2:06 ` Ming Lei [this message]
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=YuCdtr/J172j2ZkK@T590 \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=yukuai3@huawei.com \
--cc=yuyufen@huawei.com \
/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 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).