From: Ming Lei <ming.lei@redhat.com>
To: Sagi Grimberg <sagi@grimberg.me>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
linux-scsi@vger.kernel.org, Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCH 3/5] blk-mq: add helper of blk_mq_global_quiesce_wait()
Date: Fri, 10 Dec 2021 10:02:52 +0800 [thread overview]
Message-ID: <YbK1TLTkHrut1FJ+@T590> (raw)
In-Reply-To: <4394200f-782b-5d75-4570-79a1f63110b1@grimberg.me>
On Wed, Dec 08, 2021 at 02:49:25PM +0200, Sagi Grimberg wrote:
>
>
> On 11/30/21 4:33 AM, Ming Lei wrote:
> > On Tue, Nov 23, 2021 at 11:00:45AM +0200, Sagi Grimberg wrote:
> > >
> > > > > > > > Add helper of blk_mq_global_quiesce_wait() for supporting to quiesce
> > > > > > > > queues in parallel, then we can just wait once if global quiesce wait
> > > > > > > > is allowed.
> > > > > > >
> > > > > > > blk_mq_global_quiesce_wait() is a poor name... global is scope-less and
> > > > > > > obviously it has a scope.
> > > > > >
> > > > > > How about blk_mq_shared_quiesce_wait()? or any suggestion?
> > > > >
> > > > > Shared between what?
> > > >
> > > > All request queues in one host-wide, both scsi and nvme has such
> > > > requirement.
> > > >
> > > > >
> > > > > Maybe if the queue has a non-blocking tagset, it can have a "quiesced"
> > > > > flag that is cleared in unquiesce? then the callers can just continue
> > > > > to iterate but will only wait the rcu grace period once.
> > > >
> > > > Yeah, that is what these patches try to implement.
> > >
> > > I was suggesting to "hide" it in the interface.
> > > Maybe something like:
> > > --
> > > diff --git a/block/blk-mq.c b/block/blk-mq.c
> > > index 8799fa73ef34..627b631db1f9 100644
> > > --- a/block/blk-mq.c
> > > +++ b/block/blk-mq.c
> > > @@ -263,14 +263,18 @@ void blk_mq_wait_quiesce_done(struct request_queue *q)
> > > unsigned int i;
> > > bool rcu = false;
> > >
> > > + if (!q->has_srcu && q->quiesced)
> > > + return;
> > > queue_for_each_hw_ctx(q, hctx, i) {
> > > if (hctx->flags & BLK_MQ_F_BLOCKING)
> > > synchronize_srcu(hctx->srcu);
> > > else
> > > rcu = true;
> > > }
> > > - if (rcu)
> > > + if (rcu) {
> > > synchronize_rcu();
> > > + q->quiesced = true;
> > > + }
> > > }
> > > EXPORT_SYMBOL_GPL(blk_mq_wait_quiesce_done);
> > >
> > > @@ -308,6 +312,7 @@ void blk_mq_unquiesce_queue(struct request_queue *q)
> > > } else if (!--q->quiesce_depth) {
> > > blk_queue_flag_clear(QUEUE_FLAG_QUIESCED, q);
> > > run_queue = true;
> > > + q->quiesced = false;
> >
> > Different request queues are passed to blk_mq_wait_quiesce_done() during
> > the iteration, so marking 'quiesced' doesn't make any difference here.
>
> I actually meant q->tag_set->quiesced, such that the flag will be
> used in the tag_set reference. This way this sharing will be kept
> hidden from the callers.
That looks easy, but not true really from API viewpoint, q->tag_set has different
lifetime which is covered by driver, not mention other request queues may touch
q->tag_set->quiesced from other code path, so things will become much complicated,
also what is the meaning of quiesced state for tagset wide?
Here I prefer to philosophy of 'Worse is better'[1], and simplicity over perfection
by adding one simple helper of blk_mq_shared_quiesce_wait() for improving the case
very easily.
[1] ihttps://ipfs.fleek.co/ipfs/QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco/wiki/Unix_philosophy.html
Thanks,
Ming
next prev parent reply other threads:[~2021-12-10 2:03 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-19 2:18 [PATCH 0/5] blk-mq: quiesce improvement Ming Lei
2021-11-19 2:18 ` [PATCH 1/5] blk-mq: move srcu from blk_mq_hw_ctx to request_queue Ming Lei
2021-11-19 4:30 ` Bart Van Assche
2021-11-19 8:10 ` Ming Lei
2021-11-22 7:48 ` Sagi Grimberg
2021-11-22 13:08 ` Ming Lei
2021-11-22 13:47 ` Sagi Grimberg
2021-11-19 2:18 ` [PATCH 2/5] blk-mq: rename hctx_lock & hctx_unlock Ming Lei
2021-11-22 7:53 ` Sagi Grimberg
2021-11-22 13:20 ` Ming Lei
2021-11-22 13:50 ` Sagi Grimberg
2021-11-23 0:08 ` Ming Lei
2021-11-23 8:54 ` Sagi Grimberg
2021-11-22 9:00 ` Christoph Hellwig
2021-11-19 2:18 ` [PATCH 3/5] blk-mq: add helper of blk_mq_global_quiesce_wait() Ming Lei
2021-11-22 7:56 ` Sagi Grimberg
2021-11-22 8:00 ` Sagi Grimberg
2021-11-22 13:26 ` Ming Lei
2021-11-22 13:55 ` Sagi Grimberg
2021-11-23 0:17 ` Ming Lei
2021-11-23 9:00 ` Sagi Grimberg
2021-11-30 2:33 ` Ming Lei
2021-12-08 12:49 ` Sagi Grimberg
2021-12-10 2:02 ` Ming Lei [this message]
2021-11-19 2:18 ` [PATCH 4/5] nvme: quiesce namespace queue in parallel Ming Lei
2021-11-22 8:07 ` Sagi Grimberg
2021-11-23 0:13 ` Ming Lei
2021-11-19 2:18 ` [PATCH 5/5] scsi: use blk-mq quiesce APIs to implement scsi_host_block Ming Lei
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=YbK1TLTkHrut1FJ+@T590 \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sagi@grimberg.me \
/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