From: Omar Sandoval <osandov@osandov.com>
To: Sagi Grimberg <sagi@grimberg.me>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, linux-nvme@lists.infradead.org
Subject: Re: [PATCH 1/2] blk-mq-sched: Allocate sched reserved tags as specified in the original queue tagset
Date: Mon, 27 Feb 2017 08:14:52 -0800 [thread overview]
Message-ID: <20170227161452.GB10715@vader> (raw)
In-Reply-To: <eb51d324-62df-629e-8a7b-fea50ef7543e@grimberg.me>
On Mon, Feb 27, 2017 at 06:10:01PM +0200, Sagi Grimberg wrote:
>
> > > Hm, this may fix the crash, but I'm not sure it'll work as intended.
> > > When we allocate the request, we'll get a reserved scheduler tag, but
> > > then when we go to dispatch the request and call
> > > blk_mq_get_driver_tag(), we'll be competing with all of the normal
> > > requests for a regular driver tag. So maybe on top of this we should add
> > > the BLK_MQ_REQ_RESERVED flag to the allocation attempt in
> > > blk_mq_get_driver_tag() if the scheduler tag is reserved? I'm hazy on
> > > what we expect from reserved tags, so feel free to call me crazy.
> >
> > Yeah good point, we need to carry it through. Reserved tags exist
> > because drivers often need a request/tag for error handling. If all
> > tags currently are used up for regular IO that is stuck, you need
> > a reserved tag for error handling to guarantee progress.
> >
> > So Sagi's patch does take it half the way there, but get_driver_tag
> > really needs to know about this as well, or we will just get stuck
> > there as well. Two solutions, I can think of:
> >
> > 1) Check the tag value in get_driver_tag, add BLK_MQ_REQ_RESERVED
> > when allocating a driver tag if above X.
> > 2) Add an RQF_SOMETHING_RESERVED. Add BLK_MQ_REQ_RESERVED in
> > get_driver_tag if that is set.
> >
> > Comments?
Option 1 looks simple enough that I don't think it warrants a new
request flag (compile tested only):
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 9e6b064e5339..87590f7d4f80 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -852,6 +852,9 @@ bool blk_mq_get_driver_tag(struct request *rq, struct blk_mq_hw_ctx **hctx,
return true;
}
+ if (rq->internal_tag < data.hctx->sched_tags->nr_reserved_tags)
+ data.flags |= BLK_MQ_REQ_RESERVED;
+
rq->tag = blk_mq_get_tag(&data);
if (rq->tag >= 0) {
if (blk_mq_tag_busy(data.hctx)) {
> Can't we just not go through the scheduler for reserved tags? Obviously
> there is no point in scheduling them...
That sounds nice, since I'd be worried about the scheduler also needing
to be aware of the reserved status lest it also get the reserved request
stuck behind some normal requests. But, we special case flush in this
way, and it has been a huge pain.
next prev parent reply other threads:[~2017-02-27 16:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-27 15:36 [PATCH 1/2] blk-mq-sched: Allocate sched reserved tags as specified in the original queue tagset Sagi Grimberg
2017-02-27 15:36 ` [PATCH 2/2] blk-mq: make sure to back-assign the request to rq_map in blk_mq_alloc_request_hctx Sagi Grimberg
2017-02-27 16:59 ` Omar Sandoval
2017-02-27 17:03 ` Jens Axboe
2017-02-27 17:04 ` Omar Sandoval
2017-02-27 17:06 ` Jens Axboe
2017-02-27 17:26 ` Sagi Grimberg
2017-02-27 15:38 ` [PATCH 1/2] blk-mq-sched: Allocate sched reserved tags as specified in the original queue tagset Jens Axboe
2017-02-27 15:49 ` Omar Sandoval
2017-02-27 15:53 ` Jens Axboe
2017-02-27 16:10 ` Sagi Grimberg
2017-02-27 16:14 ` Omar Sandoval [this message]
2017-02-27 16:17 ` Jens Axboe
2017-02-27 16:15 ` Jens Axboe
2017-02-27 16:23 ` Sagi Grimberg
2017-02-27 16:25 ` Omar Sandoval
2017-02-27 16:27 ` Jens Axboe
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=20170227161452.GB10715@vader \
--to=osandov@osandov.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--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