All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Joseph Qi <joseph.qi@linux.alibaba.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Cc: virtualization@lists.linux-foundation.org,
	linux-block@vger.kernel.org,
	Jeffle Xu <jefflexu@linux.alibaba.com>
Subject: Re: [PATCH RFC] virtio-blk: support per-device queue depth
Date: Mon, 18 Jan 2021 13:25:45 +0800	[thread overview]
Message-ID: <ab4cbc06-b629-dd35-52ac-1246d500d1c4@redhat.com> (raw)
In-Reply-To: <1610942338-78252-1-git-send-email-joseph.qi@linux.alibaba.com>


On 2021/1/18 上午11:58, Joseph Qi wrote:
> module parameter 'virtblk_queue_depth' was firstly introduced for
> testing/benchmarking purposes described in commit fc4324b4597c
> ("virtio-blk: base queue-depth on virtqueue ringsize or module param").
> Since we have different virtio-blk devices which have different
> capabilities, it requires that we support per-device queue depth instead
> of per-module. So defaultly use vq free elements if module parameter
> 'virtblk_queue_depth' is not set.


I wonder if it's better to use sysfs instead (or whether it has already 
had something like this in the blocker layer).

Thanks


>
> Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
>   drivers/block/virtio_blk.c | 12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 145606d..f83a417 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -705,6 +705,7 @@ static int virtblk_probe(struct virtio_device *vdev)
>   	u32 v, blk_size, max_size, sg_elems, opt_io_size;
>   	u16 min_io_size;
>   	u8 physical_block_exp, alignment_offset;
> +	unsigned int queue_depth;
>   
>   	if (!vdev->config->get) {
>   		dev_err(&vdev->dev, "%s failure: config access disabled\n",
> @@ -755,17 +756,18 @@ static int virtblk_probe(struct virtio_device *vdev)
>   		goto out_free_vq;
>   	}
>   
> -	/* Default queue sizing is to fill the ring. */
> -	if (!virtblk_queue_depth) {
> -		virtblk_queue_depth = vblk->vqs[0].vq->num_free;
> +	if (likely(!virtblk_queue_depth)) {
> +		queue_depth = vblk->vqs[0].vq->num_free;
>   		/* ... but without indirect descs, we use 2 descs per req */
>   		if (!virtio_has_feature(vdev, VIRTIO_RING_F_INDIRECT_DESC))
> -			virtblk_queue_depth /= 2;
> +			queue_depth /= 2;
> +	} else {
> +		queue_depth = virtblk_queue_depth;
>   	}
>   
>   	memset(&vblk->tag_set, 0, sizeof(vblk->tag_set));
>   	vblk->tag_set.ops = &virtio_mq_ops;
> -	vblk->tag_set.queue_depth = virtblk_queue_depth;
> +	vblk->tag_set.queue_depth = queue_depth;
>   	vblk->tag_set.numa_node = NUMA_NO_NODE;
>   	vblk->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
>   	vblk->tag_set.cmd_size =


WARNING: multiple messages have this Message-ID (diff)
From: Jason Wang <jasowang@redhat.com>
To: Joseph Qi <joseph.qi@linux.alibaba.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Cc: linux-block@vger.kernel.org, virtualization@lists.linux-foundation.org
Subject: Re: [PATCH RFC] virtio-blk: support per-device queue depth
Date: Mon, 18 Jan 2021 13:25:45 +0800	[thread overview]
Message-ID: <ab4cbc06-b629-dd35-52ac-1246d500d1c4@redhat.com> (raw)
In-Reply-To: <1610942338-78252-1-git-send-email-joseph.qi@linux.alibaba.com>


On 2021/1/18 上午11:58, Joseph Qi wrote:
> module parameter 'virtblk_queue_depth' was firstly introduced for
> testing/benchmarking purposes described in commit fc4324b4597c
> ("virtio-blk: base queue-depth on virtqueue ringsize or module param").
> Since we have different virtio-blk devices which have different
> capabilities, it requires that we support per-device queue depth instead
> of per-module. So defaultly use vq free elements if module parameter
> 'virtblk_queue_depth' is not set.


I wonder if it's better to use sysfs instead (or whether it has already 
had something like this in the blocker layer).

Thanks


>
> Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
>   drivers/block/virtio_blk.c | 12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 145606d..f83a417 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -705,6 +705,7 @@ static int virtblk_probe(struct virtio_device *vdev)
>   	u32 v, blk_size, max_size, sg_elems, opt_io_size;
>   	u16 min_io_size;
>   	u8 physical_block_exp, alignment_offset;
> +	unsigned int queue_depth;
>   
>   	if (!vdev->config->get) {
>   		dev_err(&vdev->dev, "%s failure: config access disabled\n",
> @@ -755,17 +756,18 @@ static int virtblk_probe(struct virtio_device *vdev)
>   		goto out_free_vq;
>   	}
>   
> -	/* Default queue sizing is to fill the ring. */
> -	if (!virtblk_queue_depth) {
> -		virtblk_queue_depth = vblk->vqs[0].vq->num_free;
> +	if (likely(!virtblk_queue_depth)) {
> +		queue_depth = vblk->vqs[0].vq->num_free;
>   		/* ... but without indirect descs, we use 2 descs per req */
>   		if (!virtio_has_feature(vdev, VIRTIO_RING_F_INDIRECT_DESC))
> -			virtblk_queue_depth /= 2;
> +			queue_depth /= 2;
> +	} else {
> +		queue_depth = virtblk_queue_depth;
>   	}
>   
>   	memset(&vblk->tag_set, 0, sizeof(vblk->tag_set));
>   	vblk->tag_set.ops = &virtio_mq_ops;
> -	vblk->tag_set.queue_depth = virtblk_queue_depth;
> +	vblk->tag_set.queue_depth = queue_depth;
>   	vblk->tag_set.numa_node = NUMA_NO_NODE;
>   	vblk->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
>   	vblk->tag_set.cmd_size =

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

  reply	other threads:[~2021-01-18  5:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18  3:58 [PATCH RFC] virtio-blk: support per-device queue depth Joseph Qi
2021-01-18  5:25 ` Jason Wang [this message]
2021-01-18  5:25   ` Jason Wang
2021-01-18  6:06   ` Joseph Qi
2021-01-19  4:04     ` Jason Wang
2021-01-19  4:04       ` Jason Wang
2021-01-19  1:33   ` JeffleXu
2021-01-19  1:33     ` JeffleXu
2021-01-19  4:06     ` Jason Wang
2021-01-19  4:06       ` Jason Wang
2021-01-20  1:51       ` JeffleXu
2021-01-20  1:51         ` JeffleXu
2021-01-20  2:47         ` Jason Wang
2021-01-20  2:47           ` Jason Wang
2021-01-19  4:14 ` Jason Wang
2021-01-19  4:14   ` Jason Wang
2021-01-22  1:43   ` Joseph Qi
2021-01-22  8:34     ` Michael S. Tsirkin
2021-01-22  8:34       ` Michael S. Tsirkin
2021-01-22  9:13       ` Joseph Qi

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=ab4cbc06-b629-dd35-52ac-1246d500d1c4@redhat.com \
    --to=jasowang@redhat.com \
    --cc=jefflexu@linux.alibaba.com \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-block@vger.kernel.org \
    --cc=mst@redhat.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.