All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Suwan Kim <suwan.kim027@gmail.com>
Cc: mgurtovoy@nvidia.com, mst@redhat.com,
	virtualization@lists.linux-foundation.org,
	linux-block@vger.kernel.org, pbonzini@redhat.com
Subject: Re: [PATCH v4 1/2] virtio-blk: support polling I/O
Date: Tue, 5 Apr 2022 08:26:34 +0100	[thread overview]
Message-ID: <YkvvKr9nCfza5KRa@stefanha-x1.localdomain> (raw)
In-Reply-To: <20220405053122.77626-2-suwan.kim027@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1044 bytes --]

On Tue, Apr 05, 2022 at 02:31:21PM +0900, Suwan Kim wrote:
> +static int virtblk_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob)
> +{
> +	struct virtio_blk *vblk = hctx->queue->queuedata;
> +	struct virtio_blk_vq *vq = hctx->driver_data;
> +	struct virtblk_req *vbr;
> +	bool req_done = false;
> +	unsigned long flags;
> +	unsigned int len;
> +	int found = 0;
> +
> +	spin_lock_irqsave(&vq->lock, flags);
> +
> +	while ((vbr = virtqueue_get_buf(vq->vq, &len)) != NULL) {
> +		struct request *req = blk_mq_rq_from_pdu(vbr);
>  
> -	return blk_mq_virtio_map_queues(&set->map[HCTX_TYPE_DEFAULT],
> -					vblk->vdev, 0);
> +		found++;
> +		if (!blk_mq_add_to_batch(req, iob, vbr->status,
> +						virtblk_complete_batch))
> +			blk_mq_complete_request(req);
> +		req_done = true;
> +	}
> +
> +	if (req_done)

Minor nit: req_done can be replaced with found > 0.

> +		blk_mq_start_stopped_hw_queues(vblk->disk->queue, true);
> +
> +	spin_unlock_irqrestore(&vq->lock, flags);
> +
> +	return found;
> +}

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 484 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

WARNING: multiple messages have this Message-ID (diff)
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Suwan Kim <suwan.kim027@gmail.com>
Cc: mst@redhat.com, jasowang@redhat.com, pbonzini@redhat.com,
	mgurtovoy@nvidia.com, dongli.zhang@oracle.com,
	virtualization@lists.linux-foundation.org,
	linux-block@vger.kernel.org
Subject: Re: [PATCH v4 1/2] virtio-blk: support polling I/O
Date: Tue, 5 Apr 2022 08:26:34 +0100	[thread overview]
Message-ID: <YkvvKr9nCfza5KRa@stefanha-x1.localdomain> (raw)
In-Reply-To: <20220405053122.77626-2-suwan.kim027@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1044 bytes --]

On Tue, Apr 05, 2022 at 02:31:21PM +0900, Suwan Kim wrote:
> +static int virtblk_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob)
> +{
> +	struct virtio_blk *vblk = hctx->queue->queuedata;
> +	struct virtio_blk_vq *vq = hctx->driver_data;
> +	struct virtblk_req *vbr;
> +	bool req_done = false;
> +	unsigned long flags;
> +	unsigned int len;
> +	int found = 0;
> +
> +	spin_lock_irqsave(&vq->lock, flags);
> +
> +	while ((vbr = virtqueue_get_buf(vq->vq, &len)) != NULL) {
> +		struct request *req = blk_mq_rq_from_pdu(vbr);
>  
> -	return blk_mq_virtio_map_queues(&set->map[HCTX_TYPE_DEFAULT],
> -					vblk->vdev, 0);
> +		found++;
> +		if (!blk_mq_add_to_batch(req, iob, vbr->status,
> +						virtblk_complete_batch))
> +			blk_mq_complete_request(req);
> +		req_done = true;
> +	}
> +
> +	if (req_done)

Minor nit: req_done can be replaced with found > 0.

> +		blk_mq_start_stopped_hw_queues(vblk->disk->queue, true);
> +
> +	spin_unlock_irqrestore(&vq->lock, flags);
> +
> +	return found;
> +}

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 484 bytes --]

  reply	other threads:[~2022-04-05  7:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05  5:31 [PATCH v4 0/2] virtio-blk: support polling I/O and mq_ops->queue_rqs() Suwan Kim
2022-04-05  5:31 ` [PATCH v4 1/2] virtio-blk: support polling I/O Suwan Kim
2022-04-05  7:26   ` Stefan Hajnoczi [this message]
2022-04-05  7:26     ` Stefan Hajnoczi
2022-04-05 10:08     ` Suwan Kim
2022-04-05  8:51   ` Christoph Hellwig
2022-04-05  8:51     ` Christoph Hellwig
2022-04-05 10:30     ` Suwan Kim
2022-04-05 14:35     ` Suwan Kim
2022-04-05  5:31 ` [PATCH v4 2/2] virtio-blk: support mq_ops->queue_rqs() Suwan Kim
2022-04-05  8:57   ` Christoph Hellwig
2022-04-05  8:57     ` Christoph Hellwig
2022-04-05 10:56     ` Suwan Kim
2022-04-05  9:09   ` Stefan Hajnoczi
2022-04-05  9:09     ` Stefan Hajnoczi
  -- strict thread matches above, loose matches on Subject: below --
2022-04-04  9:28 [PATCH v4 0/2] virtio-blk: support polling I/O and mq_ops->queue_rqs() Suwan Kim
2022-04-04  9:28 ` [PATCH v4 1/2] virtio-blk: support polling I/O Suwan Kim
2022-04-05  5: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=YkvvKr9nCfza5KRa@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=mgurtovoy@nvidia.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.