From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
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 19:06:43 +0800 [thread overview]
Message-ID: <20200817110643.GA2486425@T590> (raw)
In-Reply-To: <20200817101539.GB25336@lst.de>
On Mon, Aug 17, 2020 at 12:15:39PM +0200, Christoph Hellwig wrote:
> On Mon, Aug 17, 2020 at 06:01:15PM +0800, 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.
> >
> > Cc: Bart Van Assche <bvanassche@acm.org>
> > Cc: Christoph Hellwig <hch@lst.de>
> > Cc: David Jeffery <djeffery@redhat.com>
> > Reported-by: kernel test robot <rong.a.chen@intel.com>
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Ming Lei <ming.lei@redhat.com>
>
> Can you add a Fixes: tag so that the commit gets backported?
Fixes: bd166ef183c2 ("blk-mq-sched: add framework for MQ capable IO schedulers")
Thanks,
Ming
next prev parent reply other threads:[~2020-08-17 11:07 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 [this message]
2020-08-17 13:58 ` Jens Axboe
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=20200817110643.GA2486425@T590 \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=djeffery@redhat.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--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