Skip to contentSkip to conversation

virtio-blk: support per-device queue depth

RFC PATCH In review Joseph Qi 4 participants 12 messages Jan 18, 2021 – Jan 22, 2021

Subsystems (3)
lore
Share & tools
lore

Joseph Qi

author
#0 lore raw

RFC PATCH 1/1 virtio-blk: support per-device queue depth

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.

---
 drivers/block/virtio_blk.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/block/virtio_blk.c +7 -5
index 145606d..f83a417 100644
@@ -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 =
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 7 lines · Joseph Qi

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

Quoted 32 lines
---
  drivers/block/virtio_blk.c | 12 +++++++-----
  1 file changed, 7 insertions(+), 5 deletions(-)
drivers/block/virtio_blk.c +5 -4
index 145606d..f83a417 100644
@@ -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 {

drivers/block/virtio_blk.c static int virtblk_probe(struct virtio_device *vdev) · line 773

Quoted 10 lines
drivers/block/virtio_blk.c +2 -1
+		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
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

author
#2 lore raw

Hi Jason,

Quoted 11 lines · Jason Wang
Quoted 7 lines · Joseph Qi

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.

Quoted 2 lines

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

Thanks for quick response.
Do you mean adjust /sys/block/vdX/queue/nr_requests? But current logic in virtblk_probe() is, virtblk_queue_depth is used as a saved value for first probed vdev, not purely module parameter.

Thanks,
Joseph

#3 lore raw
Quoted 12 lines · Joseph Qi

Hi Jason,

Quoted 9 lines · Jason Wang
Quoted 7 lines · Joseph Qi

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.

Quoted 7 lines
Quoted 2 lines

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

Thanks for quick response.
Do you mean adjust /sys/block/vdX/queue/nr_requests? But current logic in virtblk_probe() is, virtblk_queue_depth is used as a saved value for first probed vdev, not purely module parameter.

Right, I see. So I think the patch is fine.

Thanks

Quoted 4 lines

Thanks,
Joseph

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#4 lore raw
In reply to Jason Wang
Quoted 11 lines · Jason Wang
Quoted 7 lines · Joseph Qi

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.

Quoted 3 lines

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

"/sys/block/<dev>/queue/nr_requests" indeed works, but isn't better to set queue_depth according to the hardware capability at the very first? AFAIK, nvme just set per-device queue_depth at initializing phase.

Thanks,
Jeffle

Quoted 42 lines
Quoted 42 lines

---
  drivers/block/virtio_blk.c | 12 +++++++-----

  1 file changed, 7 insertions(+), 5 deletions(-)
drivers/block/virtio_blk.c +1 -0
index 145606d..f83a417 100644
@@ -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 =

Signature · 6 lines
Thanks,
Jeffle
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
#5 lore raw
Quoted 11 lines · JeffleXu
Quoted 9 lines · Jason Wang
Quoted 7 lines · Joseph Qi

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.

Quoted 6 lines
Quoted 3 lines

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

"/sys/block/<dev>/queue/nr_requests" indeed works, but isn't better to set queue_depth according to the hardware capability at the very first? AFAIK, nvme just set per-device queue_depth at initializing phase.

I agree, the problem is that the current code may modify module parameter.

Thanks

Quoted 36 lines

Thanks,
Jeffle

Quoted 32 lines
Quoted 32 lines
---
   drivers/block/virtio_blk.c | 12 +++++++-----
   1 file changed, 7 insertions(+), 5 deletions(-)
drivers/block/virtio_blk.c +6 -3
index 145606d..f83a417 100644
@@ -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;
Quoted 8 lines
Quoted 8 lines

drivers/block/virtio_blk.c static int virtblk_probe(struct virtio_device *vdev) · line 773

Quoted 8 lines
drivers/block/virtio_blk.c +1 -1
       }
         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
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#6 lore raw
Quoted 17 lines · Jason Wang
Quoted 15 lines · JeffleXu
Quoted 13 lines · Jason Wang
Quoted 8 lines · Joseph Qi

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).

Quoted 6 lines
Quoted 3 lines

"/sys/block/<dev>/queue/nr_requests" indeed works, but isn't better to set queue_depth according to the hardware capability at the very first? AFAIK, nvme just set per-device queue_depth at initializing phase.

I agree, the problem is that the current code may modify module parameter.

The module parameter 'virtblk_queue_depth' is actually remained untainted.

Actually it is the original code before this patch that changes the module parameter. When the module parameter is not set by boot cmdline (i.e., default to 0), it will be initialized to the queue_depth of the vring of the first probed virtio-blk device, and will be revealed to user space through '/sys/module/virtio_blk/parameters/queue_depth'. I'm not sure if this behavior is reasonable or not.

The only side effect of this patch is that, now '/sys/module/virtio_blk/parameters/queue_depth' will be kept as '0' when the module parameter is not set manually.

Thanks,
Jeffle

Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
Quoted 42 lines

---
   drivers/block/virtio_blk.c | 12 +++++++-----

   1 file changed, 7 insertions(+), 5 deletions(-)
drivers/block/virtio_blk.c +1 -0
index 145606d..f83a417 100644
@@ -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 =

Signature · 6 lines
Thanks,
Jeffle
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
#7 lore raw
Quoted 20 lines · JeffleXu
Quoted 18 lines · Jason Wang
Quoted 16 lines · JeffleXu
Quoted 9 lines · Jason Wang
Quoted 8 lines · Joseph Qi

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.

Quoted 3 lines

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

"/sys/block/<dev>/queue/nr_requests" indeed works, but isn't better to set queue_depth according to the hardware capability at the very first? AFAIK, nvme just set per-device queue_depth at initializing phase.

Quoted 5 lines
Quoted 1 line

I agree, the problem is that the current code may modify module parameter.

The module parameter 'virtblk_queue_depth' is actually remained untainted.

Actually it is the original code before this patch that changes the module parameter.

Yes, that's what I meant.

Quoted 5 lines

When the module parameter is not set by boot cmdline
(i.e., default to 0), it will be initialized to the queue_depth of the vring of the first probed virtio-blk device, and will be revealed to user space through '/sys/module/virtio_blk/parameters/queue_depth'. I'm not sure if this behavior is reasonable or not.

Right, it means the virtio-blk devices that is probed after the first one can only use the queue_depth that is set according to the capability of the first virtio-blk device.

Quoted 4 lines

The only side effect of this patch is that, now '/sys/module/virtio_blk/parameters/queue_depth' will be kept as '0' when the module parameter is not set manually.

I think it's not an issue, the nr_request should be the correct way to  get per device queue depth.

Thanks

Quoted 38 lines

Thanks,
Jeffle

Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
---
    drivers/block/virtio_blk.c | 12 +++++++-----
    1 file changed, 7 insertions(+), 5 deletions(-)
drivers/block/virtio_blk.c +6 -3
index 145606d..f83a417 100644
@@ -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;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/block/virtio_blk.c static int virtblk_probe(struct virtio_device *vdev) · line 773

Quoted 8 lines
drivers/block/virtio_blk.c +1 -1
        }
          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
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Acked-by on v1 1/1
#8 lore raw
In reply to Joseph Qi
Quoted 9 lines · Joseph Qi

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.

Quoted 30 lines
---
  drivers/block/virtio_blk.c | 12 +++++++-----
  1 file changed, 7 insertions(+), 5 deletions(-)
drivers/block/virtio_blk.c +5 -4
index 145606d..f83a417 100644
@@ -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 {

drivers/block/virtio_blk.c static int virtblk_probe(struct virtio_device *vdev) · line 773

Quoted 10 lines
drivers/block/virtio_blk.c +2 -1
+		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
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

author
#9 lore raw

Hi Michael,

Any comments on this patch?

Thanks,
Joseph

Quoted 53 lines · Jason Wang
Quoted 9 lines · Joseph Qi

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.

Quoted 37 lines

---
  drivers/block/virtio_blk.c | 12 +++++++-----

  1 file changed, 7 insertions(+), 5 deletions(-)
drivers/block/virtio_blk.c +1 -0
index 145606d..f83a417 100644
@@ -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 =

author
#11 lore raw
Quoted 11 lines · Michael S. Tsirkin
Quoted 6 lines · Joseph Qi

Hi Michael,

Any comments on this patch?

Thanks,
Joseph

Suggest copying all reviewers, including Paolo Bonzini <[email protected]> and Stefan Hajnoczi <[email protected]>.

Sure, will send v2 including cc reviewers.

Thanks,
Joseph