From: Stefan Hajnoczi <stefanha@redhat.com>
To: axboe@kernel.dk
Cc: mst@redhat.com, jasowang@redhat.com, pbonzini@redhat.com,
hch@infradead.org, virtualization@lists.linux-foundation.org,
linux-block@vger.kernel.org, Suwan Kim <suwan.kim027@gmail.com>
Subject: Re: [PATCH 1/2] virtio-blk: set req->state to MQ_RQ_COMPLETE after polling I/O is finished
Date: Wed, 7 Dec 2022 16:47:39 -0500 [thread overview]
Message-ID: <Y5EJ+6qtsy8Twe/q@fedora> (raw)
In-Reply-To: <20221206141125.93055-1-suwan.kim027@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1734 bytes --]
On Tue, Dec 06, 2022 at 11:11:24PM +0900, Suwan Kim wrote:
> Driver should set req->state to MQ_RQ_COMPLETE after it finishes to process
> req. But virtio-blk doesn't set MQ_RQ_COMPLETE after virtblk_poll() handles
> req and req->state still remains MQ_RQ_IN_FLIGHT. Fortunately so far there
> is no issue about it because blk_mq_end_request_batch() sets req->state to
> MQ_RQ_IDLE. This patch properly sets req->state after polling I/O is finished.
>
> Fixes: 4e0400525691 ("virtio-blk: support polling I/O")
> Signed-off-by: Suwan Kim <suwan.kim027@gmail.com>
> ---
> drivers/block/virtio_blk.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 19da5defd734..cf64d256787e 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -839,6 +839,7 @@ static void virtblk_complete_batch(struct io_comp_batch *iob)
> rq_list_for_each(&iob->req_list, req) {
> virtblk_unmap_data(req, blk_mq_rq_to_pdu(req));
> virtblk_cleanup_cmd(req);
> + blk_mq_set_request_complete(req);
> }
> blk_mq_end_request_batch(iob);
> }
The doc comment for blk_mq_set_request_complete() mentions this being
used in ->queue_rq(), but that's not the case here. Does the doc comment
need to be updated if we're using the function in a different way?
I'm not familiar enough with the Linux block APIs, but this feels weird
to me. Shouldn't blk_mq_end_request_batch(iob) take care of this for us?
Why does it set the state to IDLE instead of COMPLETE?
I think Jens can confirm whether we really want all drivers that use
polling and io_comp_batch to manually call
blk_mq_set_request_complete().
Thanks,
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-12-08 14:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-06 14:11 [PATCH 1/2] virtio-blk: set req->state to MQ_RQ_COMPLETE after polling I/O is finished Suwan Kim
2022-12-06 14:11 ` [PATCH 2/2] virtio-blk: support completion batching for the IRQ path Suwan Kim
2022-12-07 22:05 ` Stefan Hajnoczi
2022-12-12 14:43 ` Suwan Kim
2022-12-07 21:47 ` Stefan Hajnoczi [this message]
2022-12-08 16:48 ` [PATCH 1/2] virtio-blk: set req->state to MQ_RQ_COMPLETE after polling I/O is finished Jens Axboe
2022-12-12 6:50 ` Christoph Hellwig
2022-12-12 14:21 ` Suwan Kim
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=Y5EJ+6qtsy8Twe/q@fedora \
--to=stefanha@redhat.com \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=jasowang@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=suwan.kim027@gmail.com \
--cc=virtualization@lists.linux-foundation.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