[PATCH v2] libvhost-user: Zero memory allocated for VuVirtqInflightDesc

2019-11-19 Thread elohimes
From: Xie Yongji Use a zero-initialized VuVirtqInflightDesc struct to avoid that scan-build reports that vq->resubmit_list[0].counter may be garbage value in vu_check_queue_inflights(). Fixes: 5f9ff1eff ("libvhost-user: Support tracking inflight I/O in shared memory") Reported-by: Marc-André

[PATCH] libvhost-user: Zero memory allocated for VuVirtqInflightDesc

2019-11-18 Thread elohimes
From: Xie Yongji Use a zero-initialized VuVirtqInflightDesc struct to avoid that scan-build reports that vq->resubmit_list[0].counter may be garbage value in vu_check_queue_inflights(). Fixes: 5f9ff1eff ("libvhost-user: Support tracking inflight I/O in shared memory") Reported-by: Marc-André

[Qemu-devel] [PATCH v2 2/2] vhost-user-scsi: Call virtio_scsi_common_unrealize() when device realize failed

2019-07-16 Thread elohimes
From: Xie Yongji This avoids memory leak when device hotplug is failed. Signed-off-by: Xie Yongji --- hw/scsi/vhost-user-scsi.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index

[Qemu-devel] [PATCH v2 1/2] vhost-scsi: Call virtio_scsi_common_unrealize() when device realize failed

2019-07-16 Thread elohimes
From: Xie Yongji This avoids memory leak when device hotplug is failed. Signed-off-by: Xie Yongji --- hw/scsi/vhost-scsi.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 4090f99ee4..c0dd9bdf89 100644 ---

[Qemu-devel] [PATCH 1/2] vhost-scsi: Call virtio_scsi_common_unrealize() when device realize failed

2019-07-15 Thread elohimes
From: Xie Yongji This avoids memory leak when device hotplug is failed. Signed-off-by: Xie Yongji --- hw/scsi/vhost-scsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 4090f99ee4..db4a090576 100644 ---

[Qemu-devel] [PATCH 2/2] vhost-user-scsi: Call virtio_scsi_common_unrealize() when device realize failed

2019-07-15 Thread elohimes
From: Xie Yongji This avoids memory leak when device hotplug is failed. Signed-off-by: Xie Yongji --- hw/scsi/vhost-user-scsi.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index

[Qemu-devel] [PATCH v4 4/5] virtio: Make sure we get correct state of device on handle_aio_output()

2019-06-25 Thread elohimes
From: Xie Yongji We should set the flags: "start_on_kick" and "started" after we call the kick functions (handle_aio_output() and handle_output()). Signed-off-by: Xie Yongji --- hw/virtio/virtio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/virtio/virtio.c

[Qemu-devel] [PATCH v4 3/5] virtio: Set "start_on_kick" on virtio_set_features()

2019-06-25 Thread elohimes
From: Xie Yongji The guest feature is not set correctly on virtio_reset() and virtio_init(). So we should not use it to set "start_on_kick" at that point. This patch set "start_on_kick" on virtio_set_features() instead. Fixes: badaf79cfdbd3 ("virtio: Introduce started flag to VirtioDevice")

[Qemu-devel] [PATCH v4 5/5] virtio: Don't change "started" flag on virtio_vmstate_change()

2019-06-25 Thread elohimes
From: Xie Yongji We will call virtio_set_status() on virtio_vmstate_change(). The "started" flag should not be changed in this case. Otherwise, we may get an incorrect value when we set "started" flag but not set DRIVER_OK in source VM. Signed-off-by: Xie Yongji --- hw/virtio/virtio.c | 5

[Qemu-devel] [PATCH v4 1/5] virtio: add "use-started" property

2019-06-25 Thread elohimes
From: Xie Yongji In order to avoid migration issues, we introduce a "use-started" property to the base virtio device to indicate whether use "started" flag or not. This property will be true by default and set to false when machine type <= 4.0. Suggested-by: Greg Kurz Signed-off-by: Xie Yongji

[Qemu-devel] [PATCH v4 0/5] virtio: fix some issues of "started" and "start_on_kick" flag

2019-06-25 Thread elohimes
From: Xie Yongji We introduced two flags "started" and "start_on_kick" to indicate virtio device's state before. But there still are some problems with them. So we try to fixup them in this patchset. The patch 1 introduces a "use-started" property to avoid a migration issue under Greg Kurz's

[Qemu-devel] [PATCH v4 2/5] virtio: Set "start_on_kick" for legacy devices

2019-06-25 Thread elohimes
From: Xie Yongji Besides virtio 1.0 transitional devices, we should also set "start_on_kick" flag for legacy devices (virtio 0.9). Signed-off-by: Xie Yongji Reviewed-by: Greg Kurz --- hw/virtio/virtio.c | 6 ++ include/hw/virtio/virtio.h | 2 +- 2 files changed, 3 insertions(+),

[Qemu-devel] [PATCH v3 2/5] virtio: Set "start_on_kick" for legacy devices

2019-06-14 Thread elohimes
From: Xie Yongji Besides virtio 1.0 transitional devices, we should also set "start_on_kick" flag for legacy devices (virtio 0.9). Signed-off-by: Xie Yongji --- hw/virtio/virtio.c | 6 ++ include/hw/virtio/virtio.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff

[Qemu-devel] [PATCH v3 5/5] virtio: Don't change "started" flag on virtio_vmstate_change()

2019-06-14 Thread elohimes
From: Xie Yongji We will call virtio_set_status() on virtio_vmstate_change(). The "started" flag should not be changed in this case. Otherwise, we may get an incorrect value when we set "started" flag but not set DRIVER_OK in source VM. Signed-off-by: Xie Yongji --- hw/virtio/virtio.c | 5

[Qemu-devel] [PATCH v3 0/5] virtio: fix some issues of "started" and "start_on_kick" flag

2019-06-14 Thread elohimes
From: Xie Yongji We introduced two flags "started" and "start_on_kick" to indicate virtio device's state before. But there still are some problems with them. So we try to fixup them in this patchset. The patch 1 introduces a "use-started" property to avoid a migration issue under Greg Kurz's

[Qemu-devel] [PATCH v3 4/5] virtio: Make sure we get correct state of device on handle_aio_output()

2019-06-14 Thread elohimes
From: Xie Yongji We should set the flags: "start_on_kick" and "started" after we call the kick functions (handle_aio_output() and handle_output()). Signed-off-by: Xie Yongji --- hw/virtio/virtio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/virtio/virtio.c

[Qemu-devel] [PATCH v3 3/5] virtio: Set "start_on_kick" on virtio_set_features()

2019-06-14 Thread elohimes
From: Xie Yongji The guest feature is not set correctly on virtio_reset() and virtio_init(). So we should not use it to set "start_on_kick" at that point. This patch set "start_on_kick" on virtio_set_features() instead. Fixes: badaf79cfdbd3 ("virtio: Introduce started flag to VirtioDevice")

[Qemu-devel] [PATCH v3 1/5] virtio: add "use-started" property

2019-06-14 Thread elohimes
From: Xie Yongji In order to avoid migration issues, we introduce a "use-started" property to the base virtio device to indicate whether use "started" flag or not. This property will be true by default and set to false when machine type <= 4.0.1. Suggested-by: Greg Kurz Signed-off-by: Xie

[Qemu-devel] [PATCH v2 1/5] virtio: Set "start_on_kick" on virtio_set_features()

2019-06-04 Thread elohimes
From: Xie Yongji The guest feature is not set correctly on virtio_reset() and virtio_init(). So we should not use it to set "start_on_kick" at that point. This patch set "start_on_kick" on virtio_set_features() instead. Fixes: badaf79cfdbd3 ("virtio: Introduce started flag to VirtioDevice")

[Qemu-devel] [PATCH v2 3/5] virtio: Make sure we get correct state of device on handle_aio_output()

2019-06-04 Thread elohimes
From: Xie Yongji We should set the flags: "start_on_kick" and "started" after we call the kick functions (handle_aio_output() and handle_output()). Signed-off-by: Xie Yongji --- hw/virtio/virtio.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/virtio/virtio.c

[Qemu-devel] [PATCH v2 5/5] virtio: add "use-started" property

2019-06-04 Thread elohimes
From: Xie Yongji In order to avoid migration issues, we introduce a "use-started" property to the base virtio device to indicate whether use "started" flag or not. This property will be true by default and set to false when machine type <= 4.0.1. Signed-off-by: Xie Yongji ---

[Qemu-devel] [PATCH v2 4/5] virtio: Don't change "started" flag on virtio_vmstate_change()

2019-06-04 Thread elohimes
From: Xie Yongji We will call virtio_set_status() on virtio_vmstate_change(). The "started" flag should not be changed in this case. Otherwise, we may get an incorrect value when we set "started" flag but not set DRIVER_OK in source VM. Signed-off-by: Xie Yongji --- hw/virtio/virtio.c | 10

[Qemu-devel] [PATCH v2 0/5] virtio: fix some issues of "started" and "start_on_kick" flag

2019-06-04 Thread elohimes
From: Xie Yongji We introduced two flags "started" and "start_on_kick" to indicate virtio device's state before. But there still are some problems with them. So we try to fixup them in this patchset. The patch 1 fixes a regression bug that old guest is not able to boot with vhost-user-blk

[Qemu-devel] [PATCH v2 2/5] virtio: Set "start_on_kick" for legacy devices

2019-06-04 Thread elohimes
From: Xie Yongji Besides virtio 1.0 transitional devices, we should also set "start_on_kick" flag for legacy devices (virtio 0.9). Signed-off-by: Xie Yongji --- hw/virtio/virtio.c | 2 -- include/hw/virtio/virtio.h | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git

[Qemu-devel] [PATCH 4/5] virtio: Don't change "started" flag on virtio_vmstate_change()

2019-05-29 Thread elohimes
From: Xie Yongji We will call virtio_set_status() on virtio_vmstate_change(). The "started" flag should not be changed in this case. Otherwise, we may get an incorrect value when we set "started" flag but not set DRIVER_OK in source VM. Signed-off-by: Xie Yongji --- hw/virtio/virtio.c | 10

[Qemu-devel] [PATCH 2/5] virtio: Migrate the "start_on_kick" flag

2019-05-29 Thread elohimes
From: Xie Yongji We should migrate the "start_on_kick" flag so that we would not miss starting device on kicking at startup after migration. Signed-off-by: Xie Yongji --- hw/virtio/virtio.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/hw/virtio/virtio.c

[Qemu-devel] [PATCH 5/5] virtio: add "use-started" property

2019-05-29 Thread elohimes
From: Xie Yongji In order to avoid migration issues, we introduce a "use-started" property to the base virtio device to indicate whether "started" and "start_on_kick" flag could be used. This property will be true by default and set to false when machine type <= 4.0. Suggested-by: Greg Kurz

[Qemu-devel] [PATCH 3/5] virtio: Make sure we get correct state of device on handle_aio_output()

2019-05-29 Thread elohimes
From: Xie Yongji We should set the flags: "start_on_kick" and "started" after we call the kick functions (handle_aio_output() and handle_output()). Signed-off-by: Xie Yongji --- hw/virtio/virtio.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/virtio/virtio.c

[Qemu-devel] [PATCH 1/5] virtio: Set "start_on_kick" on virtio_set_features()

2019-05-29 Thread elohimes
From: Xie Yongji The guest feature is not set correctly on virtio_reset() and virtio_init(). So we should not use it to set "start_on_kick" at that point. This patch set "start_on_kick" on virtio_set_features() instead. Signed-off-by: Xie Yongji --- hw/virtio/virtio.c | 25

[Qemu-devel] [PATCH 0/5] virtio: fix some issues of "started" and "start_on_kick" flag

2019-05-29 Thread elohimes
From: Xie Yongji We introduced two flags "started" and "start_on_kick" to indicate virtio device's state before. But there still are some problems with them. So we try to fixup them in this patchset. The patch 1 fixes a regression bug that old guest is not able to boot with vhost-user-blk

[Qemu-devel] [PATCH v8 5/7] vhost-user-blk: Add return value for vhost_user_blk_start()

2019-03-20 Thread elohimes
From: Xie Yongji Add a return value for vhost_user_blk_start() to check whether we start vhost-user backend successfully or not. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/block/vhost-user-blk.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git

[Qemu-devel] [PATCH v8 7/7] contrib/vhost-user-blk: enable inflight I/O tracking

2019-03-20 Thread elohimes
From: Xie Yongji This patch enables inflight I/O tracking for vhost-user-blk backend so that we could restart it safely. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- contrib/vhost-user-blk/vhost-user-blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[Qemu-devel] [PATCH v8 4/7] vhost-user-blk: Only start vhost-user backend with the first kick

2019-03-20 Thread elohimes
From: Xie Yongji We should only start vhost-user backend at the first kick for virtio 1.0 transitional devices. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/block/vhost-user-blk.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/block/vhost-user-blk.c

[Qemu-devel] [PATCH v8 6/7] vhost-user-blk: Add support to reconnect backend

2019-03-20 Thread elohimes
From: Xie Yongji Since we now support the message VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD. The backend is able to restart safely because it can track inflight I/O in shared memory. This patch allows qemu to reconnect the backend after connection closed. Signed-off-by: Xie

[Qemu-devel] [PATCH v8 2/7] virtio: Use started flag in virtio_vmstate_change()

2019-03-20 Thread elohimes
From: Xie Yongji Currently, we use DRIVER_OK status bit to check whether guest driver has started the device in virtio_vmstate_change(). But it's not the case for virtio 1.0 transitional devices. If migration completes between kicking virtqueue and setting VIRTIO_CONFIG_S_DRIVER_OK, guest may be

[Qemu-devel] [PATCH v8 3/7] vhost-user-blk: Use started flag in vhost_user_blk_set_status()

2019-03-20 Thread elohimes
From: Xie Yongji Use started flag in vhost_user_blk_set_status() to decide if starting vhost-user backend or not. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/block/vhost-user-blk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/block/vhost-user-blk.c

[Qemu-devel] [PATCH v8 1/7] virtio: Introduce started flag to VirtioDevice

2019-03-20 Thread elohimes
From: Xie Yongji The virtio 1.0 transitional devices support driver uses the device before setting the DRIVER_OK status bit. So we introduce a started flag to indicate whether driver has started the device or not. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/virtio/virtio.c

[Qemu-devel] [PATCH v8 0/7] vhost-user-blk: Add support for backend reconnecting

2019-03-20 Thread elohimes
From: Xie Yongji This patchset is aimed at supporting qemu to reconnect vhost-user-blk backend after vhost-user-blk backend crash or restart. The patch 1,2,3 introduce started flag to VirtioDevice to fix possible guest hung after migration for virtio 1.0 transitional devices. The patch 4,5,6

[Qemu-devel] [PATCH v7 7/7] contrib/vhost-user-blk: enable inflight I/O tracking

2019-02-28 Thread elohimes
From: Xie Yongji This patch enables inflight I/O tracking for vhost-user-blk backend so that we could restart it safely. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- contrib/vhost-user-blk/vhost-user-blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[Qemu-devel] [PATCH v7 6/7] vhost-user-blk: Add support to reconnect backend

2019-02-28 Thread elohimes
From: Xie Yongji Since we now support the message VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD. The backend is able to restart safely because it can track inflight I/O in shared memory. This patch allows qemu to reconnect the backend after connection closed. Signed-off-by: Xie

[Qemu-devel] [PATCH v7 4/7] libvhost-user: Support tracking inflight I/O in shared memory

2019-02-28 Thread elohimes
From: Xie Yongji This patch adds support for VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD message to set/get shared buffer to/from qemu. Then backend can track inflight I/O in this buffer. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- Makefile

[Qemu-devel] [PATCH v7 5/7] vhost-user-blk: Add support to get/set inflight buffer

2019-02-28 Thread elohimes
From: Xie Yongji This patch adds support for vhost-user-blk device to get/set inflight buffer from/to backend. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/block/vhost-user-blk.c | 28 include/hw/virtio/vhost-user-blk.h | 1 + 2 files

[Qemu-devel] [PATCH v7 1/7] vhost-user: Support transferring inflight buffer between qemu and backend

2019-02-28 Thread elohimes
From: Xie Yongji This patch introduces two new messages VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD to support transferring a shared buffer between qemu and backend. Firstly, qemu uses VHOST_USER_GET_INFLIGHT_FD to get the shared buffer from backend. Then qemu should send it back

[Qemu-devel] [PATCH v7 0/7] vhost-user-blk: Add support for backend reconnecting

2019-02-28 Thread elohimes
From: Xie Yongji This patchset is aimed at supporting qemu to reconnect vhost-user-blk backend after vhost-user-blk backend crash or restart. The patch 1 introduces two new messages VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD to support transferring shared buffer between qemu and

[Qemu-devel] [PATCH v7 3/7] libvhost-user: Introduce vu_queue_map_desc()

2019-02-28 Thread elohimes
From: Xie Yongji Introduce vu_queue_map_desc() which should be independent with vu_queue_pop(); Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu Reviewed-by: Marc-André Lureau --- contrib/libvhost-user/libvhost-user.c | 88 --- 1 file changed, 51 insertions(+), 37

[Qemu-devel] [PATCH v7 2/7] libvhost-user: Remove unnecessary FD flag check for event file descriptors

2019-02-28 Thread elohimes
From: Xie Yongji The vu_check_queue_msg_file() has checked the FD flag. So let's delete the redundant check after it. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- contrib/libvhost-user/libvhost-user.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git

[Qemu-devel] [PATCH v6 2/7] libvhost-user: Remove unnecessary FD flag check for event file descriptors

2019-02-18 Thread elohimes
From: Xie Yongji The vu_check_queue_msg_file() has checked the FD flag. So let's delete the redundant check after it. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- contrib/libvhost-user/libvhost-user.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git

[Qemu-devel] [PATCH v6 4/7] libvhost-user: Support tracking inflight I/O in shared memory

2019-02-18 Thread elohimes
From: Xie Yongji This patch adds support for VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD message to set/get shared buffer to/from qemu. Then backend can track inflight I/O in this buffer. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- Makefile

[Qemu-devel] [PATCH v6 7/7] contrib/vhost-user-blk: enable inflight I/O tracking

2019-02-18 Thread elohimes
From: Xie Yongji This patch enables inflight I/O tracking for vhost-user-blk backend so that we could restart it safely. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- contrib/vhost-user-blk/vhost-user-blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[Qemu-devel] [PATCH v6 3/7] libvhost-user: Introduce vu_queue_map_desc()

2019-02-18 Thread elohimes
From: Xie Yongji Introduce vu_queue_map_desc() which should be independent with vu_queue_pop(); Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu Reviewed-by: Marc-André Lureau --- contrib/libvhost-user/libvhost-user.c | 88 --- 1 file changed, 51 insertions(+), 37

[Qemu-devel] [PATCH v6 5/7] vhost-user-blk: Add support to get/set inflight buffer

2019-02-18 Thread elohimes
From: Xie Yongji This patch adds support for vhost-user-blk device to get/set inflight buffer from/to backend. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/block/vhost-user-blk.c | 28 include/hw/virtio/vhost-user-blk.h | 1 + 2 files

[Qemu-devel] [PATCH v6 6/7] vhost-user-blk: Add support to reconnect backend

2019-02-18 Thread elohimes
From: Xie Yongji Since we now support the message VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD. The backend is able to restart safely because it can track inflight I/O in shared memory. This patch allows qemu to reconnect the backend after connection closed. Signed-off-by: Xie

[Qemu-devel] [PATCH v6 1/7] vhost-user: Support transferring inflight buffer between qemu and backend

2019-02-18 Thread elohimes
From: Xie Yongji This patch introduces two new messages VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD to support transferring a shared buffer between qemu and backend. Firstly, qemu uses VHOST_USER_GET_INFLIGHT_FD to get the shared buffer from backend. Then qemu should send it back

[Qemu-devel] [PATCH v6 0/7] vhost-user-blk: Add support for backend reconnecting

2019-02-18 Thread elohimes
From: Xie Yongji This patchset is aimed at supporting qemu to reconnect vhost-user-blk backend after vhost-user-blk backend crash or restart. The patch 1 introduces two new messages VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD to support transferring shared buffer between qemu and

[Qemu-devel] [PATCH v5 6/6] contrib/vhost-user-blk: enable inflight I/O tracking

2019-01-22 Thread elohimes
From: Xie Yongji This patch enables inflight I/O tracking for vhost-user-blk backend so that we could restart it safely. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- contrib/vhost-user-blk/vhost-user-blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[Qemu-devel] [PATCH v5 3/6] libvhost-user: Support tracking inflight I/O in shared memory

2019-01-22 Thread elohimes
From: Xie Yongji This patch adds support for VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD message to set/get shared buffer to/from qemu. Then backend can track inflight I/O in this buffer. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- Makefile

[Qemu-devel] [PATCH v5 5/6] vhost-user-blk: Add support to reconnect backend

2019-01-22 Thread elohimes
From: Xie Yongji Since we now support the message VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD. The backend is able to restart safely because it can track inflight I/O in shared memory. This patch allows qemu to reconnect the backend after connection closed. Signed-off-by: Xie

[Qemu-devel] [PATCH v5 1/6] vhost-user: Support transferring inflight buffer between qemu and backend

2019-01-22 Thread elohimes
From: Xie Yongji This patch introduces two new messages VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD to support transferring a shared buffer between qemu and backend. Firstly, qemu uses VHOST_USER_GET_INFLIGHT_FD to get the shared buffer from backend. Then qemu should send it back

[Qemu-devel] [PATCH v5 4/6] vhost-user-blk: Add support to get/set inflight buffer

2019-01-22 Thread elohimes
From: Xie Yongji This patch adds support for vhost-user-blk device to get/set inflight buffer from/to backend. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/block/vhost-user-blk.c | 26 ++ include/hw/virtio/vhost-user-blk.h | 1 + 2 files changed,

[Qemu-devel] [PATCH v5 2/6] libvhost-user: Introduce vu_queue_map_desc()

2019-01-22 Thread elohimes
From: Xie Yongji Introduce vu_queue_map_desc() which should be independent with vu_queue_pop(); Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu Reviewed-by: Marc-André Lureau --- contrib/libvhost-user/libvhost-user.c | 88 --- 1 file changed, 51 insertions(+), 37

[Qemu-devel] [PATCH v5 0/6] vhost-user-blk: Add support for backend reconnecting

2019-01-22 Thread elohimes
From: Xie Yongji This patchset is aimed at supporting qemu to reconnect vhost-user-blk backend after vhost-user-blk backend crash or restart. The patch 1 introduces two new messages VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD to support support transferring shared buffer between

[Qemu-devel] [PATCH v4 for-4.0 4/7] libvhost-user: Support tracking inflight I/O in shared memory

2019-01-09 Thread elohimes
From: Xie Yongji This patch adds support for VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD message to set/get shared memory to/from qemu. Then we maintain a "bitmap" of all descriptors in the shared memory for each queue to track inflight I/O. Signed-off-by: Xie Yongji

[Qemu-devel] [PATCH v4 for-4.0 3/7] libvhost-user: Introduce vu_queue_map_desc()

2019-01-09 Thread elohimes
From: Xie Yongji Introduce vu_queue_map_desc() which should be independent with vu_queue_pop(); Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu Reviewed-by: Marc-André Lureau --- contrib/libvhost-user/libvhost-user.c | 88 --- 1 file changed, 51 insertions(+), 37

[Qemu-devel] [PATCH v4 for-4.0 6/7] vhost-user-blk: Add support to reconnect backend

2019-01-09 Thread elohimes
From: Xie Yongji Since we now support the message VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD. The backend is able to restart safely because it can track inflight I/O in shared memory. This patch allows qemu to reconnect the backend after connection closed. Signed-off-by: Xie

[Qemu-devel] [PATCH v4 for-4.0 2/7] vhost-user: Support transferring inflight buffer between qemu and backend

2019-01-09 Thread elohimes
From: Xie Yongji This patch introduces two new messages VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD to support transferring a shared buffer between qemu and backend. Firstly, qemu uses VHOST_USER_GET_INFLIGHT_FD to get the shared buffer from backend. Then qemu should send it back

[Qemu-devel] [PATCH v4 for-4.0 7/7] contrib/vhost-user-blk: enable inflight I/O tracking

2019-01-09 Thread elohimes
From: Xie Yongji This patch enables inflight I/O tracking for vhost-user-blk backend so that we could restart it safely. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- contrib/vhost-user-blk/vhost-user-blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[Qemu-devel] [PATCH v4 for-4.0 5/7] vhost-user-blk: Add support to get/set inflight buffer

2019-01-09 Thread elohimes
From: Xie Yongji This patch adds support for vhost-user-blk device to get/set inflight buffer from/to backend. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/block/vhost-user-blk.c | 26 ++ include/hw/virtio/vhost-user-blk.h | 1 + 2 files changed,

[Qemu-devel] [PATCH v4 for-4.0 1/7] char-socket: Enable "nowait" option on client sockets

2019-01-09 Thread elohimes
From: Xie Yongji Enable "nowait" option to make QEMU not do a connect on client sockets during initialization of the chardev. Then we can use qemu_chr_fe_wait_connected() to connect when necessary. Now it would be used for unix domain socket of vhost-user-blk device to support reconnect.

[Qemu-devel] [PATCH v4 for-4.0 0/7] vhost-user-blk: Add support for backend reconnecting

2019-01-09 Thread elohimes
From: Xie Yongji This patchset is aimed at supporting qemu to reconnect vhost-user-blk backend after vhost-user-blk backend crash or restart. The patch 1 uses exisiting wait/nowait options to make QEMU not do a connect on client sockets during initialization of the chardev. The patch 2

[Qemu-devel] [PATCH v3 for-4.0 6/7] vhost-user-blk: Add support to reconnect backend

2019-01-03 Thread elohimes
From: Xie Yongji Since we now support the message VHOST_USER_GET_SHM_SIZE and VHOST_USER_SET_SHM_FD. The backend is able to restart safely because it can record inflight I/O in shared memory. This patch allows qemu to reconnect the backend after connection closed. Signed-off-by: Xie Yongji

[Qemu-devel] [PATCH v3 for-4.0 7/7] contrib/vhost-user-blk: enable inflight I/O recording

2019-01-03 Thread elohimes
From: Xie Yongji This patch enables inflight I/O recording for vhost-user-blk backend so that we could restart it safely. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- contrib/vhost-user-blk/vhost-user-blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[Qemu-devel] [PATCH v3 for-4.0 5/7] vhost-user-blk: Add support to provide shared memory to backend

2019-01-03 Thread elohimes
From: Xie Yongji This patch add supports for vhost-user-blk device to provide shared memory to backend. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/block/vhost-user-blk.c | 26 ++ include/hw/virtio/vhost-user-blk.h | 1 + 2 files changed, 27

[Qemu-devel] [PATCH v3 for-4.0 1/7] char-socket: Enable "nowait" option on client sockets

2019-01-03 Thread elohimes
From: Xie Yongji Enable "nowait" option to make QEMU not do a connect on client sockets during initialization of the chardev. Then we can use qemu_chr_fe_wait_connected() to connect when necessary. Now it would be used for unix domain socket of vhost-user-blk device to support reconnect.

[Qemu-devel] [PATCH v3 for-4.0 3/7] libvhost-user: Introduce vu_queue_map_desc()

2019-01-03 Thread elohimes
From: Xie Yongji Introduce vu_queue_map_desc() which should be independent with vu_queue_pop(); Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu Reviewed-by: Marc-André Lureau --- contrib/libvhost-user/libvhost-user.c | 88 --- 1 file changed, 51 insertions(+), 37

[Qemu-devel] [PATCH v3 for-4.0 2/7] vhost-user: Support providing shared memory to backend

2019-01-03 Thread elohimes
From: Xie Yongji This patch introduces two new messages VHOST_USER_GET_SHM_SIZE and VHOST_USER_SET_SHM_FD to support providing shared memory to backend. Firstly, qemu uses VHOST_USER_GET_SHM_SIZE to get the required size of shared memory from backend. Then, qemu allocates memory and sends them

[Qemu-devel] [PATCH v3 for-4.0 0/7] vhost-user-blk: Add support for backend reconnecting

2019-01-03 Thread elohimes
From: Xie Yongji This patchset is aimed at supporting qemu to reconnect vhost-user-blk backend after vhost-user-blk backend crash or restart. The patch 1 uses exisiting wait/nowait options to make QEMU not do a connect on client sockets during initialization of the chardev. The patch 2

[Qemu-devel] [PATCH v3 for-4.0 4/7] libvhost-user: Support recording inflight I/O in shared memory

2019-01-03 Thread elohimes
From: Xie Yongji This patch adds support for VHOST_USER_GET_SHM_SIZE and VHOST_USER_SET_SHM_FD message to get shared memory from qemu. Then we maintain a "bitmap" of all descriptors in the shared memory for each queue to record inflight I/O. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu

[Qemu-devel] [PATCH v2 for-4.0 6/7] vhost-user-blk: Add support to reconnect backend

2018-12-18 Thread elohimes
From: Xie Yongji Since we now support the message VHOST_USER_GET_SHM_SIZE and VHOST_USER_SET_SHM_FD. The backend is able to restart safely because it can record inflight I/O in shared memory. This patch allows qemu to reconnect the backend after connection closed. Signed-off-by: Xie Yongji

[Qemu-devel] [PATCH v2 for-4.0 5/7] vhost-user-blk: Add support to provide shared memory to backend

2018-12-18 Thread elohimes
From: Xie Yongji This patch add supports for vhost-user-blk device to provide shared memory to backend. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/block/vhost-user-blk.c | 26 ++ include/hw/virtio/vhost-user-blk.h | 1 + 2 files changed, 27

[Qemu-devel] [PATCH v2 for-4.0 3/7] libvhost-user: Introduce vu_queue_map_desc()

2018-12-18 Thread elohimes
From: Xie Yongji Introduce vu_queue_map_desc() which should be independent with vu_queue_pop(); Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu Reviewed-by: Marc-André Lureau --- contrib/libvhost-user/libvhost-user.c | 88 --- 1 file changed, 51 insertions(+), 37

[Qemu-devel] [PATCH v2 for-4.0 7/7] contrib/vhost-user-blk: enable inflight I/O recording

2018-12-18 Thread elohimes
From: Xie Yongji This patch enables inflight I/O recording for vhost-user-blk backend so that we could restart it safely. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- contrib/vhost-user-blk/vhost-user-blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[Qemu-devel] [PATCH v2 for-4.0 1/7] chardev: Add disconnected option for chardev socket

2018-12-18 Thread elohimes
From: Xie Yongji New option "disconnected" is added to init the chardev socket in disconnected state. Then we can use qemu_chr_fe_wait_connected() to connect when necessary. Now it would be used for unix domain socket of vhost-user-blk device to support reconnect. Suggested-by: Yury Kotov

[Qemu-devel] [PATCH v2 for-4.0 4/7] libvhost-user: Support recording inflight I/O in shared memory

2018-12-18 Thread elohimes
From: Xie Yongji This patch adds support for VHOST_USER_GET_SHM_SIZE and VHOST_USER_SET_SHM_FD message to get shared memory from qemu. Then we maintain a "bitmap" of all descriptors in the shared memory for each queue to record inflight I/O. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu

[Qemu-devel] [PATCH v2 for-4.0 2/7] vhost-user: Support providing shared memory to backend

2018-12-18 Thread elohimes
From: Xie Yongji This patch introduces two new messages VHOST_USER_GET_SHM_SIZE and VHOST_USER_SET_SHM_FD to support providing shared memory to backend. Firstly, qemu uses VHOST_USER_GET_SHM_SIZE to get the required size of shared memory from backend. Then, qemu allocates memory and sends them

[Qemu-devel] [PATCH v2 for-4.0 0/7] vhost-user-blk: Add support for backend reconnecting

2018-12-18 Thread elohimes
From: Xie Yongji This patchset is aimed at supporting qemu to reconnect vhost-user-blk backend after vhost-user-blk backend crash or restart. The patch 1 adds a "disconnected" option to init the chardev socket in disconnected state. The patch 2 introduces two new messages

[Qemu-devel] [PATCH for-4.0 6/6] contrib/vhost-user-blk: enable inflight I/O recording

2018-12-05 Thread elohimes
From: Xie Yongji This patch tells qemu that we now support inflight I/O recording so that qemu could offer shared memory to it. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- contrib/vhost-user-blk/vhost-user-blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[Qemu-devel] [PATCH for-4.0 2/6] vhost-user: Add shared memory to record inflight I/O

2018-12-05 Thread elohimes
From: Xie Yongji This introduces a new message VHOST_USER_SET_VRING_INFLIGHT to support offering shared memory to backend to record its inflight I/O. With this new message, the backend is able to restart without missing I/O which would cause I/O hung for block device. Signed-off-by: Xie Yongji

[Qemu-devel] [PATCH for-4.0 3/6] libvhost-user: Introduce vu_queue_map_desc()

2018-12-05 Thread elohimes
From: Xie Yongji Introduce vu_queue_map_desc() which should be independent with vu_queue_pop(); Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- contrib/libvhost-user/libvhost-user.c | 86 +++ 1 file changed, 49 insertions(+), 37 deletions(-) diff --git

[Qemu-devel] [PATCH for-4.0 4/6] libvhost-user: Support recording inflight I/O in shared memory

2018-12-05 Thread elohimes
From: Xie Yongji This patch adds support for VHOST_USER_SET_VRING_INFLIGHT message. Now we maintain a "bitmap" of all descriptors in the shared memory for each queue. Then set it in vu_queue_pop() and clear it in vu_queue_push(); Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu ---

[Qemu-devel] [PATCH for-4.0 5/6] vhost-user-blk: Add support for reconnecting backend

2018-12-05 Thread elohimes
From: Xie Yongji Since the new message VHOST_USER_SET_VRING_INFLIGHT, the backend is able to restart safely. This patch allow qemu to reconnect the backend after connection closed. Signed-off-by: Xie Yongji Signed-off-by: Ni Xun Signed-off-by: Zhang Yu --- hw/block/vhost-user-blk.c

[Qemu-devel] [PATCH for-4.0 1/6] char-socket: Enable "wait" option for client mode

2018-12-05 Thread elohimes
From: Xie Yongji Now we attempt to connect asynchronously for "reconnect socket" during open(). But vhost-user device prefer a connected socket during initialization. That means we may still need to support sync connection during open() for the "reconnect socket". Signed-off-by: Xie Yongji

[Qemu-devel] [PATCH for-4.0 0/6] vhost-user-blk: Add support for backend reconnecting

2018-12-05 Thread elohimes
From: Xie Yongji This patchset is aimed at supporting qemu to reconnect vhost-user-blk backend after vhost-user-blk backend crash or restart. The patch 1 tries to implenment the sync connection for "reconnect socket". The patch 2 introduces a new message VHOST_USER_SET_VRING_INFLIGHT to