From: Jens Axboe <axboe@kernel.dk>
To: Ming Lei <ming.lei@redhat.com>
Cc: linux-block@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
Christoph Hellwig <hch@lst.de>,
David Jeffery <djeffery@redhat.com>,
kernel test robot <rong.a.chen@intel.com>,
stable@vger.kernel.org
Subject: Re: [PATCH RESEND] blk-mq: order adding requests to hctx->dispatch and checking SCHED_RESTART
Date: Mon, 17 Aug 2020 06:58:05 -0700 [thread overview]
Message-ID: <bc5fa941-3b7c-f28e-dd46-1a1d6e5c40a8@kernel.dk> (raw)
In-Reply-To: <20200817100115.2495988-1-ming.lei@redhat.com>
On 8/17/20 3:01 AM, Ming Lei wrote:
> SCHED_RESTART code path is relied to re-run queue for dispatch requests
> in hctx->dispatch. Meantime the SCHED_RSTART flag is checked when adding
> requests to hctx->dispatch.
>
> memory barriers have to be used for ordering the following two pair of OPs:
>
> 1) adding requests to hctx->dispatch and checking SCHED_RESTART in
> blk_mq_dispatch_rq_list()
>
> 2) clearing SCHED_RESTART and checking if there is request in hctx->dispatch
> in blk_mq_sched_restart().
>
> Without the added memory barrier, either:
>
> 1) blk_mq_sched_restart() may miss requests added to hctx->dispatch meantime
> blk_mq_dispatch_rq_list() observes SCHED_RESTART, and not run queue in
> dispatch side
>
> or
>
> 2) blk_mq_dispatch_rq_list still sees SCHED_RESTART, and not run queue
> in dispatch side, meantime checking if there is request in
> hctx->dispatch from blk_mq_sched_restart() is missed.
>
> IO hang in ltp/fs_fill test is reported by kernel test robot:
>
> https://lkml.org/lkml/2020/7/26/77
>
> Turns out it is caused by the above out-of-order OPs. And the IO hang
> can't be observed any more after applying this patch.
Applied, thanks.
--
Jens Axboe
next prev parent reply other threads:[~2020-08-17 13:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-17 10:01 [PATCH RESEND] blk-mq: order adding requests to hctx->dispatch and checking SCHED_RESTART Ming Lei
2020-08-17 10:15 ` Christoph Hellwig
2020-08-17 11:06 ` Ming Lei
2020-08-17 13:58 ` Jens Axboe [this message]
2020-08-26 13:53 ` Sasha Levin
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=bc5fa941-3b7c-f28e-dd46-1a1d6e5c40a8@kernel.dk \
--to=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=djeffery@redhat.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=rong.a.chen@intel.com \
--cc=stable@vger.kernel.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 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).