Revert "vhost: rename VHOST_RESET_OWNER to VHOST_RESET_DEVICE"
PATCH v2 1/5 Revert "vhost: rename VHOST_RESET_OWNER to VHOST_RESET_DEVICE"
This reverts commit d1f8b30ec8dde0318fd1b98d24a64926feae9625.
It turned out that it breaks stuff, so revert it:
http://lists.nongnu.org/archive/html/qemu-devel/2015-10/msg00949.html
--- docs/specs/vhost-user.txt | 4 ++-- hw/net/vhost_net.c | 2 +- hw/virtio/vhost-user.c | 8 ++++---- linux-headers/linux/vhost.h | 2 +- tests/vhost-user-test.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-)
docs/specs/vhost-user.txt +2 -2
@@ -211,10 +211,10 @@ Message types as an owner of the session. This can be used on the Slave as a "session start" flag. - * VHOST_USER_RESET_DEVICE + * VHOST_USER_RESET_OWNER Id: 4 - Equivalent ioctl: VHOST_RESET_DEVICE + Equivalent ioctl: VHOST_RESET_OWNER Master payload: N/A Issued when a new connection is about to be closed. The Master will no
hw/net/vhost_net.c +1 -1
@@ -296,7 +296,7 @@ static void vhost_net_stop_one(struct vhost_net *net, }else if (net->nc->info->type ==NET_CLIENT_OPTIONS_KIND_VHOST_USER ) {for (file.index =0 ; file.index < net->dev.nvqs; ++file.index) {const VhostOps *vhost_ops = net->dev.vhost_ops; -int r = vhost_ops->vhost_call (&net->dev,VHOST_RESET_DEVICE , +int r = vhost_ops->vhost_call (&net->dev,VHOST_RESET_OWNER ,NULL );assert (r >=0 ); }
hw/virtio/vhost-user.c +4 -4
@@ -34,7 +34,7 @@ typedef enum VhostUserRequest {VHOST_USER_GET_FEATURES =1 ,VHOST_USER_SET_FEATURES =2 ,VHOST_USER_SET_OWNER =3 , -VHOST_USER_RESET_DEVICE =4 , +VHOST_USER_RESET_OWNER =4 ,VHOST_USER_SET_MEM_TABLE =5 ,VHOST_USER_SET_LOG_BASE =6 , VHOST_USER_SET_LOG_FD = 7,
@@ -102,7 +102,7 @@ static unsigned long int ioctl_to_vhost_user_request[VHOST_USER_MAX] = {VHOST_GET_FEATURES ,/* VHOST_USER_GET_FEATURES */ VHOST_SET_FEATURES ,/* VHOST_USER_SET_FEATURES */ VHOST_SET_OWNER ,/* VHOST_USER_SET_OWNER */ -VHOST_RESET_DEVICE ,/* VHOST_USER_RESET_DEVICE */ +VHOST_RESET_OWNER ,/* VHOST_USER_RESET_OWNER */ VHOST_SET_MEM_TABLE ,/* VHOST_USER_SET_MEM_TABLE */ VHOST_SET_LOG_BASE ,/* VHOST_USER_SET_LOG_BASE */ VHOST_SET_LOG_FD, /* VHOST_USER_SET_LOG_FD */
@@ -192,7 +192,7 @@ static bool vhost_user_one_time_request(VhostUserRequest request) {switch (request) {case VHOST_USER_SET_OWNER : -case VHOST_USER_RESET_DEVICE : +case VHOST_USER_RESET_OWNER :case VHOST_USER_SET_MEM_TABLE :case VHOST_USER_GET_QUEUE_NUM :return true;
@@ -249,7 +249,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,break ;case VHOST_USER_SET_OWNER : -case VHOST_USER_RESET_DEVICE : +case VHOST_USER_RESET_OWNER :break ;case VHOST_USER_SET_MEM_TABLE :
linux-headers/linux/vhost.h +1 -1
@@ -78,7 +78,7 @@ struct vhost_memory {#define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01)/* Give up ownership, and reset the device to default values. * Allows subsequent call to VHOST_OWNER_SET to succeed. */ -#define VHOST_RESET_DEVICE _IO(VHOST_VIRTIO, 0x02) +#define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02)/* Set up/modify memory layout */ #define VHOST_SET_MEM_TABLE _IOW(VHOST_VIRTIO, 0x03, struct vhost_memory)
tests/vhost-user-test.c +1 -1
@@ -53,7 +53,7 @@ typedef enum VhostUserRequest {VHOST_USER_GET_FEATURES =1 ,VHOST_USER_SET_FEATURES =2 ,VHOST_USER_SET_OWNER =3 , -VHOST_USER_RESET_DEVICE =4 , +VHOST_USER_RESET_OWNER =4 ,VHOST_USER_SET_MEM_TABLE =5 ,VHOST_USER_SET_LOG_BASE =6 , VHOST_USER_SET_LOG_FD = 7,
Signature · 1 line
1.9.0
PATCH v2 2/5 doc: vhost-user: request naming fix
They are VHOST_USER_XXX instead of VHOST_XXX messages.
Also, add VHOST_USER_GET_QUEUE_NUM to the section that requries replies.
--- docs/specs/vhost-user.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
docs/specs/vhost-user.txt +9 -8
@@ -112,18 +112,19 @@ The communication consists of master sending message requests and slave sending message replies. Most of the requests don't require replies. Here is a list of the ones that do: - * VHOST_GET_FEATURES - * VHOST_GET_PROTOCOL_FEATURES - * VHOST_GET_VRING_BASE + * VHOST_USER_GET_FEATURES + * VHOST_USER_GET_PROTOCOL_FEATURES + * VHOST_USER_GET_VRING_BASE + * VHOST_USER_GET_QUEUE_NUM There are several messages that the master sends with file descriptors passed in the ancillary data: - * VHOST_SET_MEM_TABLE - * VHOST_SET_LOG_FD - * VHOST_SET_VRING_KICK - * VHOST_SET_VRING_CALL - * VHOST_SET_VRING_ERR + * VHOST_USER_SET_MEM_TABLE + * VHOST_USER_SET_LOG_FD + * VHOST_USER_SET_VRING_KICK + * VHOST_USER_SET_VRING_CALL + * VHOST_USER_SET_VRING_ERR If Master is unable to send the full message or receives a wrong reply it will close the connection. An optional reconnection mechanism can be implemented.
Signature · 1 line
1.9.0
PATCH v2 3/5 vhost-user-test: add multiple queue test
In reply to Yuanhan LiuSetting VHOST_USER_PROTOCOL_F_MQ protocol feature bit to claim that we support MQ feature, and simply assume we support 0xff queue pairs at most.
---
v2: use macro to define the max queues we support
--- tests/vhost-user-test.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
tests/vhost-user-test.c +19 -2
@@ -29,11 +29,14 @@#define HAVE_MONOTONIC_TIME #endif +#define MAX_QUEUS 0xff +#define QEMU_CMD_ACCEL " -machine accel=tcg"#define QEMU_CMD_MEM " -m 512 -object memory-backend-file,id=mem,size=512M,"\ "mem-path=%s,share=on -numa node,memdev=mem"#define QEMU_CMD_CHR " -chardev socket,id=chr0,path=%s" -#define QEMU_CMD_NETDEV " -netdev vhost-user,id=net0,chardev=chr0,vhostforce" +#define QEMU_CMD_NETDEV " -netdev vhost-user,id=net0,chardev=chr0,vhostforce," \ + "queues=2"#define QEMU_CMD_NET " -device virtio-net-pci,netdev=net0 "#define QEMU_CMD_ROM " -option-rom ../pc-bios/pxe-virtio.rom"
@@ -48,6 +51,8 @@#define VHOST_USER_F_PROTOCOL_FEATURES 30 +#define VHOST_USER_PROTOCOL_F_MQ 0 + typedef enum VhostUserRequest { VHOST_USER_NONE = 0, VHOST_USER_GET_FEATURES = 1,
@@ -66,6 +71,8 @@ typedef enum VhostUserRequest {VHOST_USER_SET_VRING_ERR =14 ,VHOST_USER_GET_PROTOCOL_FEATURES =15 ,VHOST_USER_SET_PROTOCOL_FEATURES =16 , +VHOST_USER_GET_QUEUE_NUM =17 , +VHOST_USER_SET_VRING_ENABLE =18 , VHOST_USER_MAX } VhostUserRequest;
@@ -232,7 +239,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)/* send back features to qemu */ msg.flags |=VHOST_USER_REPLY_MASK ; msg.size =sizeof (m.u64); - msg.u64 =0 ; + msg.u64 = (1ULL <<VHOST_USER_PROTOCOL_F_MQ ); p = (uint8_t *) &msg;qemu_chr_fe_write_all (chr, p,VHOST_USER_HDR_SIZE + msg.size);break ;
@@ -266,6 +273,16 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)*/ qemu_set_nonblock (fd);break ; + +case VHOST_USER_GET_QUEUE_NUM : +/* send back the number of queues we support (let it be 2) to qemu */ + msg.flags |=VHOST_USER_REPLY_MASK ; + msg.size =sizeof (m.u64); + msg.u64 =MAX_QUEUS ; + p = (uint8_t *) &msg; +qemu_chr_fe_write_all (chr, p,VHOST_USER_HDR_SIZE + msg.size); +break ; +default :break ; }
Signature · 1 line
1.9.0
Re: [Qemu-devel] [PATCH v2 3/5] vhost-user-test: add multiple queue test
Quoted 9 lines · Yuanhan Liu
Setting
VHOST_USER_PROTOCOL_F_MQprotocol feature bit to claim that we support MQ feature, and simply assume we support0xffqueue pairs at most.Cc Michael S. Tsirkin <[email protected]>Cc Jason Wang <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>---
v2: use macro to define the max queues we support
Well this doesn't buy us anything - it's only used in one place. I really meant the "2" which is the actual
# of queues.
Quoted 70 lines
--- tests/vhost-user-test.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)tests/vhost-user-test.c +19
-2@@ -29,11 +29,14 @@#define HAVE_MONOTONIC_TIME #endif +#define MAX_QUEUS 0xff +#define QEMU_CMD_ACCEL " -machine accel=tcg"#define QEMU_CMD_MEM " -m 512 -object memory-backend-file,id=mem,size=512M,"\ "mem-path=%s,share=on -numa node,memdev=mem"#define QEMU_CMD_CHR " -chardev socket,id=chr0,path=%s" -#define QEMU_CMD_NETDEV " -netdev vhost-user,id=net0,chardev=chr0,vhostforce" +#define QEMU_CMD_NETDEV " -netdev vhost-user,id=net0,chardev=chr0,vhostforce," \ + "queues=2"#define QEMU_CMD_NET " -device virtio-net-pci,netdev=net0 "#define QEMU_CMD_ROM " -option-rom ../pc-bios/pxe-virtio.rom"@@ -48,6 +51,8 @@#define VHOST_USER_F_PROTOCOL_FEATURES 30 +#define VHOST_USER_PROTOCOL_F_MQ 0 + typedef enum VhostUserRequest { VHOST_USER_NONE = 0, VHOST_USER_GET_FEATURES = 1,@@ -66,6 +71,8 @@ typedef enum VhostUserRequest {VHOST_USER_SET_VRING_ERR =14 ,VHOST_USER_GET_PROTOCOL_FEATURES =15 ,VHOST_USER_SET_PROTOCOL_FEATURES =16 , +VHOST_USER_GET_QUEUE_NUM =17 , +VHOST_USER_SET_VRING_ENABLE =18 , VHOST_USER_MAX } VhostUserRequest;@@ -232,7 +239,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)/* send back features to qemu */ msg.flags |=VHOST_USER_REPLY_MASK ; msg.size =sizeof (m.u64); - msg.u64 =0 ; + msg.u64 = (1ULL <<VHOST_USER_PROTOCOL_F_MQ ); p = (uint8_t *) &msg;qemu_chr_fe_write_all (chr, p,VHOST_USER_HDR_SIZE + msg.size);break ;@@ -266,6 +273,16 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)*/ qemu_set_nonblock (fd);break ; + +case VHOST_USER_GET_QUEUE_NUM : +/* send back the number of queues we support (let it be 2) to qemu */ + msg.flags |=VHOST_USER_REPLY_MASK ; + msg.size =sizeof (m.u64); + msg.u64 =MAX_QUEUS ; + p = (uint8_t *) &msg; +qemu_chr_fe_write_all (chr, p,VHOST_USER_HDR_SIZE + msg.size); +break ; +default :break ; }Signature · 1 line
1.9.0
PATCH v2 4/5 Revert "vhost-user: Send VHOST_RESET_OWNER on vhost stop"
In reply to Yuanhan LiuDon't send VHOST_RESET_OWNER, for as Michael stated:
Because we need to get the state from remote after stop. RESET_OWNER discards that, so we can't resume the VM.
This reverts commit 294ce717e0f212ed0763307f3eab72b4a1bdf4d0.
--- hw/net/vhost_net.c | 7 ------- 1 file changed, 7 deletions(-)
hw/net/vhost_net.c +0 -7
@@ -293,13 +293,6 @@ static void vhost_net_stop_one(struct vhost_net *net, &file);assert (r >=0 ); } - }else if (net->nc->info->type ==NET_CLIENT_OPTIONS_KIND_VHOST_USER ) { -for (file.index =0 ; file.index < net->dev.nvqs; ++file.index) { -const VhostOps *vhost_ops = net->dev.vhost_ops; -int r = vhost_ops->vhost_call (&net->dev,VHOST_RESET_OWNER , -NULL ); -assert (r >=0 ); - } }if (net->nc->info->poll) { net->nc->info->poll (net->nc, true);
Signature · 1 line
1.9.0
Re: [Qemu-devel] [PATCH v2 4/5] Revert "vhost-user: Send VHOST_RESET_OWNER on vhost stop"
Quoted 10 lines · Yuanhan Liu
Don't send
VHOST_RESET_OWNER, for as Michael stated:Because we need to get the state from remote after stop.
RESET_OWNERdiscards that, so we can't resume the VM.This reverts commit
294ce717e0f212ed0763307f3eab72b4a1bdf4d0.Cc Luke Gorrie <[email protected]>Cc Michael S. Tsirkin <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>
OK but we still need to call it on device reset.
Otherwise device will corrupt memory.
Quoted 24 lines
--- hw/net/vhost_net.c | 7 ------- 1 file changed, 7 deletions(-)hw/net/vhost_net.c +0
-7@@ -293,13 +293,6 @@ static void vhost_net_stop_one(struct vhost_net *net, &file);assert (r >=0 ); } - }else if (net->nc->info->type ==NET_CLIENT_OPTIONS_KIND_VHOST_USER ) { -for (file.index =0 ; file.index < net->dev.nvqs; ++file.index) { -const VhostOps *vhost_ops = net->dev.vhost_ops; -int r = vhost_ops->vhost_call (&net->dev,VHOST_RESET_OWNER , -NULL ); -assert (r >=0 ); - } }if (net->nc->info->poll) { net->nc->info->poll (net->nc, true);Signature · 1 line
1.9.0
Re: [Qemu-devel] [PATCH v2 4/5] Revert "vhost-user: Send VHOST_RESET_OWNER on vhost stop"
In reply to Yuanhan LiuQuoted 10 lines · Yuanhan Liu
Don't send
VHOST_RESET_OWNER, for as Michael stated:Because we need to get the state from remote after stop.
RESET_OWNERdiscards that, so we can't resume the VM.This reverts commit
294ce717e0f212ed0763307f3eab72b4a1bdf4d0.Cc Luke Gorrie <[email protected]>Cc Michael S. Tsirkin <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>
Yes but poking at guest memory after driver is unloaded is even worse.
Quoted 25 lines
--- hw/net/vhost_net.c | 7 ------- 1 file changed, 7 deletions(-)hw/net/vhost_net.c +0
-7@@ -293,13 +293,6 @@ static void vhost_net_stop_one(struct vhost_net *net, &file);assert (r >=0 ); } - }else if (net->nc->info->type ==NET_CLIENT_OPTIONS_KIND_VHOST_USER ) { -for (file.index =0 ; file.index < net->dev.nvqs; ++file.index) { -const VhostOps *vhost_ops = net->dev.vhost_ops; -int r = vhost_ops->vhost_call (&net->dev,VHOST_RESET_OWNER , -NULL ); -assert (r >=0 ); - } }if (net->nc->info->poll) { net->nc->info->poll (net->nc, true);Signature · 1 line
1.9.0
PATCH v2 5/5 vhost: send VHOST_USER_SET_VRING_ENABLE at start/stop
In reply to Yuanhan LiuSend VHOST_USER_SET_VRING_ENABLE at start/stop when multiple queue is negotiated, to inform the backend that we are ready or not.
And exclude VHOST_USER_GET_QUEUE_NUM as one time request, as we need to get max_queues for each vhost_dev.
--- hw/virtio/vhost-user.c | 1 - hw/virtio/vhost.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)
hw/virtio/vhost-user.c +0 -1
@@ -194,7 +194,6 @@ static bool vhost_user_one_time_request(VhostUserRequest request)case VHOST_USER_SET_OWNER :case VHOST_USER_RESET_OWNER :case VHOST_USER_SET_MEM_TABLE : -case VHOST_USER_GET_QUEUE_NUM :return true;default :return false;
hw/virtio/vhost.c +18 -0
@@ -1146,6 +1146,19 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev) } } +/* +* Send VHOST_USER_SET_VRING_ENABLE message when multiple queue +* is negotiated to inform the back end that we are ready. +* +* Only set enable to 1 for first queue pair, as we enable one +* queue pair by default. +*/ +if (hdev->max_queues >1 && + hdev->vhost_ops->vhost_backend_set_vring_enable) { + hdev->vhost_ops->vhost_backend_set_vring_enable (hdev, + hdev->vq_index ==0 ); + } +return 0 ; fail_log:vhost_log_put (hdev, false);
@@ -1180,5 +1193,10 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev) hdev->started = false; hdev->log =NULL ; hdev->log_size =0 ; + +if (hdev->max_queues >1 && + hdev->vhost_ops->vhost_backend_set_vring_enable) { + hdev->vhost_ops->vhost_backend_set_vring_enable (hdev,0 ); + } }
Signature · 1 line
1.9.0
Re: [Qemu-devel] [PATCH v2 5/5] vhost: send VHOST_USER_SET_VRING_ENABLE at start/stop
Quoted 2 lines · Yuanhan Liu
Send
VHOST_USER_SET_VRING_ENABLEat start/stop when multiple queue is negotiated, to inform the backend that we are ready or not.
OK but that's only if MQ is set. If now, we need to do RESET_OWNER followed by SET_OWNER.
Quoted 2 lines
And exclude
VHOST_USER_GET_QUEUE_NUMas one time request, as we need to getmax_queuesfor eachvhost_dev.
Pls split this part out.
Quoted 25 lines
Suggested-by Michael S. Tsirkin <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>--- hw/virtio/vhost-user.c | 1 - hw/virtio/vhost.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)hw/virtio/vhost-user.c +0
-1@@ -194,7 +194,6 @@ static bool vhost_user_one_time_request(VhostUserRequest request)case VHOST_USER_SET_OWNER :case VHOST_USER_RESET_OWNER :case VHOST_USER_SET_MEM_TABLE : -case VHOST_USER_GET_QUEUE_NUM :return true;default :return false;hw/virtio/vhost.c +0
-0@@ -1146,6 +1146,19 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev) }
hw/virtio/vhost.c int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev) · line 1156
Quoted 10 lines
hw/virtio/vhost.c +8
-0} +/* +* Send VHOST_USER_SET_VRING_ENABLE message when multiple queue +* is negotiated to inform the back end that we are ready. +* +* Only set enable to 1 for first queue pair, as we enable one +* queue pair by default. +*/ + if (hdev->max_queues > 1 &&
this makes no sense in the generic code.
This is a work around for a protocol bug - belongs in vhost user internally.
And that's not the way to test this. MQ could be negotiated even if there is a single pair of queues.
Quoted 22 lines
hw/virtio/vhost.c +10
-0+ hdev->vhost_ops->vhost_backend_set_vring_enable) { + hdev->vhost_ops->vhost_backend_set_vring_enable (hdev, + hdev->vq_index ==0 ); + } +return 0 ; fail_log:vhost_log_put (hdev, false);@@ -1180,5 +1193,10 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev) hdev->started = false; hdev->log =NULL ; hdev->log_size =0 ; + +if (hdev->max_queues >1 && + hdev->vhost_ops->vhost_backend_set_vring_enable) { + hdev->vhost_ops->vhost_backend_set_vring_enable (hdev,0 ); + } }Signature · 1 line
1.9.0
Re: [Qemu-devel] [PATCH v2 5/5] vhost: send VHOST_USER_SET_VRING_ENABLE at start/stop
Quoted 5 lines · Michael S. Tsirkin
Quoted 2 lines · Yuanhan Liu
Send
VHOST_USER_SET_VRING_ENABLEat start/stop when multiple queue is negotiated, to inform the backend that we are ready or not.OK but that's only if MQ is set.
Maybe we could just call vhost_backend_set_vring_enable() unconditionally? It's nil operation when MQ is not set.
Quoted 2 lines
If now, we need to do
RESET_OWNERfollowed bySET_OWNER.
Could you be more specific? Why sending RESET_OWNER followed by SET_OWNER?
TBH, I'm a bit confused with RESET_OWNER now: what it does, and when is supposed to send it :(
And, sending RESET_OWNER inside virtio_net_reset() also looks weird. I made a quick try before sending this patchset, and the vhost-user request dump doesn't look right to me: the message is sent after vhost dev init (GET_FEATURES, GET_PROTOCOL_FEATURE, SET_OWNER, ..., SET_VRING_CALL), and before peer attach (SET_VRING_ENABLE) and vhost_dev_start (SET_MEM_TABLE, ... SET_VRING_KICK ...):
# start of a VM
VHOST_CONFIG: new virtio connection is 28
VHOST_CONFIG: new device, handle is 0
VHOST_CONFIG: read message VHOST_USER_GET_FEATURES
VHOST_CONFIG: read message VHOST_USER_GET_PROTOCOL_FEATURES
VHOST_CONFIG: read message VHOST_USER_SET_PROTOCOL_FEATURES
VHOST_CONFIG: read message VHOST_USER_GET_QUEUE_NUM
VHOST_CONFIG: read message VHOST_USER_SET_OWNER
VHOST_CONFIG: read message VHOST_USER_GET_FEATURES
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:0 file:29
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:1 file:30
VHOST_CONFIG: read message VHOST_USER_GET_FEATURES
VHOST_CONFIG: read message VHOST_USER_GET_PROTOCOL_FEATURES
VHOST_CONFIG: read message VHOST_USER_SET_PROTOCOL_FEATURES
VHOST_CONFIG: read message VHOST_USER_GET_QUEUE_NUM
VHOST_CONFIG: read message VHOST_USER_GET_FEATURES
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL
...
...
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:6 file:35
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:7 file:36
==> VHOST_CONFIG: read message VHOST_USER_RESET_OWNER
VHOST_CONFIG: read message VHOST_USER_RESET_OWNER
VHOST_CONFIG: read message VHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 1 to qp idx: 0
VHOST_CONFIG: read message VHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 0 to qp idx: 2
VHOST_CONFIG: read message VHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 0 to qp idx: 4
VHOST_CONFIG: read message VHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 0 to qp idx: 6
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:0 file:29
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:1 file:30
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:2 file:31
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:3 file:32
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:4 file:33
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:5 file:34
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:6 file:35
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:7 file:36
VHOST_CONFIG: read message VHOST_USER_SET_FEATURES
VHOST_CONFIG: read message VHOST_USER_SET_MEM_TABLE
VHOST_CONFIG: mapped region 0 fd:37 to 0x2aaac0000000 sz:0xa0000 off:0x0
VHOST_CONFIG: mapped region 1 fd:38 to 0x2aab00000000 sz:0x80000000 off:0xc0000
VHOST_CONFIG: read message VHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read message VHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read message VHOST_USER_SET_VRING_ADDR
VHOST_CONFIG: read message VHOST_USER_SET_VRING_KICK
VHOST_CONFIG: vring kick idx:0 file:39
VHOST_CONFIG: virtio is not ready for processing.
VHOST_CONFIG: read message VHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read message VHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read message VHOST_USER_SET_VRING_ADDR
VHOST_CONFIG: read message VHOST_USER_SET_VRING_KICK
VHOST_CONFIG: vring kick idx:1 file:40
VHOST_CONFIG: virtio is not ready for processing.
VHOST_CONFIG: read message VHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 1 to qp idx: 0
VHOST_CONFIG: read message VHOST_USER_SET_FEATURES
VHOST_CONFIG: read message VHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read message VHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read message VHOST_USER_SET_VRING_ADDR
VHOST_CONFIG: read message VHOST_USER_SET_VRING_KICK
VHOST_CONFIG: vring kick idx:2 file:41
VHOST_CONFIG: virtio is not ready for processing.
VHOST_CONFIG: read message VHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read message VHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read message VHOST_USER_SET_VRING_ADDR
VHOST_CONFIG: read message VHOST_USER_SET_VRING_KICK
...
And I didn't see RESET_OWNER is sent while I shutdown a VM.
Quoted 33 lines
Quoted 3 lines
And exclude
VHOST_USER_GET_QUEUE_NUMas one time request, as we need to getmax_queuesfor eachvhost_dev.Pls split this part out.
Quoted 27 lines
Suggested-by Michael S. Tsirkin <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>--- hw/virtio/vhost-user.c | 1 - hw/virtio/vhost.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)hw/virtio/vhost-user.c +0
-1@@ -194,7 +194,6 @@ static bool vhost_user_one_time_request(VhostUserRequest request)case VHOST_USER_SET_OWNER :case VHOST_USER_RESET_OWNER :case VHOST_USER_SET_MEM_TABLE : -case VHOST_USER_GET_QUEUE_NUM :return true;default :return false;hw/virtio/vhost.c +0
-0@@ -1146,6 +1146,19 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev) } }
Quoted 12 lines
hw/virtio/vhost.c int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev) · line 1156
Quoted 8 lines
hw/virtio/vhost.c +8
-0+/* +* Send VHOST_USER_SET_VRING_ENABLE message when multiple queue +* is negotiated to inform the back end that we are ready. +* +* Only set enable to 1 for first queue pair, as we enable one +* queue pair by default. +*/ + if (hdev->max_queues > 1 &&this makes no sense in the generic code.
This is a work around for a protocol bug - belongs in vhost user internally.
Maybe we could add a dummy vhost_backend_set_vring_enable() for vhost-kernel?
Quoted 2 lines
And that's not the way to test this. MQ could be negotiated even if there is a single pair of queues.
Yeah, right. Just as stated, how about calling it unconditionally here?
--yliu
Quoted 23 lines
Quoted 23 lines
hw/virtio/vhost.c +10
-0+ hdev->vhost_ops->vhost_backend_set_vring_enable) { + hdev->vhost_ops->vhost_backend_set_vring_enable (hdev, + hdev->vq_index ==0 ); + } +return 0 ; fail_log:vhost_log_put (hdev, false);@@ -1180,5 +1193,10 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev) hdev->started = false; hdev->log =NULL ; hdev->log_size =0 ; + +if (hdev->max_queues >1 && + hdev->vhost_ops->vhost_backend_set_vring_enable) { + hdev->vhost_ops->vhost_backend_set_vring_enable (hdev,0 ); + } }Signature · 1 line
1.9.0
Re: [Qemu-devel] [PATCH v2 5/5] vhost: send VHOST_USER_SET_VRING_ENABLE at start/stop
Quoted 10 lines · Yuanhan Liu
Quoted 5 lines · Michael S. Tsirkin
Quoted 2 lines · Yuanhan Liu
Send
VHOST_USER_SET_VRING_ENABLEat start/stop when multiple queue is negotiated, to inform the backend that we are ready or not.OK but that's only if MQ is set.
Maybe we could just call
vhost_backend_set_vring_enable()unconditionally? It's nil operation when MQ is not set.
Quoted 8 lines
Quoted 2 lines
If now, we need to do
RESET_OWNERfollowed bySET_OWNER.Could you be more specific? Why sending
RESET_OWNERfollowed bySET_OWNER?TBH, I'm a bit confused with
RESET_OWNERnow: what it does, and when is supposed to send it :(
It's not well specified, but it does say it's analogous to RESET_OWNER in kernel. That one is well documented:
/* Set current process as the (exclusive) owner of this file descriptor.
* This must be called before any other vhost command. Further calls to
* VHOST_OWNER_SET fail until VHOST_OWNER_RESET is called. */
#define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01)
/* Give up ownership, and reset the device to default values.
* Allows subsequent call to VHOST_OWNER_SET to succeed. */
#define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02)
So if we want just the reset part, we need to do VHOST_RESET_OWNER then redo everything that we did previously: VHOST_SET_OWNER SET_VRING_CALL etc etc.
Quoted 6 lines
And, sending
RESET_OWNERinsidevirtio_net_reset()also looks weird. I made a quick try before sending this patchset, and the vhost-user request dump doesn't look right to me: the message is sent after vhost dev init (GET_FEATURES,GET_PROTOCOL_FEATURE,SET_OWNER, ...,SET_VRING_CALL), and before peer attach (SET_VRING_ENABLE) andvhost_dev_start(SET_MEM_TABLE, ...SET_VRING_KICK...):
Food for thought.
Quoted 87 lines
# start of a VM
VHOST_CONFIG: new virtio connection is 28
VHOST_CONFIG: new device, handle is 0
VHOST_CONFIG: read messageVHOST_USER_GET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_GET_PROTOCOL_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_PROTOCOL_FEATURES
VHOST_CONFIG: read messageVHOST_USER_GET_QUEUE_NUM
VHOST_CONFIG: read messageVHOST_USER_SET_OWNER
VHOST_CONFIG: read messageVHOST_USER_GET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:0 file:29
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:1 file:30
VHOST_CONFIG: read messageVHOST_USER_GET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_GET_PROTOCOL_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_PROTOCOL_FEATURES
VHOST_CONFIG: read messageVHOST_USER_GET_QUEUE_NUM
VHOST_CONFIG: read messageVHOST_USER_GET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
...
...
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:6 file:35
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:7 file:36==>
VHOST_CONFIG: read messageVHOST_USER_RESET_OWNER
VHOST_CONFIG: read messageVHOST_USER_RESET_OWNER
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 1 to qp idx: 0
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 0 to qp idx: 2
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 0 to qp idx: 4
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 0 to qp idx: 6
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:0 file:29
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:1 file:30
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:2 file:31
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:3 file:32
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:4 file:33
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:5 file:34
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:6 file:35
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:7 file:36
VHOST_CONFIG: read messageVHOST_USER_SET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_MEM_TABLE
VHOST_CONFIG: mapped region 0 fd:37 to0x2aaac0000000sz:0xa0000 off:0x0
VHOST_CONFIG: mapped region 1 fd:38 to0x2aab00000000sz:0x80000000 off:0xc0000
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ADDR
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_KICK
VHOST_CONFIG: vring kick idx:0 file:39
VHOST_CONFIG: virtio is not ready for processing.
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ADDR
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_KICK
VHOST_CONFIG: vring kick idx:1 file:40
VHOST_CONFIG: virtio is not ready for processing.
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 1 to qp idx: 0
VHOST_CONFIG: read messageVHOST_USER_SET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ADDR
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_KICK
VHOST_CONFIG: vring kick idx:2 file:41
VHOST_CONFIG: virtio is not ready for processing.
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ADDR
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_KICK
...
Quoted 2 lines
And I didn't see
RESET_OWNERis sent while I shutdown a VM.
reboot, not shutdown.
Quoted 49 lines
Quoted 33 lines
Quoted 3 lines
And exclude
VHOST_USER_GET_QUEUE_NUMas one time request, as we need to getmax_queuesfor eachvhost_dev.Pls split this part out.
Quoted 27 lines
Suggested-by Michael S. Tsirkin <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>--- hw/virtio/vhost-user.c | 1 - hw/virtio/vhost.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)hw/virtio/vhost-user.c +0
-1@@ -194,7 +194,6 @@ static bool vhost_user_one_time_request(VhostUserRequest request)case VHOST_USER_SET_OWNER :case VHOST_USER_RESET_OWNER :case VHOST_USER_SET_MEM_TABLE : -case VHOST_USER_GET_QUEUE_NUM :return true;default :return false;hw/virtio/vhost.c +0
-0@@ -1146,6 +1146,19 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev) } }Quoted 12 lines
hw/virtio/vhost.c int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev) · line 1156
Quoted 8 lines
hw/virtio/vhost.c +8
-0+/* +* Send VHOST_USER_SET_VRING_ENABLE message when multiple queue +* is negotiated to inform the back end that we are ready. +* +* Only set enable to 1 for first queue pair, as we enable one +* queue pair by default. +*/ + if (hdev->max_queues > 1 &&this makes no sense in the generic code.
This is a work around for a protocol bug - belongs in vhost user internally.Maybe we could add a dummy
vhost_backend_set_vring_enable()for vhost-kernel?
Quoted 6 lines
Quoted 2 lines
And that's not the way to test this. MQ could be negotiated even if there is a single pair of queues.
Yeah, right. Just as stated, how about calling it unconditionally here?
--yliu
I prefer an if condition. Seems easier to follow.
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
hw/virtio/vhost.c +10
-0+ hdev->vhost_ops->vhost_backend_set_vring_enable) { + hdev->vhost_ops->vhost_backend_set_vring_enable (hdev, + hdev->vq_index ==0 ); + } +return 0 ; fail_log:vhost_log_put (hdev, false);@@ -1180,5 +1193,10 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev) hdev->started = false; hdev->log =NULL ; hdev->log_size =0 ; + +if (hdev->max_queues >1 && + hdev->vhost_ops->vhost_backend_set_vring_enable) { + hdev->vhost_ops->vhost_backend_set_vring_enable (hdev,0 ); + } }Signature · 1 line
1.9.0
Re: [Qemu-devel] [PATCH v2 5/5] vhost: send VHOST_USER_SET_VRING_ENABLE at start/stop
Quoted 23 lines · Michael S. Tsirkin
Quoted 10 lines · Yuanhan Liu
Quoted 5 lines · Michael S. Tsirkin
Quoted 2 lines · Yuanhan Liu
Send
VHOST_USER_SET_VRING_ENABLEat start/stop when multiple queue is negotiated, to inform the backend that we are ready or not.OK but that's only if MQ is set.
Maybe we could just call
vhost_backend_set_vring_enable()unconditionally? It's nil operation when MQ is not set.Quoted 8 lines
Quoted 2 lines
If now, we need to do
RESET_OWNERfollowed bySET_OWNER.Could you be more specific? Why sending
RESET_OWNERfollowed bySET_OWNER?TBH, I'm a bit confused with
RESET_OWNERnow: what it does, and when is supposed to send it :(It's not well specified, but it does say it's analogous to
RESET_OWNERin kernel. That one is well documented:
Quoted 7 lines
/* Set current process as the (exclusive) owner of this file descriptor.
* This must be called before any other vhost command. Further calls to
*VHOST_OWNER_SETfail untilVHOST_OWNER_RESETis called. */
#defineVHOST_SET_OWNER_IO(VHOST_VIRTIO, 0x01)
/* Give up ownership, and reset the device to default values.
* Allows subsequent call toVHOST_OWNER_SETto succeed. */
#defineVHOST_RESET_OWNER_IO(VHOST_VIRTIO, 0x02)
Thanks, that helps (I think).
I recalled my old question, and rechecked your answer again:
Because we need to get the state from remote after stop. RESET_OWNER discards that, so we can't resume the VM.
So, if I understand it correctly this time, you want to keep the VM state at the backend side even after the VM is shut down, and then we can resume it with those saved state
And why don't do that when MQ is enabled? I don't see it has anyting to do with MQ.
Quoted 5 lines
So if we want just the reset part, we need to do
VHOST_RESET_OWNERthen redo everything that we did previously:VHOST_SET_OWNERSET_VRING_CALLetc etc.
Quoted 8 lines
Quoted 6 lines
And, sending
RESET_OWNERinsidevirtio_net_reset()also looks weird. I made a quick try before sending this patchset, and the vhost-user request dump doesn't look right to me: the message is sent after vhost dev init (GET_FEATURES,GET_PROTOCOL_FEATURE,SET_OWNER, ...,SET_VRING_CALL), and before peer attach (SET_VRING_ENABLE) andvhost_dev_start(SET_MEM_TABLE, ...SET_VRING_KICK...):Food for thought.
Aha...
Quoted 88 lines
Quoted 88 lines
# start of a VM
VHOST_CONFIG: new virtio connection is 28
VHOST_CONFIG: new device, handle is 0
VHOST_CONFIG: read messageVHOST_USER_GET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_GET_PROTOCOL_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_PROTOCOL_FEATURES
VHOST_CONFIG: read messageVHOST_USER_GET_QUEUE_NUM
VHOST_CONFIG: read messageVHOST_USER_SET_OWNER
VHOST_CONFIG: read messageVHOST_USER_GET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:0 file:29
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:1 file:30
VHOST_CONFIG: read messageVHOST_USER_GET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_GET_PROTOCOL_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_PROTOCOL_FEATURES
VHOST_CONFIG: read messageVHOST_USER_GET_QUEUE_NUM
VHOST_CONFIG: read messageVHOST_USER_GET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
...
...
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:6 file:35
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:7 file:36==>
VHOST_CONFIG: read messageVHOST_USER_RESET_OWNER
VHOST_CONFIG: read messageVHOST_USER_RESET_OWNER
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 1 to qp idx: 0
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 0 to qp idx: 2
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 0 to qp idx: 4
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 0 to qp idx: 6
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:0 file:29
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:1 file:30
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:2 file:31
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:3 file:32
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:4 file:33
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:5 file:34
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:6 file:35
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:7 file:36
VHOST_CONFIG: read messageVHOST_USER_SET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_MEM_TABLE
VHOST_CONFIG: mapped region 0 fd:37 to0x2aaac0000000sz:0xa0000 off:0x0
VHOST_CONFIG: mapped region 1 fd:38 to0x2aab00000000sz:0x80000000 off:0xc0000
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ADDR
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_KICK
VHOST_CONFIG: vring kick idx:0 file:39
VHOST_CONFIG: virtio is not ready for processing.
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ADDR
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_KICK
VHOST_CONFIG: vring kick idx:1 file:40
VHOST_CONFIG: virtio is not ready for processing.
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 1 to qp idx: 0
VHOST_CONFIG: read messageVHOST_USER_SET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ADDR
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_KICK
VHOST_CONFIG: vring kick idx:2 file:41
VHOST_CONFIG: virtio is not ready for processing.
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ADDR
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_KICK
...
Quoted 4 lines
Quoted 2 lines
And I didn't see
RESET_OWNERis sent while I shutdown a VM.reboot, not shutdown.
I see.
According to the log, virtio_net_reset() doesn't seem to the right place, as you can see, SET_OWNER is invoked before RESET_OWNER.
Quoted 51 lines
Quoted 51 lines
Quoted 35 lines
Quoted 5 lines
And exclude
VHOST_USER_GET_QUEUE_NUMas one time request, as we need to getmax_queuesfor eachvhost_dev.Pls split this part out.
Quoted 27 lines
Suggested-by Michael S. Tsirkin <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>--- hw/virtio/vhost-user.c | 1 - hw/virtio/vhost.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)hw/virtio/vhost-user.c +0
-1@@ -194,7 +194,6 @@ static bool vhost_user_one_time_request(VhostUserRequest request)case VHOST_USER_SET_OWNER :case VHOST_USER_RESET_OWNER :case VHOST_USER_SET_MEM_TABLE : -case VHOST_USER_GET_QUEUE_NUM :return true;default :return false;hw/virtio/vhost.c +0
-0@@ -1146,6 +1146,19 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev) } }Quoted 12 lines
hw/virtio/vhost.c int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev) · line 1156
Quoted 8 lines
hw/virtio/vhost.c +8
-0+/* +* Send VHOST_USER_SET_VRING_ENABLE message when multiple queue +* is negotiated to inform the back end that we are ready. +* +* Only set enable to 1 for first queue pair, as we enable one +* queue pair by default. +*/ + if (hdev->max_queues > 1 &&this makes no sense in the generic code.
This is a work around for a protocol bug - belongs in vhost user internally.Maybe we could add a dummy
vhost_backend_set_vring_enable()for vhost-kernel?
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
And that's not the way to test this. MQ could be negotiated even if there is a single pair of queues.
Yeah, right. Just as stated, how about calling it unconditionally here?
--yliuI prefer an if condition. Seems easier to follow.
Ok.
--yliu
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
hw/virtio/vhost.c +10
-0+ hdev->vhost_ops->vhost_backend_set_vring_enable) { + hdev->vhost_ops->vhost_backend_set_vring_enable (hdev, + hdev->vq_index ==0 ); + } +return 0 ; fail_log:vhost_log_put (hdev, false);@@ -1180,5 +1193,10 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev) hdev->started = false; hdev->log =NULL ; hdev->log_size =0 ; + +if (hdev->max_queues >1 && + hdev->vhost_ops->vhost_backend_set_vring_enable) { + hdev->vhost_ops->vhost_backend_set_vring_enable (hdev,0 ); + } }Signature · 1 line
1.9.0
Re: [Qemu-devel] [PATCH v2 5/5] vhost: send VHOST_USER_SET_VRING_ENABLE at start/stop
Quoted 34 lines · Yuanhan Liu
Quoted 23 lines · Michael S. Tsirkin
Quoted 10 lines · Yuanhan Liu
Quoted 5 lines · Michael S. Tsirkin
Quoted 2 lines · Yuanhan Liu
Send
VHOST_USER_SET_VRING_ENABLEat start/stop when multiple queue is negotiated, to inform the backend that we are ready or not.OK but that's only if MQ is set.
Maybe we could just call
vhost_backend_set_vring_enable()unconditionally? It's nil operation when MQ is not set.Quoted 8 lines
Quoted 2 lines
If now, we need to do
RESET_OWNERfollowed bySET_OWNER.Could you be more specific? Why sending
RESET_OWNERfollowed bySET_OWNER?TBH, I'm a bit confused with
RESET_OWNERnow: what it does, and when is supposed to send it :(It's not well specified, but it does say it's analogous to
RESET_OWNERin kernel. That one is well documented:Quoted 7 lines
/* Set current process as the (exclusive) owner of this file descriptor.
* This must be called before any other vhost command. Further calls to
*VHOST_OWNER_SETfail untilVHOST_OWNER_RESETis called. */
#defineVHOST_SET_OWNER_IO(VHOST_VIRTIO, 0x01)
/* Give up ownership, and reset the device to default values.
* Allows subsequent call toVHOST_OWNER_SETto succeed. */
#defineVHOST_RESET_OWNER_IO(VHOST_VIRTIO, 0x02)Thanks, that helps (I think).
Quoted 8 lines
I recalled my old question, and rechecked your answer again:
Because we need to get the state from remote after stop.
RESET_OWNERdiscards that, so we can't resume the VM.So, if I understand it correctly this time, you want to keep the VM state at the backend side even after the VM is shut down, and then we can resume it with those saved state
Not shut down. That makes no sense. When VM is stopped.
Quoted 2 lines
And why don't do that when MQ is enabled? I don't see it has anyting to do with MQ.
With MQ we have enable/disable vq so we can just stop them cleanly.
Quoted 202 lines
Quoted 5 lines
So if we want just the reset part, we need to do
VHOST_RESET_OWNERthen redo everything that we did previously:VHOST_SET_OWNERSET_VRING_CALLetc etc.Quoted 8 lines
Quoted 6 lines
And, sending
RESET_OWNERinsidevirtio_net_reset()also looks weird. I made a quick try before sending this patchset, and the vhost-user request dump doesn't look right to me: the message is sent after vhost dev init (GET_FEATURES,GET_PROTOCOL_FEATURE,SET_OWNER, ...,SET_VRING_CALL), and before peer attach (SET_VRING_ENABLE) andvhost_dev_start(SET_MEM_TABLE, ...SET_VRING_KICK...):Food for thought.
Aha...
Quoted 88 lines
Quoted 88 lines
# start of a VM
VHOST_CONFIG: new virtio connection is 28
VHOST_CONFIG: new device, handle is 0
VHOST_CONFIG: read messageVHOST_USER_GET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_GET_PROTOCOL_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_PROTOCOL_FEATURES
VHOST_CONFIG: read messageVHOST_USER_GET_QUEUE_NUM
VHOST_CONFIG: read messageVHOST_USER_SET_OWNER
VHOST_CONFIG: read messageVHOST_USER_GET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:0 file:29
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:1 file:30
VHOST_CONFIG: read messageVHOST_USER_GET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_GET_PROTOCOL_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_PROTOCOL_FEATURES
VHOST_CONFIG: read messageVHOST_USER_GET_QUEUE_NUM
VHOST_CONFIG: read messageVHOST_USER_GET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
...
...
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:6 file:35
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:7 file:36==>
VHOST_CONFIG: read messageVHOST_USER_RESET_OWNER
VHOST_CONFIG: read messageVHOST_USER_RESET_OWNER
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 1 to qp idx: 0
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 0 to qp idx: 2
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 0 to qp idx: 4
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 0 to qp idx: 6
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:0 file:29
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:1 file:30
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:2 file:31
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:3 file:32
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:4 file:33
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:5 file:34
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:6 file:35
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_CALL
VHOST_CONFIG: vring call idx:7 file:36
VHOST_CONFIG: read messageVHOST_USER_SET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_MEM_TABLE
VHOST_CONFIG: mapped region 0 fd:37 to0x2aaac0000000sz:0xa0000 off:0x0
VHOST_CONFIG: mapped region 1 fd:38 to0x2aab00000000sz:0x80000000 off:0xc0000
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ADDR
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_KICK
VHOST_CONFIG: vring kick idx:0 file:39
VHOST_CONFIG: virtio is not ready for processing.
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ADDR
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_KICK
VHOST_CONFIG: vring kick idx:1 file:40
VHOST_CONFIG: virtio is not ready for processing.
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ENABLE
VHOST_CONFIG: set queue enable: 1 to qp idx: 0
VHOST_CONFIG: read messageVHOST_USER_SET_FEATURES
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ADDR
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_KICK
VHOST_CONFIG: vring kick idx:2 file:41
VHOST_CONFIG: virtio is not ready for processing.
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_ADDR
VHOST_CONFIG: read messageVHOST_USER_SET_VRING_KICK
...Quoted 4 lines
Quoted 2 lines
And I didn't see
RESET_OWNERis sent while I shutdown a VM.reboot, not shutdown.
I see.
According to the log,
virtio_net_reset()doesn't seem to the right place, as you can see,SET_OWNERis invoked beforeRESET_OWNER.Quoted 51 lines
Quoted 51 lines
Quoted 35 lines
Quoted 5 lines
And exclude
VHOST_USER_GET_QUEUE_NUMas one time request, as we need to getmax_queuesfor eachvhost_dev.Pls split this part out.
Quoted 27 lines
Suggested-by Michael S. Tsirkin <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>--- hw/virtio/vhost-user.c | 1 - hw/virtio/vhost.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)hw/virtio/vhost-user.c +0
-1@@ -194,7 +194,6 @@ static bool vhost_user_one_time_request(VhostUserRequest request)case VHOST_USER_SET_OWNER :case VHOST_USER_RESET_OWNER :case VHOST_USER_SET_MEM_TABLE : -case VHOST_USER_GET_QUEUE_NUM :return true;default :return false;hw/virtio/vhost.c +0
-0@@ -1146,6 +1146,19 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev) } }Quoted 12 lines
hw/virtio/vhost.c int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev) · line 1156
Quoted 8 lines
hw/virtio/vhost.c +8
-0+/* +* Send VHOST_USER_SET_VRING_ENABLE message when multiple queue +* is negotiated to inform the back end that we are ready. +* +* Only set enable to 1 for first queue pair, as we enable one +* queue pair by default. +*/ + if (hdev->max_queues > 1 &&this makes no sense in the generic code.
This is a work around for a protocol bug - belongs in vhost user internally.Maybe we could add a dummy
vhost_backend_set_vring_enable()for vhost-kernel?Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
And that's not the way to test this. MQ could be negotiated even if there is a single pair of queues.
Yeah, right. Just as stated, how about calling it unconditionally here?
--yliuI prefer an if condition. Seems easier to follow.
Ok.
--yliuQuoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
hw/virtio/vhost.c +10
-0+ hdev->vhost_ops->vhost_backend_set_vring_enable) { + hdev->vhost_ops->vhost_backend_set_vring_enable (hdev, + hdev->vq_index ==0 ); + } +return 0 ; fail_log:vhost_log_put (hdev, false);@@ -1180,5 +1193,10 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev) hdev->started = false; hdev->log =NULL ; hdev->log_size =0 ; + +if (hdev->max_queues >1 && + hdev->vhost_ops->vhost_backend_set_vring_enable) { + hdev->vhost_ops->vhost_backend_set_vring_enable (hdev,0 ); + } }Signature · 1 line
1.9.0
Quoted 9 lines · Yuanhan Liu
This reverts commit
d1f8b30ec8dde0318fd1b98d24a64926feae9625.It turned out that it breaks stuff, so revert it:
http://lists.nongnu.org/archive/html/qemu-devel/2015-10/msg00949.htmlCC "Michael S. Tsirkin" <[email protected]>Reported-by Paolo Bonzini <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>
Are these patches dependent on each other? If yes pls send a cover letter. If not pls don't send a series, post them separately.
And, pls Cc me on all vhost user patches.
Quoted 107 lines
--- docs/specs/vhost-user.txt | 4 ++-- hw/net/vhost_net.c | 2 +- hw/virtio/vhost-user.c | 8 ++++---- linux-headers/linux/vhost.h | 2 +- tests/vhost-user-test.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-)docs/specs/vhost-user.txt +2
-2@@ -211,10 +211,10 @@ Message types as an owner of the session. This can be used on the Slave as a "session start" flag. - * VHOST_USER_RESET_DEVICE + * VHOST_USER_RESET_OWNER Id: 4 - Equivalent ioctl: VHOST_RESET_DEVICE + Equivalent ioctl: VHOST_RESET_OWNER Master payload: N/A Issued when a new connection is about to be closed. The Master will nohw/net/vhost_net.c +1
-1@@ -296,7 +296,7 @@ static void vhost_net_stop_one(struct vhost_net *net, }else if (net->nc->info->type ==NET_CLIENT_OPTIONS_KIND_VHOST_USER ) {for (file.index =0 ; file.index < net->dev.nvqs; ++file.index) {const VhostOps *vhost_ops = net->dev.vhost_ops; -int r = vhost_ops->vhost_call (&net->dev,VHOST_RESET_DEVICE , +int r = vhost_ops->vhost_call (&net->dev,VHOST_RESET_OWNER ,NULL );assert (r >=0 ); }hw/virtio/vhost-user.c +4
-4@@ -34,7 +34,7 @@ typedef enum VhostUserRequest {VHOST_USER_GET_FEATURES =1 ,VHOST_USER_SET_FEATURES =2 ,VHOST_USER_SET_OWNER =3 , -VHOST_USER_RESET_DEVICE =4 , +VHOST_USER_RESET_OWNER =4 ,VHOST_USER_SET_MEM_TABLE =5 ,VHOST_USER_SET_LOG_BASE =6 , VHOST_USER_SET_LOG_FD = 7,@@ -102,7 +102,7 @@ static unsigned long int ioctl_to_vhost_user_request[VHOST_USER_MAX] = {VHOST_GET_FEATURES ,/* VHOST_USER_GET_FEATURES */ VHOST_SET_FEATURES ,/* VHOST_USER_SET_FEATURES */ VHOST_SET_OWNER ,/* VHOST_USER_SET_OWNER */ -VHOST_RESET_DEVICE ,/* VHOST_USER_RESET_DEVICE */ +VHOST_RESET_OWNER ,/* VHOST_USER_RESET_OWNER */ VHOST_SET_MEM_TABLE ,/* VHOST_USER_SET_MEM_TABLE */ VHOST_SET_LOG_BASE ,/* VHOST_USER_SET_LOG_BASE */ VHOST_SET_LOG_FD, /* VHOST_USER_SET_LOG_FD */@@ -192,7 +192,7 @@ static bool vhost_user_one_time_request(VhostUserRequest request) {switch (request) {case VHOST_USER_SET_OWNER : -case VHOST_USER_RESET_DEVICE : +case VHOST_USER_RESET_OWNER :case VHOST_USER_SET_MEM_TABLE :case VHOST_USER_GET_QUEUE_NUM :return true;@@ -249,7 +249,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,break ;case VHOST_USER_SET_OWNER : -case VHOST_USER_RESET_DEVICE : +case VHOST_USER_RESET_OWNER :break ;case VHOST_USER_SET_MEM_TABLE :linux-headers/linux/vhost.h +1
-1@@ -78,7 +78,7 @@ struct vhost_memory {#define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01)/* Give up ownership, and reset the device to default values. * Allows subsequent call to VHOST_OWNER_SET to succeed. */ -#define VHOST_RESET_DEVICE _IO(VHOST_VIRTIO, 0x02) +#define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02)/* Set up/modify memory layout */ #define VHOST_SET_MEM_TABLE _IOW(VHOST_VIRTIO, 0x03, struct vhost_memory)tests/vhost-user-test.c +1
-1@@ -53,7 +53,7 @@ typedef enum VhostUserRequest {VHOST_USER_GET_FEATURES =1 ,VHOST_USER_SET_FEATURES =2 ,VHOST_USER_SET_OWNER =3 , -VHOST_USER_RESET_DEVICE =4 , +VHOST_USER_RESET_OWNER =4 ,VHOST_USER_SET_MEM_TABLE =5 ,VHOST_USER_SET_LOG_BASE =6 , VHOST_USER_SET_LOG_FD = 7,Signature · 1 line
1.9.0
Quoted 7 lines · Michael S. Tsirkin
Quoted 6 lines · Yuanhan Liu
This reverts commit
d1f8b30ec8dde0318fd1b98d24a64926feae9625.It turned out that it breaks stuff, so revert it:
http://lists.nongnu.org/archive/html/qemu-devel/2015-10/msg00949.html
Quoted 7 lines
Quoted 3 lines
CC "Michael S. Tsirkin" <[email protected]>Reported-by Paolo Bonzini <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>Are these patches dependent on each other? If yes pls send a cover letter. If not pls don't send a series, post them separately.
Got it.
Quoted 1 line
And, pls Cc me on all vhost user patches.
Isn't I always doing that? :)
--yliu
Quoted 108 lines
Quoted 108 lines
--- docs/specs/vhost-user.txt | 4 ++-- hw/net/vhost_net.c | 2 +- hw/virtio/vhost-user.c | 8 ++++---- linux-headers/linux/vhost.h | 2 +- tests/vhost-user-test.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-)docs/specs/vhost-user.txt +2
-2@@ -211,10 +211,10 @@ Message types as an owner of the session. This can be used on the Slave as a "session start" flag. - * VHOST_USER_RESET_DEVICE + * VHOST_USER_RESET_OWNER Id: 4 - Equivalent ioctl: VHOST_RESET_DEVICE + Equivalent ioctl: VHOST_RESET_OWNER Master payload: N/A Issued when a new connection is about to be closed. The Master will nohw/net/vhost_net.c +1
-1@@ -296,7 +296,7 @@ static void vhost_net_stop_one(struct vhost_net *net, }else if (net->nc->info->type ==NET_CLIENT_OPTIONS_KIND_VHOST_USER ) {for (file.index =0 ; file.index < net->dev.nvqs; ++file.index) {const VhostOps *vhost_ops = net->dev.vhost_ops; -int r = vhost_ops->vhost_call (&net->dev,VHOST_RESET_DEVICE , +int r = vhost_ops->vhost_call (&net->dev,VHOST_RESET_OWNER ,NULL );assert (r >=0 ); }hw/virtio/vhost-user.c +4
-4@@ -34,7 +34,7 @@ typedef enum VhostUserRequest {VHOST_USER_GET_FEATURES =1 ,VHOST_USER_SET_FEATURES =2 ,VHOST_USER_SET_OWNER =3 , -VHOST_USER_RESET_DEVICE =4 , +VHOST_USER_RESET_OWNER =4 ,VHOST_USER_SET_MEM_TABLE =5 ,VHOST_USER_SET_LOG_BASE =6 , VHOST_USER_SET_LOG_FD = 7,@@ -102,7 +102,7 @@ static unsigned long int ioctl_to_vhost_user_request[VHOST_USER_MAX] = {VHOST_GET_FEATURES ,/* VHOST_USER_GET_FEATURES */ VHOST_SET_FEATURES ,/* VHOST_USER_SET_FEATURES */ VHOST_SET_OWNER ,/* VHOST_USER_SET_OWNER */ -VHOST_RESET_DEVICE ,/* VHOST_USER_RESET_DEVICE */ +VHOST_RESET_OWNER ,/* VHOST_USER_RESET_OWNER */ VHOST_SET_MEM_TABLE ,/* VHOST_USER_SET_MEM_TABLE */ VHOST_SET_LOG_BASE ,/* VHOST_USER_SET_LOG_BASE */ VHOST_SET_LOG_FD, /* VHOST_USER_SET_LOG_FD */@@ -192,7 +192,7 @@ static bool vhost_user_one_time_request(VhostUserRequest request) {switch (request) {case VHOST_USER_SET_OWNER : -case VHOST_USER_RESET_DEVICE : +case VHOST_USER_RESET_OWNER :case VHOST_USER_SET_MEM_TABLE :case VHOST_USER_GET_QUEUE_NUM :return true;@@ -249,7 +249,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,break ;case VHOST_USER_SET_OWNER : -case VHOST_USER_RESET_DEVICE : +case VHOST_USER_RESET_OWNER :break ;case VHOST_USER_SET_MEM_TABLE :linux-headers/linux/vhost.h +1
-1@@ -78,7 +78,7 @@ struct vhost_memory {#define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01)/* Give up ownership, and reset the device to default values. * Allows subsequent call to VHOST_OWNER_SET to succeed. */ -#define VHOST_RESET_DEVICE _IO(VHOST_VIRTIO, 0x02) +#define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02)/* Set up/modify memory layout */ #define VHOST_SET_MEM_TABLE _IOW(VHOST_VIRTIO, 0x03, struct vhost_memory)tests/vhost-user-test.c +1
-1@@ -53,7 +53,7 @@ typedef enum VhostUserRequest {VHOST_USER_GET_FEATURES =1 ,VHOST_USER_SET_FEATURES =2 ,VHOST_USER_SET_OWNER =3 , -VHOST_USER_RESET_DEVICE =4 , +VHOST_USER_RESET_OWNER =4 ,VHOST_USER_SET_MEM_TABLE =5 ,VHOST_USER_SET_LOG_BASE =6 , VHOST_USER_SET_LOG_FD = 7,Signature · 1 line
1.9.0
Quoted 16 lines · Yuanhan Liu
Quoted 7 lines · Michael S. Tsirkin
Quoted 6 lines · Yuanhan Liu
This reverts commit
d1f8b30ec8dde0318fd1b98d24a64926feae9625.It turned out that it breaks stuff, so revert it:
http://lists.nongnu.org/archive/html/qemu-devel/2015-10/msg00949.htmlQuoted 7 lines
Quoted 3 lines
CC "Michael S. Tsirkin" <[email protected]>Reported-by Paolo Bonzini <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>Are these patches dependent on each other? If yes pls send a cover letter. If not pls don't send a series, post them separately.
Quoted 7 lines
Got it.
Quoted 1 line
And, pls Cc me on all vhost user patches.
Isn't I always doing that? :)
--yliu
You didn't for 5/5.
Quoted 108 lines
Quoted 108 lines
Quoted 108 lines
--- docs/specs/vhost-user.txt | 4 ++-- hw/net/vhost_net.c | 2 +- hw/virtio/vhost-user.c | 8 ++++---- linux-headers/linux/vhost.h | 2 +- tests/vhost-user-test.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-)docs/specs/vhost-user.txt +2
-2@@ -211,10 +211,10 @@ Message types as an owner of the session. This can be used on the Slave as a "session start" flag. - * VHOST_USER_RESET_DEVICE + * VHOST_USER_RESET_OWNER Id: 4 - Equivalent ioctl: VHOST_RESET_DEVICE + Equivalent ioctl: VHOST_RESET_OWNER Master payload: N/A Issued when a new connection is about to be closed. The Master will nohw/net/vhost_net.c +1
-1@@ -296,7 +296,7 @@ static void vhost_net_stop_one(struct vhost_net *net, }else if (net->nc->info->type ==NET_CLIENT_OPTIONS_KIND_VHOST_USER ) {for (file.index =0 ; file.index < net->dev.nvqs; ++file.index) {const VhostOps *vhost_ops = net->dev.vhost_ops; -int r = vhost_ops->vhost_call (&net->dev,VHOST_RESET_DEVICE , +int r = vhost_ops->vhost_call (&net->dev,VHOST_RESET_OWNER ,NULL );assert (r >=0 ); }hw/virtio/vhost-user.c +4
-4@@ -34,7 +34,7 @@ typedef enum VhostUserRequest {VHOST_USER_GET_FEATURES =1 ,VHOST_USER_SET_FEATURES =2 ,VHOST_USER_SET_OWNER =3 , -VHOST_USER_RESET_DEVICE =4 , +VHOST_USER_RESET_OWNER =4 ,VHOST_USER_SET_MEM_TABLE =5 ,VHOST_USER_SET_LOG_BASE =6 , VHOST_USER_SET_LOG_FD = 7,@@ -102,7 +102,7 @@ static unsigned long int ioctl_to_vhost_user_request[VHOST_USER_MAX] = {VHOST_GET_FEATURES ,/* VHOST_USER_GET_FEATURES */ VHOST_SET_FEATURES ,/* VHOST_USER_SET_FEATURES */ VHOST_SET_OWNER ,/* VHOST_USER_SET_OWNER */ -VHOST_RESET_DEVICE ,/* VHOST_USER_RESET_DEVICE */ +VHOST_RESET_OWNER ,/* VHOST_USER_RESET_OWNER */ VHOST_SET_MEM_TABLE ,/* VHOST_USER_SET_MEM_TABLE */ VHOST_SET_LOG_BASE ,/* VHOST_USER_SET_LOG_BASE */ VHOST_SET_LOG_FD, /* VHOST_USER_SET_LOG_FD */@@ -192,7 +192,7 @@ static bool vhost_user_one_time_request(VhostUserRequest request) {switch (request) {case VHOST_USER_SET_OWNER : -case VHOST_USER_RESET_DEVICE : +case VHOST_USER_RESET_OWNER :case VHOST_USER_SET_MEM_TABLE :case VHOST_USER_GET_QUEUE_NUM :return true;@@ -249,7 +249,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,break ;case VHOST_USER_SET_OWNER : -case VHOST_USER_RESET_DEVICE : +case VHOST_USER_RESET_OWNER :break ;case VHOST_USER_SET_MEM_TABLE :linux-headers/linux/vhost.h +1
-1@@ -78,7 +78,7 @@ struct vhost_memory {#define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01)/* Give up ownership, and reset the device to default values. * Allows subsequent call to VHOST_OWNER_SET to succeed. */ -#define VHOST_RESET_DEVICE _IO(VHOST_VIRTIO, 0x02) +#define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02)/* Set up/modify memory layout */ #define VHOST_SET_MEM_TABLE _IOW(VHOST_VIRTIO, 0x03, struct vhost_memory)tests/vhost-user-test.c +1
-1@@ -53,7 +53,7 @@ typedef enum VhostUserRequest {VHOST_USER_GET_FEATURES =1 ,VHOST_USER_SET_FEATURES =2 ,VHOST_USER_SET_OWNER =3 , -VHOST_USER_RESET_DEVICE =4 , +VHOST_USER_RESET_OWNER =4 ,VHOST_USER_SET_MEM_TABLE =5 ,VHOST_USER_SET_LOG_BASE =6 , VHOST_USER_SET_LOG_FD = 7,Signature · 1 line
1.9.0
Quoted 19 lines · Michael S. Tsirkin
Quoted 18 lines · Yuanhan Liu
Quoted 7 lines · Michael S. Tsirkin
Quoted 6 lines · Yuanhan Liu
This reverts commit
d1f8b30ec8dde0318fd1b98d24a64926feae9625.It turned out that it breaks stuff, so revert it:
http://lists.nongnu.org/archive/html/qemu-devel/2015-10/msg00949.htmlQuoted 7 lines
Quoted 3 lines
CC "Michael S. Tsirkin" <[email protected]>Reported-by Paolo Bonzini <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>Are these patches dependent on each other? If yes pls send a cover letter. If not pls don't send a series, post them separately.
Got it.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
And, pls Cc me on all vhost user patches.
Isn't I always doing that? :)
--yliuYou didn't for 5/5.
Oops, that obviously is a mistake. Sorry for that.
--yliu
Quoted 109 lines
Quoted 109 lines
Quoted 109 lines
Quoted 109 lines
--- docs/specs/vhost-user.txt | 4 ++-- hw/net/vhost_net.c | 2 +- hw/virtio/vhost-user.c | 8 ++++---- linux-headers/linux/vhost.h | 2 +- tests/vhost-user-test.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-)docs/specs/vhost-user.txt +2
-2@@ -211,10 +211,10 @@ Message types as an owner of the session. This can be used on the Slave as a "session start" flag. - * VHOST_USER_RESET_DEVICE + * VHOST_USER_RESET_OWNER Id: 4 - Equivalent ioctl: VHOST_RESET_DEVICE + Equivalent ioctl: VHOST_RESET_OWNER Master payload: N/A Issued when a new connection is about to be closed. The Master will nohw/net/vhost_net.c +1
-1@@ -296,7 +296,7 @@ static void vhost_net_stop_one(struct vhost_net *net, }else if (net->nc->info->type ==NET_CLIENT_OPTIONS_KIND_VHOST_USER ) {for (file.index =0 ; file.index < net->dev.nvqs; ++file.index) {const VhostOps *vhost_ops = net->dev.vhost_ops; -int r = vhost_ops->vhost_call (&net->dev,VHOST_RESET_DEVICE , +int r = vhost_ops->vhost_call (&net->dev,VHOST_RESET_OWNER ,NULL );assert (r >=0 ); }hw/virtio/vhost-user.c +4
-4@@ -34,7 +34,7 @@ typedef enum VhostUserRequest {VHOST_USER_GET_FEATURES =1 ,VHOST_USER_SET_FEATURES =2 ,VHOST_USER_SET_OWNER =3 , -VHOST_USER_RESET_DEVICE =4 , +VHOST_USER_RESET_OWNER =4 ,VHOST_USER_SET_MEM_TABLE =5 ,VHOST_USER_SET_LOG_BASE =6 , VHOST_USER_SET_LOG_FD = 7,@@ -102,7 +102,7 @@ static unsigned long int ioctl_to_vhost_user_request[VHOST_USER_MAX] = {VHOST_GET_FEATURES ,/* VHOST_USER_GET_FEATURES */ VHOST_SET_FEATURES ,/* VHOST_USER_SET_FEATURES */ VHOST_SET_OWNER ,/* VHOST_USER_SET_OWNER */ -VHOST_RESET_DEVICE ,/* VHOST_USER_RESET_DEVICE */ +VHOST_RESET_OWNER ,/* VHOST_USER_RESET_OWNER */ VHOST_SET_MEM_TABLE ,/* VHOST_USER_SET_MEM_TABLE */ VHOST_SET_LOG_BASE ,/* VHOST_USER_SET_LOG_BASE */ VHOST_SET_LOG_FD, /* VHOST_USER_SET_LOG_FD */@@ -192,7 +192,7 @@ static bool vhost_user_one_time_request(VhostUserRequest request) {switch (request) {case VHOST_USER_SET_OWNER : -case VHOST_USER_RESET_DEVICE : +case VHOST_USER_RESET_OWNER :case VHOST_USER_SET_MEM_TABLE :case VHOST_USER_GET_QUEUE_NUM :return true;@@ -249,7 +249,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,break ;case VHOST_USER_SET_OWNER : -case VHOST_USER_RESET_DEVICE : +case VHOST_USER_RESET_OWNER :break ;case VHOST_USER_SET_MEM_TABLE :linux-headers/linux/vhost.h +1
-1@@ -78,7 +78,7 @@ struct vhost_memory {#define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01)/* Give up ownership, and reset the device to default values. * Allows subsequent call to VHOST_OWNER_SET to succeed. */ -#define VHOST_RESET_DEVICE _IO(VHOST_VIRTIO, 0x02) +#define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02)/* Set up/modify memory layout */ #define VHOST_SET_MEM_TABLE _IOW(VHOST_VIRTIO, 0x03, struct vhost_memory)tests/vhost-user-test.c +1
-1@@ -53,7 +53,7 @@ typedef enum VhostUserRequest {VHOST_USER_GET_FEATURES =1 ,VHOST_USER_SET_FEATURES =2 ,VHOST_USER_SET_OWNER =3 , -VHOST_USER_RESET_DEVICE =4 , +VHOST_USER_RESET_OWNER =4 ,VHOST_USER_SET_MEM_TABLE =5 ,VHOST_USER_SET_LOG_BASE =6 , VHOST_USER_SET_LOG_FD = 7,Signature · 1 line
1.9.0