qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] vhost-user: add message for device reset
@ 2019-10-29 21:38 Raphael Norwitz
  2019-10-29 21:38 ` [PATCH 1/2] vhost-user: add VHOST_USER_RESET_DEVICE to reset devices Raphael Norwitz
  2019-10-29 21:38 ` [PATCH 2/2] vhost-user-scsi: reset the device if supported Raphael Norwitz
  0 siblings, 2 replies; 6+ messages in thread
From: Raphael Norwitz @ 2019-10-29 21:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Raphael Norwitz

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 1299 bytes --]

I have updated patches [1] sent by David Vrabel last year:

[1] https://lists.gnu.org/archive/html/qemu-devel/2018-03/msg05077.html

This change adds a new “reset device” feature to the vhost-user protocol
and a corresponding VHOST_USER_RESET_DEVICE message to notify vhost-user
backends when a virtio scsi device is reset by a guest.
It also adds support for this new feature/message in vhost-user-scsi.

Now, iff a vhost-user-scsi backend reports that it supports the new
"reset device" feature, QEMU will send a VHOST_USER_RESET_DEVICE
message when the guest resets the virtio device. Existing backends
will be unaffected.

Other types vhost-user backends can benefit from using this new message.
Those built using libvhost-user, for example, rely on the depricated
VHOST_USER_RESET_OWNER message to notify vhost-user backends about
device resets and can be updated to use this new supported message.

Raphael

Raphael Norwitz (2):
  vhost-user: add VHOST_USER_RESET_DEVICE to reset devices
  vhost-user-scsi: reset the device if supported

 docs/interop/vhost-user.rst | 15 +++++++++++++++
 hw/scsi/vhost-user-scsi.c   | 24 ++++++++++++++++++++++++
 hw/virtio/vhost-user.c      |  8 +++++++-
 3 files changed, 46 insertions(+), 1 deletion(-)

-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] vhost-user: add VHOST_USER_RESET_DEVICE to reset devices
  2019-10-29 21:38 [PATCH 0/2] vhost-user: add message for device reset Raphael Norwitz
@ 2019-10-29 21:38 ` Raphael Norwitz
  2019-11-06 11:36   ` Michael S. Tsirkin
  2019-12-13 10:08   ` Michael S. Tsirkin
  2019-10-29 21:38 ` [PATCH 2/2] vhost-user-scsi: reset the device if supported Raphael Norwitz
  1 sibling, 2 replies; 6+ messages in thread
From: Raphael Norwitz @ 2019-10-29 21:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael S. Tsirkin, David Vrabel, Raphael Norwitz

Add a VHOST_USER_RESET_DEVICE message which will reset the vhost user
backend. Disabling all rings, and resetting all internal state, ready
for the backend to be reinitialized.

A backend has to report it supports this features with the
VHOST_USER_PROTOCOL_F_RESET_DEVICE protocol feature bit. If it does
so, the new message is used instead of sending a RESET_OWNER which has
had inconsistent implementations.

Signed-off-by: David Vrabel <david.vrabel@nutanix.com>
Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
---
 docs/interop/vhost-user.rst | 15 +++++++++++++++
 hw/virtio/vhost-user.c      |  8 +++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst
index 7827b71..d213d4a 100644
--- a/docs/interop/vhost-user.rst
+++ b/docs/interop/vhost-user.rst
@@ -785,6 +785,7 @@ Protocol features
   #define VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD  10
   #define VHOST_USER_PROTOCOL_F_HOST_NOTIFIER  11
   #define VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD 12
+  #define VHOST_USER_PROTOCOL_F_RESET_DEVICE   13
 
 Master message types
 --------------------
@@ -1190,6 +1191,20 @@ Master message types
   ancillary data. The GPU protocol is used to inform the master of
   rendering state and updates. See vhost-user-gpu.rst for details.
 
+``VHOST_USER_RESET_DEVICE``
+  :id: 34
+  :equivalent ioctl: N/A
+  :master payload: N/A
+  :slave payload: N/A
+
+  Ask the vhost user backend to disable all rings and reset all
+  internal device state to the initial state, ready to be
+  reinitialized. The backend retains ownership of the device
+  throughout the reset operation.
+
+  Only valid if the ``VHOST_USER_PROTOCOL_F_RESET_DEVICE`` protocol
+  feature is set by the backend.
+
 Slave message types
 -------------------
 
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 02a9b25..d27a10f 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -58,6 +58,7 @@ enum VhostUserProtocolFeature {
     VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD = 10,
     VHOST_USER_PROTOCOL_F_HOST_NOTIFIER = 11,
     VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD = 12,
+    VHOST_USER_PROTOCOL_F_RESET_DEVICE = 13,
     VHOST_USER_PROTOCOL_F_MAX
 };
 
@@ -98,6 +99,7 @@ typedef enum VhostUserRequest {
     VHOST_USER_GET_INFLIGHT_FD = 31,
     VHOST_USER_SET_INFLIGHT_FD = 32,
     VHOST_USER_GPU_SET_SOCKET = 33,
+    VHOST_USER_RESET_DEVICE = 34,
     VHOST_USER_MAX
 } VhostUserRequest;
 
@@ -890,10 +892,14 @@ static int vhost_user_set_owner(struct vhost_dev *dev)
 static int vhost_user_reset_device(struct vhost_dev *dev)
 {
     VhostUserMsg msg = {
-        .hdr.request = VHOST_USER_RESET_OWNER,
         .hdr.flags = VHOST_USER_VERSION,
     };
 
+    msg.hdr.request = virtio_has_feature(dev->protocol_features,
+                                         VHOST_USER_PROTOCOL_F_RESET_DEVICE)
+        ? VHOST_USER_RESET_DEVICE
+        : VHOST_USER_RESET_OWNER;
+
     if (vhost_user_write(dev, &msg, NULL, 0) < 0) {
         return -1;
     }
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] vhost-user-scsi: reset the device if supported
  2019-10-29 21:38 [PATCH 0/2] vhost-user: add message for device reset Raphael Norwitz
  2019-10-29 21:38 ` [PATCH 1/2] vhost-user: add VHOST_USER_RESET_DEVICE to reset devices Raphael Norwitz
@ 2019-10-29 21:38 ` Raphael Norwitz
  1 sibling, 0 replies; 6+ messages in thread
From: Raphael Norwitz @ 2019-10-29 21:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Paolo Bonzini, Michael S. Tsirkin, David Vrabel,
	Raphael Norwitz

If the vhost-user-scsi backend supports the VHOST_USER_F_RESET_DEVICE
protocol feature, then the device can be reset when requested.

If this feature is not supported, do not try a reset as this will send
a VHOST_USER_RESET_OWNER that the backend is not expecting,
potentially putting into an inoperable state.

Signed-off-by: David Vrabel <david.vrabel@nutanix.com>
Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
---
 hw/scsi/vhost-user-scsi.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c
index 6a6c15d..23f972d 100644
--- a/hw/scsi/vhost-user-scsi.c
+++ b/hw/scsi/vhost-user-scsi.c
@@ -39,6 +39,10 @@ static const int user_feature_bits[] = {
     VHOST_INVALID_FEATURE_BIT
 };
 
+enum VhostUserProtocolFeature {
+    VHOST_USER_PROTOCOL_F_RESET_DEVICE = 13,
+};
+
 static void vhost_user_scsi_set_status(VirtIODevice *vdev, uint8_t status)
 {
     VHostUserSCSI *s = (VHostUserSCSI *)vdev;
@@ -62,6 +66,25 @@ static void vhost_user_scsi_set_status(VirtIODevice *vdev, uint8_t status)
     }
 }
 
+static void vhost_user_scsi_reset(VirtIODevice *vdev)
+{
+    VHostSCSICommon *vsc = VHOST_SCSI_COMMON(vdev);
+    struct vhost_dev *dev = &vsc->dev;
+
+    /*
+     * Historically, reset was not implemented so only reset devices
+     * that are expecting it.
+     */
+    if (!virtio_has_feature(dev->protocol_features,
+                            VHOST_USER_PROTOCOL_F_RESET_DEVICE)) {
+        return;
+    }
+
+    if (dev->vhost_ops->vhost_reset_device) {
+        dev->vhost_ops->vhost_reset_device(dev);
+    }
+}
+
 static void vhost_dummy_handle_output(VirtIODevice *vdev, VirtQueue *vq)
 {
 }
@@ -182,6 +205,7 @@ static void vhost_user_scsi_class_init(ObjectClass *klass, void *data)
     vdc->get_features = vhost_scsi_common_get_features;
     vdc->set_config = vhost_scsi_common_set_config;
     vdc->set_status = vhost_user_scsi_set_status;
+    vdc->reset = vhost_user_scsi_reset;
     fwc->get_dev_path = vhost_scsi_common_get_fw_dev_path;
 }
 
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] vhost-user: add VHOST_USER_RESET_DEVICE to reset devices
  2019-10-29 21:38 ` [PATCH 1/2] vhost-user: add VHOST_USER_RESET_DEVICE to reset devices Raphael Norwitz
@ 2019-11-06 11:36   ` Michael S. Tsirkin
  2019-12-13  7:47     ` Raphael Norwitz
  2019-12-13 10:08   ` Michael S. Tsirkin
  1 sibling, 1 reply; 6+ messages in thread
From: Michael S. Tsirkin @ 2019-11-06 11:36 UTC (permalink / raw)
  To: Raphael Norwitz; +Cc: David Vrabel, qemu-devel

On Tue, Oct 29, 2019 at 05:38:02PM -0400, Raphael Norwitz wrote:
> Add a VHOST_USER_RESET_DEVICE message which will reset the vhost user
> backend. Disabling all rings, and resetting all internal state, ready
> for the backend to be reinitialized.
> 
> A backend has to report it supports this features with the
> VHOST_USER_PROTOCOL_F_RESET_DEVICE protocol feature bit. If it does
> so, the new message is used instead of sending a RESET_OWNER which has
> had inconsistent implementations.
> 
> Signed-off-by: David Vrabel <david.vrabel@nutanix.com>
> Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com>

Looks ok, pls ping me after the release to apply this.
> ---
>  docs/interop/vhost-user.rst | 15 +++++++++++++++
>  hw/virtio/vhost-user.c      |  8 +++++++-
>  2 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst
> index 7827b71..d213d4a 100644
> --- a/docs/interop/vhost-user.rst
> +++ b/docs/interop/vhost-user.rst
> @@ -785,6 +785,7 @@ Protocol features
>    #define VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD  10
>    #define VHOST_USER_PROTOCOL_F_HOST_NOTIFIER  11
>    #define VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD 12
> +  #define VHOST_USER_PROTOCOL_F_RESET_DEVICE   13
>  
>  Master message types
>  --------------------
> @@ -1190,6 +1191,20 @@ Master message types
>    ancillary data. The GPU protocol is used to inform the master of
>    rendering state and updates. See vhost-user-gpu.rst for details.
>  
> +``VHOST_USER_RESET_DEVICE``
> +  :id: 34
> +  :equivalent ioctl: N/A
> +  :master payload: N/A
> +  :slave payload: N/A
> +
> +  Ask the vhost user backend to disable all rings and reset all
> +  internal device state to the initial state, ready to be
> +  reinitialized. The backend retains ownership of the device
> +  throughout the reset operation.
> +
> +  Only valid if the ``VHOST_USER_PROTOCOL_F_RESET_DEVICE`` protocol
> +  feature is set by the backend.
> +
>  Slave message types
>  -------------------
>  
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index 02a9b25..d27a10f 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -58,6 +58,7 @@ enum VhostUserProtocolFeature {
>      VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD = 10,
>      VHOST_USER_PROTOCOL_F_HOST_NOTIFIER = 11,
>      VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD = 12,
> +    VHOST_USER_PROTOCOL_F_RESET_DEVICE = 13,
>      VHOST_USER_PROTOCOL_F_MAX
>  };
>  
> @@ -98,6 +99,7 @@ typedef enum VhostUserRequest {
>      VHOST_USER_GET_INFLIGHT_FD = 31,
>      VHOST_USER_SET_INFLIGHT_FD = 32,
>      VHOST_USER_GPU_SET_SOCKET = 33,
> +    VHOST_USER_RESET_DEVICE = 34,
>      VHOST_USER_MAX
>  } VhostUserRequest;
>  
> @@ -890,10 +892,14 @@ static int vhost_user_set_owner(struct vhost_dev *dev)
>  static int vhost_user_reset_device(struct vhost_dev *dev)
>  {
>      VhostUserMsg msg = {
> -        .hdr.request = VHOST_USER_RESET_OWNER,
>          .hdr.flags = VHOST_USER_VERSION,
>      };
>  
> +    msg.hdr.request = virtio_has_feature(dev->protocol_features,
> +                                         VHOST_USER_PROTOCOL_F_RESET_DEVICE)
> +        ? VHOST_USER_RESET_DEVICE
> +        : VHOST_USER_RESET_OWNER;
> +
>      if (vhost_user_write(dev, &msg, NULL, 0) < 0) {
>          return -1;
>      }
> -- 
> 1.8.3.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] vhost-user: add VHOST_USER_RESET_DEVICE to reset devices
  2019-11-06 11:36   ` Michael S. Tsirkin
@ 2019-12-13  7:47     ` Raphael Norwitz
  0 siblings, 0 replies; 6+ messages in thread
From: Raphael Norwitz @ 2019-12-13  7:47 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Wed, Nov 06, 2019 at 06:36:01AM -0500, Michael S. Tsirkin wrote:
> 
> On Tue, Oct 29, 2019 at 05:38:02PM -0400, Raphael Norwitz wrote:
> > Add a VHOST_USER_RESET_DEVICE message which will reset the vhost user
> > backend. Disabling all rings, and resetting all internal state, ready
> > for the backend to be reinitialized.
> > 
> > A backend has to report it supports this features with the
> > VHOST_USER_PROTOCOL_F_RESET_DEVICE protocol feature bit. If it does
> > so, the new message is used instead of sending a RESET_OWNER which has
> > had inconsistent implementations.
> > 
> > Signed-off-by: David Vrabel <david.vrabel@nutanix.com>
> > Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com>

Ping on this. 

> 
> Looks ok, pls ping me after the release to apply this.
> > ---
> >  docs/interop/vhost-user.rst | 15 +++++++++++++++
> >  hw/virtio/vhost-user.c      |  8 +++++++-
> >  2 files changed, 22 insertions(+), 1 deletion(-)
> > 
> > diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst
> > index 7827b71..d213d4a 100644
> > --- a/docs/interop/vhost-user.rst
> > +++ b/docs/interop/vhost-user.rst
> > @@ -785,6 +785,7 @@ Protocol features
> >    #define VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD  10
> >    #define VHOST_USER_PROTOCOL_F_HOST_NOTIFIER  11
> >    #define VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD 12
> > +  #define VHOST_USER_PROTOCOL_F_RESET_DEVICE   13
> >  
> >  Master message types
> >  --------------------
> > @@ -1190,6 +1191,20 @@ Master message types
> >    ancillary data. The GPU protocol is used to inform the master of
> >    rendering state and updates. See vhost-user-gpu.rst for details.
> >  
> > +``VHOST_USER_RESET_DEVICE``
> > +  :id: 34
> > +  :equivalent ioctl: N/A
> > +  :master payload: N/A
> > +  :slave payload: N/A
> > +
> > +  Ask the vhost user backend to disable all rings and reset all
> > +  internal device state to the initial state, ready to be
> > +  reinitialized. The backend retains ownership of the device
> > +  throughout the reset operation.
> > +
> > +  Only valid if the ``VHOST_USER_PROTOCOL_F_RESET_DEVICE`` protocol
> > +  feature is set by the backend.
> > +
> >  Slave message types
> >  -------------------
> >  
> > diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> > index 02a9b25..d27a10f 100644
> > --- a/hw/virtio/vhost-user.c
> > +++ b/hw/virtio/vhost-user.c
> > @@ -58,6 +58,7 @@ enum VhostUserProtocolFeature {
> >      VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD = 10,
> >      VHOST_USER_PROTOCOL_F_HOST_NOTIFIER = 11,
> >      VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD = 12,
> > +    VHOST_USER_PROTOCOL_F_RESET_DEVICE = 13,
> >      VHOST_USER_PROTOCOL_F_MAX
> >  };
> >  
> > @@ -98,6 +99,7 @@ typedef enum VhostUserRequest {
> >      VHOST_USER_GET_INFLIGHT_FD = 31,
> >      VHOST_USER_SET_INFLIGHT_FD = 32,
> >      VHOST_USER_GPU_SET_SOCKET = 33,
> > +    VHOST_USER_RESET_DEVICE = 34,
> >      VHOST_USER_MAX
> >  } VhostUserRequest;
> >  
> > @@ -890,10 +892,14 @@ static int vhost_user_set_owner(struct vhost_dev *dev)
> >  static int vhost_user_reset_device(struct vhost_dev *dev)
> >  {
> >      VhostUserMsg msg = {
> > -        .hdr.request = VHOST_USER_RESET_OWNER,
> >          .hdr.flags = VHOST_USER_VERSION,
> >      };
> >  
> > +    msg.hdr.request = virtio_has_feature(dev->protocol_features,
> > +                                         VHOST_USER_PROTOCOL_F_RESET_DEVICE)
> > +        ? VHOST_USER_RESET_DEVICE
> > +        : VHOST_USER_RESET_OWNER;
> > +
> >      if (vhost_user_write(dev, &msg, NULL, 0) < 0) {
> >          return -1;
> >      }
> > -- 
> > 1.8.3.1
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] vhost-user: add VHOST_USER_RESET_DEVICE to reset devices
  2019-10-29 21:38 ` [PATCH 1/2] vhost-user: add VHOST_USER_RESET_DEVICE to reset devices Raphael Norwitz
  2019-11-06 11:36   ` Michael S. Tsirkin
@ 2019-12-13 10:08   ` Michael S. Tsirkin
  1 sibling, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2019-12-13 10:08 UTC (permalink / raw)
  To: Raphael Norwitz; +Cc: David Vrabel, qemu-devel

On Tue, Oct 29, 2019 at 05:38:02PM -0400, Raphael Norwitz wrote:
> Add a VHOST_USER_RESET_DEVICE message which will reset the vhost user
> backend. Disabling all rings, and resetting all internal state, ready
> for the backend to be reinitialized.
> 
> A backend has to report it supports this features with the
> VHOST_USER_PROTOCOL_F_RESET_DEVICE protocol feature bit. If it does
> so, the new message is used instead of sending a RESET_OWNER which has
> had inconsistent implementations.
> 
> Signed-off-by: David Vrabel <david.vrabel@nutanix.com>
> Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com>

Looks good to me, I'll queue it for merge after the release. If possible
please ping me after the release to help make sure it didn't get
dropped. Same for 2/2.


> ---
>  docs/interop/vhost-user.rst | 15 +++++++++++++++
>  hw/virtio/vhost-user.c      |  8 +++++++-
>  2 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst
> index 7827b71..d213d4a 100644
> --- a/docs/interop/vhost-user.rst
> +++ b/docs/interop/vhost-user.rst
> @@ -785,6 +785,7 @@ Protocol features
>    #define VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD  10
>    #define VHOST_USER_PROTOCOL_F_HOST_NOTIFIER  11
>    #define VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD 12
> +  #define VHOST_USER_PROTOCOL_F_RESET_DEVICE   13
>  
>  Master message types
>  --------------------
> @@ -1190,6 +1191,20 @@ Master message types
>    ancillary data. The GPU protocol is used to inform the master of
>    rendering state and updates. See vhost-user-gpu.rst for details.
>  
> +``VHOST_USER_RESET_DEVICE``
> +  :id: 34
> +  :equivalent ioctl: N/A
> +  :master payload: N/A
> +  :slave payload: N/A
> +
> +  Ask the vhost user backend to disable all rings and reset all
> +  internal device state to the initial state, ready to be
> +  reinitialized. The backend retains ownership of the device
> +  throughout the reset operation.
> +
> +  Only valid if the ``VHOST_USER_PROTOCOL_F_RESET_DEVICE`` protocol
> +  feature is set by the backend.
> +
>  Slave message types
>  -------------------
>  
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index 02a9b25..d27a10f 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -58,6 +58,7 @@ enum VhostUserProtocolFeature {
>      VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD = 10,
>      VHOST_USER_PROTOCOL_F_HOST_NOTIFIER = 11,
>      VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD = 12,
> +    VHOST_USER_PROTOCOL_F_RESET_DEVICE = 13,
>      VHOST_USER_PROTOCOL_F_MAX
>  };
>  
> @@ -98,6 +99,7 @@ typedef enum VhostUserRequest {
>      VHOST_USER_GET_INFLIGHT_FD = 31,
>      VHOST_USER_SET_INFLIGHT_FD = 32,
>      VHOST_USER_GPU_SET_SOCKET = 33,
> +    VHOST_USER_RESET_DEVICE = 34,
>      VHOST_USER_MAX
>  } VhostUserRequest;
>  
> @@ -890,10 +892,14 @@ static int vhost_user_set_owner(struct vhost_dev *dev)
>  static int vhost_user_reset_device(struct vhost_dev *dev)
>  {
>      VhostUserMsg msg = {
> -        .hdr.request = VHOST_USER_RESET_OWNER,
>          .hdr.flags = VHOST_USER_VERSION,
>      };
>  
> +    msg.hdr.request = virtio_has_feature(dev->protocol_features,
> +                                         VHOST_USER_PROTOCOL_F_RESET_DEVICE)
> +        ? VHOST_USER_RESET_DEVICE
> +        : VHOST_USER_RESET_OWNER;
> +
>      if (vhost_user_write(dev, &msg, NULL, 0) < 0) {
>          return -1;
>      }
> -- 
> 1.8.3.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-12-13 10:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29 21:38 [PATCH 0/2] vhost-user: add message for device reset Raphael Norwitz
2019-10-29 21:38 ` [PATCH 1/2] vhost-user: add VHOST_USER_RESET_DEVICE to reset devices Raphael Norwitz
2019-11-06 11:36   ` Michael S. Tsirkin
2019-12-13  7:47     ` Raphael Norwitz
2019-12-13 10:08   ` Michael S. Tsirkin
2019-10-29 21:38 ` [PATCH 2/2] vhost-user-scsi: reset the device if supported Raphael Norwitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).