Skip to contentSkip to conversation

vhost-vsock: support parse mergeable feature

PATCH In review jiangyiwen 3 participants 8 messages Dec 12, 2018 – Dec 14, 2018

lore
Share & tools
lore

jiangyiwen

author
#0 lore raw

PATCH 1/1 vhost-vsock: support parse mergeable feature

Currently vhost-vsock doesn't have any feature bits, so it don't support parse mergeable rx buffer feature. And the feature is support in another series of patches named "VSOCK: support mergeable rx buffer in vhost-vsock".

So we neet to support parse mergeable feature in vhost-vsock if above patches are merged.

---
 hw/virtio/vhost-vsock.c                       | 9 +++++++--
 include/standard-headers/linux/virtio_vsock.h | 3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)
hw/virtio/vhost-vsock.c +7 -2
index aa5af92..5023c05 100644
@@ -178,8 +178,13 @@ static uint64_t vhost_vsock_get_features(VirtIODevice *vdev,
                                          uint64_t requested_features,
                                          Error **errp)
 {
-    /* No feature bits used yet */
-    return requested_features;
+    VHostVSock *vsock = VHOST_VSOCK(vdev);
+    uint64_t features;
+
+    virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_MRG_RXBUF);
+    features = requested_features & vsock->vhost_dev.features;
+
+    return features;
 }
 
 static void vhost_vsock_handle_output(VirtIODevice *vdev, VirtQueue *vq)
include/standard-headers/linux/virtio_vsock.h +3 -0
index be44321..4c583ec 100644
@@ -38,6 +38,9 @@
 #include "standard-headers/linux/virtio_ids.h"
 #include "standard-headers/linux/virtio_config.h"
 
+/* Virtio-vsock feature */
+#define VIRTIO_VSOCK_F_MRG_RXBUF 0 /* Host can merge receive buffers. */
+
 struct virtio_vsock_config {
 	uint64_t guest_cid;
 } QEMU_PACKED;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 9 lines · jiangyiwen

Currently vhost-vsock doesn't have any feature bits, so it don't support parse mergeable rx buffer feature. And the feature is support in another series of patches named "VSOCK: support mergeable rx buffer in vhost-vsock".

So we neet to support parse mergeable feature in vhost-vsock if above patches are merged.

OK but what does it do? this just defines the feature bit ... Also pls copy virtio-dev whenever you change the host/guest interface.

Thanks!

Quoted 42 lines
---
 hw/virtio/vhost-vsock.c                       | 9 +++++++--
 include/standard-headers/linux/virtio_vsock.h | 3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)
hw/virtio/vhost-vsock.c +7 -2
index aa5af92..5023c05 100644
@@ -178,8 +178,13 @@ static uint64_t vhost_vsock_get_features(VirtIODevice *vdev,
                                          uint64_t requested_features,
                                          Error **errp)
 {
-    /* No feature bits used yet */
-    return requested_features;
+    VHostVSock *vsock = VHOST_VSOCK(vdev);
+    uint64_t features;
+
+    virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_MRG_RXBUF);
+    features = requested_features & vsock->vhost_dev.features;
+
+    return features;
 }
 
 static void vhost_vsock_handle_output(VirtIODevice *vdev, VirtQueue *vq)
include/standard-headers/linux/virtio_vsock.h +3 -0
index be44321..4c583ec 100644
@@ -38,6 +38,9 @@
 #include "standard-headers/linux/virtio_ids.h"
 #include "standard-headers/linux/virtio_config.h"
 
+/* Virtio-vsock feature */
+#define VIRTIO_VSOCK_F_MRG_RXBUF 0 /* Host can merge receive buffers. */
+
 struct virtio_vsock_config {
 	uint64_t guest_cid;
 } QEMU_PACKED;
Signature · 1 line
1.8.3.1
author
#2 lore raw
Quoted 9 lines · Michael S. Tsirkin
Quoted 8 lines · jiangyiwen

Currently vhost-vsock doesn't have any feature bits, so it don't support parse mergeable rx buffer feature. And the feature is support in another series of patches named "VSOCK: support mergeable rx buffer in vhost-vsock".

So we neet to support parse mergeable feature in vhost-vsock if above patches are merged.

Quoted 8 lines
Quoted 1 line

OK but what does it do? this just defines the feature bit ... Also pls copy virtio-dev whenever you change the host/guest interface.

Thanks!

Hi Michael,

In my opinion, for vhost device, device feature bits need to be intersected between vhost and qemu, so I add mergeable rx buffer feature into vdev->host_features, and then intersected with vhost_dev features.

Later if someone want to add new feature, it can use virtio_add_feature() in vhost_vsock_get_features().

Thanks,
Yiwen.

Quoted 45 lines
Quoted 42 lines
---
 hw/virtio/vhost-vsock.c                       | 9 +++++++--
 include/standard-headers/linux/virtio_vsock.h | 3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)
hw/virtio/vhost-vsock.c +7 -2
index aa5af92..5023c05 100644
@@ -178,8 +178,13 @@ static uint64_t vhost_vsock_get_features(VirtIODevice *vdev,
                                          uint64_t requested_features,
                                          Error **errp)
 {
-    /* No feature bits used yet */
-    return requested_features;
+    VHostVSock *vsock = VHOST_VSOCK(vdev);
+    uint64_t features;
+
+    virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_MRG_RXBUF);
+    features = requested_features & vsock->vhost_dev.features;
+
+    return features;
 }
 
 static void vhost_vsock_handle_output(VirtIODevice *vdev, VirtQueue *vq)
include/standard-headers/linux/virtio_vsock.h +3 -0
index be44321..4c583ec 100644
@@ -38,6 +38,9 @@
 #include "standard-headers/linux/virtio_ids.h"
 #include "standard-headers/linux/virtio_config.h"
 
+/* Virtio-vsock feature */
+#define VIRTIO_VSOCK_F_MRG_RXBUF 0 /* Host can merge receive buffers. */
+
 struct virtio_vsock_config {
 	uint64_t guest_cid;
 } QEMU_PACKED;
Signature · 1 line
1.8.3.1

.

#3 lore raw
Quoted 25 lines · jiangyiwen
Quoted 9 lines · Michael S. Tsirkin
Quoted 8 lines · jiangyiwen

Currently vhost-vsock doesn't have any feature bits, so it don't support parse mergeable rx buffer feature. And the feature is support in another series of patches named "VSOCK: support mergeable rx buffer in vhost-vsock".

So we neet to support parse mergeable feature in vhost-vsock if above patches are merged.

Quoted 8 lines
Quoted 1 line

OK but what does it do? this just defines the feature bit ... Also pls copy virtio-dev whenever you change the host/guest interface.

Thanks!

Hi Michael,

In my opinion, for vhost device, device feature bits need to be intersected between vhost and qemu, so I add mergeable rx buffer feature into vdev->host_features, and then intersected with vhost_dev features.

Quoted 5 lines

Later if someone want to add new feature, it can use virtio_add_feature() in vhost_vsock_get_features().

Thanks,
Yiwen.

I understand. Sorry. It seems that your patchset wasn't threaded properly, each patch was by its own. Can you pls take a look at fixing that?

Quoted 46 lines
Quoted 45 lines
Quoted 42 lines
---
 hw/virtio/vhost-vsock.c                       | 9 +++++++--
 include/standard-headers/linux/virtio_vsock.h | 3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)
hw/virtio/vhost-vsock.c +7 -2
index aa5af92..5023c05 100644
@@ -178,8 +178,13 @@ static uint64_t vhost_vsock_get_features(VirtIODevice *vdev,
                                          uint64_t requested_features,
                                          Error **errp)
 {
-    /* No feature bits used yet */
-    return requested_features;
+    VHostVSock *vsock = VHOST_VSOCK(vdev);
+    uint64_t features;
+
+    virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_MRG_RXBUF);
+    features = requested_features & vsock->vhost_dev.features;
+
+    return features;
 }
 
 static void vhost_vsock_handle_output(VirtIODevice *vdev, VirtQueue *vq)
include/standard-headers/linux/virtio_vsock.h +3 -0
index be44321..4c583ec 100644
@@ -38,6 +38,9 @@
 #include "standard-headers/linux/virtio_ids.h"
 #include "standard-headers/linux/virtio_config.h"
 
+/* Virtio-vsock feature */
+#define VIRTIO_VSOCK_F_MRG_RXBUF 0 /* Host can merge receive buffers. */
+
 struct virtio_vsock_config {
 	uint64_t guest_cid;
 } QEMU_PACKED;
Signature · 1 line
1.8.3.1

.

author
#4 lore raw
Quoted 29 lines · Michael S. Tsirkin
Quoted 28 lines · jiangyiwen
Quoted 9 lines · Michael S. Tsirkin
Quoted 8 lines · jiangyiwen

Currently vhost-vsock doesn't have any feature bits, so it don't support parse mergeable rx buffer feature. And the feature is support in another series of patches named "VSOCK: support mergeable rx buffer in vhost-vsock".

So we neet to support parse mergeable feature in vhost-vsock if above patches are merged.

Quoted 8 lines
Quoted 1 line

OK but what does it do? this just defines the feature bit ... Also pls copy virtio-dev whenever you change the host/guest interface.

Thanks!

Hi Michael,

In my opinion, for vhost device, device feature bits need to be intersected between vhost and qemu, so I add mergeable rx buffer feature into vdev->host_features, and then intersected with vhost_dev features.

Later if someone want to add new feature, it can use virtio_add_feature() in vhost_vsock_get_features().

Quoted 7 lines
Quoted 2 lines

Thanks,
Yiwen.

I understand. Sorry. It seems that your patchset wasn't threaded properly, each patch was by its own. Can you pls take a look at fixing that?

Hi Michael,

Thanks your suggestions, I want to how to send patch when patch involving multiple communities, like qemu and linux kernel. In this case, how should we send them?

Thanks,
Yiwen.

Quoted 49 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
---
 hw/virtio/vhost-vsock.c                       | 9 +++++++--
 include/standard-headers/linux/virtio_vsock.h | 3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)
hw/virtio/vhost-vsock.c +7 -2
index aa5af92..5023c05 100644
@@ -178,8 +178,13 @@ static uint64_t vhost_vsock_get_features(VirtIODevice *vdev,
                                          uint64_t requested_features,
                                          Error **errp)
 {
-    /* No feature bits used yet */
-    return requested_features;
+    VHostVSock *vsock = VHOST_VSOCK(vdev);
+    uint64_t features;
+
+    virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_MRG_RXBUF);
+    features = requested_features & vsock->vhost_dev.features;
+
+    return features;
 }
 
 static void vhost_vsock_handle_output(VirtIODevice *vdev, VirtQueue *vq)
include/standard-headers/linux/virtio_vsock.h +0 -0
index be44321..4c583ec 100644
@@ -38,6 +38,9 @@
 #include "standard-headers/linux/virtio_ids.h"
 #include "standard-headers/linux/virtio_config.h"
 
Quoted 13 lines
Quoted 12 lines
Quoted 9 lines
include/standard-headers/linux/virtio_vsock.h +3 -0
+/* Virtio-vsock feature */
+#define VIRTIO_VSOCK_F_MRG_RXBUF 0 /* Host can merge receive buffers. */
+
 struct virtio_vsock_config {
 	uint64_t guest_cid;
 } QEMU_PACKED;
Signature · 1 line
1.8.3.1

.

.

#5 lore raw
Quoted 38 lines · jiangyiwen
Quoted 29 lines · Michael S. Tsirkin
Quoted 28 lines · jiangyiwen
Quoted 9 lines · Michael S. Tsirkin
Quoted 8 lines · jiangyiwen

Currently vhost-vsock doesn't have any feature bits, so it don't support parse mergeable rx buffer feature. And the feature is support in another series of patches named "VSOCK: support mergeable rx buffer in vhost-vsock".

So we neet to support parse mergeable feature in vhost-vsock if above patches are merged.

Quoted 8 lines
Quoted 1 line

OK but what does it do? this just defines the feature bit ... Also pls copy virtio-dev whenever you change the host/guest interface.

Thanks!

Hi Michael,

In my opinion, for vhost device, device feature bits need to be intersected between vhost and qemu, so I add mergeable rx buffer feature into vdev->host_features, and then intersected with vhost_dev features.

Later if someone want to add new feature, it can use virtio_add_feature() in vhost_vsock_get_features().

Quoted 7 lines
Quoted 2 lines

Thanks,
Yiwen.

I understand. Sorry. It seems that your patchset wasn't threaded properly, each patch was by its own. Can you pls take a look at fixing that?

Quoted 8 lines

Hi Michael,

Thanks your suggestions, I want to how to send patch when patch involving multiple communities, like qemu and linux kernel. In this case, how should we send them?

Thanks,
Yiwen.

Both use the same threading so just copy both.

Quoted 50 lines
Quoted 49 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
---
 hw/virtio/vhost-vsock.c                       | 9 +++++++--
 include/standard-headers/linux/virtio_vsock.h | 3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)
hw/virtio/vhost-vsock.c +7 -2
index aa5af92..5023c05 100644
@@ -178,8 +178,13 @@ static uint64_t vhost_vsock_get_features(VirtIODevice *vdev,
                                          uint64_t requested_features,
                                          Error **errp)
 {
-    /* No feature bits used yet */
-    return requested_features;
+    VHostVSock *vsock = VHOST_VSOCK(vdev);
+    uint64_t features;
+
+    virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_MRG_RXBUF);
+    features = requested_features & vsock->vhost_dev.features;
+
+    return features;
 }
 
 static void vhost_vsock_handle_output(VirtIODevice *vdev, VirtQueue *vq)
include/standard-headers/linux/virtio_vsock.h +0 -0
index be44321..4c583ec 100644
@@ -38,6 +38,9 @@
 #include "standard-headers/linux/virtio_ids.h"
 #include "standard-headers/linux/virtio_config.h"
 
Quoted 13 lines
Quoted 12 lines
Quoted 9 lines
include/standard-headers/linux/virtio_vsock.h +3 -0
+/* Virtio-vsock feature */
+#define VIRTIO_VSOCK_F_MRG_RXBUF 0 /* Host can merge receive buffers. */
+
 struct virtio_vsock_config {
 	uint64_t guest_cid;
 } QEMU_PACKED;
Signature · 1 line
1.8.3.1

.

.

#6 lore raw
In reply to jiangyiwen
Quoted 19 lines · jiangyiwen
Quoted 9 lines · Michael S. Tsirkin
Quoted 8 lines · jiangyiwen

Currently vhost-vsock doesn't have any feature bits, so it don't support parse mergeable rx buffer feature. And the feature is support in another series of patches named "VSOCK: support mergeable rx buffer in vhost-vsock".

So we neet to support parse mergeable feature in vhost-vsock if above patches are merged.

Quoted 8 lines
Quoted 1 line

OK but what does it do? this just defines the feature bit ... Also pls copy virtio-dev whenever you change the host/guest interface.

Thanks!

Quoted 8 lines

Hi Michael,

In my opinion, for vhost device, device feature bits need to be intersected between vhost and qemu, so I add mergeable rx buffer feature into vdev->host_features, and then intersected with vhost_dev features.

Later if someone want to add new feature, it can use virtio_add_feature() in vhost_vsock_get_features().

Hi Yiwen,
I think Michael's comment is about documenting the behavior of the new feature bit.

Each change to a VIRTIO device host<->guest interface needs to be discussed in the VIRTIO community <[email protected]> and described in a patch to the VIRTIO specification
(https://github.com/oasis-tcs/virtio-spec/).

Stefan

author
#7 lore raw
Quoted 33 lines · Stefan Hajnoczi
Quoted 19 lines · jiangyiwen
Quoted 9 lines · Michael S. Tsirkin
Quoted 8 lines · jiangyiwen

Currently vhost-vsock doesn't have any feature bits, so it don't support parse mergeable rx buffer feature. And the feature is support in another series of patches named "VSOCK: support mergeable rx buffer in vhost-vsock".

So we neet to support parse mergeable feature in vhost-vsock if above patches are merged.

Quoted 8 lines
Quoted 1 line

OK but what does it do? this just defines the feature bit ... Also pls copy virtio-dev whenever you change the host/guest interface.

Thanks!

Quoted 8 lines

Hi Michael,

In my opinion, for vhost device, device feature bits need to be intersected between vhost and qemu, so I add mergeable rx buffer feature into vdev->host_features, and then intersected with vhost_dev features.

Later if someone want to add new feature, it can use virtio_add_feature() in vhost_vsock_get_features().

Hi Yiwen,
I think Michael's comment is about documenting the behavior of the new feature bit.

Quoted 7 lines

Each change to a VIRTIO device host<->guest interface needs to be discussed in the VIRTIO community <[email protected]> and described in a patch to the VIRTIO specification
(https://github.com/oasis-tcs/virtio-spec/).

Stefan

Hi Stefan,

Ok, I will fix it in the later version, I have not sent a series of patches before, thank you for your help.

Thanks again,
Yiwen.