From: Christoph Hellwig <hch@infradead.org>
To: Ming Lei <tom.leiming@gmail.com>
Cc: Christoph Hellwig <hch@infradead.org>,
Jens Axboe <axboe@kernel.dk>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/4] block: blk-mq: support draining mq queue
Date: Thu, 26 Dec 2013 01:45:18 -0800 [thread overview]
Message-ID: <20131226094518.GA22894@infradead.org> (raw)
In-Reply-To: <CACVXFVN=sxHxUY_0c9xWKw3nXhj60UeSjvFTHs52zHNEAg__4w@mail.gmail.com>
On Tue, Dec 24, 2013 at 11:30:58AM +0800, Ming Lei wrote:
> Some drivers don't have LLDD, like null_blk, virtio-blk, ...
Well, they are the low-level driver in this case.
> Actually the below block APIs
> blk_get_request()
> blk_put_request()
> blk_execute_rq_nowait()
> blk_register_queue()
> blk_unregister_queue()
> blk_insert_flush()
> ....
>
> have been there to support MQ.
All these are called by higher level code and not the driver, so we need
a switch between MQ and non-MQ support somewhere.
> One problem about the 2nd way is that MQ drivers may become a bit
> ugly if the driver still need to support traditional request/bio mechanism.
On the other hand drivers have no legitimate case for long-term parallel
MQ/non-MQ code paths. The only exception is null_blk as a benchmarking
vehicle, but we should not optimize for that.
> >> + spin_unlock_irq(lock);
> >> + }
> >
> > Why doesn't the mq case set QUEUE_FLAG_DEAD here?
>
> Looks DEAD flag is set to prevent request_fn from being called,
> and there is no request_fn for MQ, so I don't set it and QUEUE_FLAG_DYING
> has been checked in blk_mq_queue_enter() already.
>
> But we can do it easily.
Do we have a per-context flag to prevent calling into the driver
instead? Sorry, it's been a while that I last looked at the code, but
anyone just looking over the difference will have the same question, so
the answer needs to go into a comment.
> > Also blk_execute_rq_nowait now needs to check the dying case for MQ as
> > well.
>
> In this patch the dying flag is only checked in blk_mq_queue_enter()
> which is called in allocating request path, so once the request is
> allocated, we just simply wait for its completion in blk_mq_drain_queue().
>
> Even for non-MQ case, looks blk_queue_dying(q) is checked to avoid
> being freed early before running queue, I am not sure if it is good
> because the I/O might or can have been completed. And it isn't a problem
> for MQ because this request can't be reused when dying is set.
Good. I think we'll want comments like that preferable in the code, but
at very least in the commit log.
next prev parent reply other threads:[~2013-12-26 9:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-23 16:18 [PATCH 0/4] block: blk-mq: support blk_cleanup_queue on mq Ming Lei
2013-12-23 16:18 ` [PATCH 1/4] block: blk-mq: support draining mq queue Ming Lei
2013-12-23 16:24 ` Christoph Hellwig
2013-12-24 3:30 ` Ming Lei
2013-12-26 9:45 ` Christoph Hellwig [this message]
2013-12-26 10:12 ` Ming Lei
2013-12-26 10:53 ` Christoph Hellwig
2013-12-23 16:18 ` [PATCH 2/4] block: blk-mq: make blk_sync_queue support mq Ming Lei
2013-12-23 16:25 ` Christoph Hellwig
2013-12-24 3:35 ` Ming Lei
2013-12-23 16:18 ` [PATCH 3/4] block: null_blk: fix queue leak inside removing device Ming Lei
2013-12-23 16:26 ` Christoph Hellwig
2013-12-23 16:18 ` [PATCH 4/4] block: blk-mq: don't export blk_mq_free_queue() Ming Lei
2013-12-23 16:27 ` Christoph Hellwig
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=20131226094518.GA22894@infradead.org \
--to=hch@infradead.org \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=tom.leiming@gmail.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
all inboxes | Powered by JetHome®