vhost-user: Slave crashes as Master unmaps vrings during guest reboot
PATCH 1/1 vhost-user: Slave crashes as Master unmaps vrings during guest reboot
Problem:
--------
If a guest has vhost-user enabled, then on reboot vhost_virtqueue_stop is invoked. This unmaps vring memory mappings. However, it will not give any indication to the underlying DPDK slave application about it. Therefore, a pollmode DPDK driver tries to read the ring to check for packets and segfaults.
Solution:
----------VHOST_USER_RESET_OWNER API is issued by QEMU so that DPDK slave application is informed that mappings will be soon gone so that it can take necessary steps.
Shesha Sreenivasamurthy (1):
vhost-user: Slave crashes as Master unmaps vrings during guest reboot
hw/virtio/vhost.c | 5 +++++ 1 file changed, 5 insertions(+)
Signature · 1 line
1.9.5 (Apple Git-50.3)
PATCH 1/1 vhost-user: Slave crashes as Master unmaps vrings during guest reboot
Send VHOST_USER_RESET_OWNER when the device is stopped.
--- hw/virtio/vhost.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/virtio/vhost.c +5 -0
@@ -1256,6 +1256,11 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev) hdev->vq_index + i); } +if (hdev->vhost_ops->vhost_reset_device (hdev) <0 ) { +fprintf (stderr,"vhost reset device %s failed\n" , vdev->name); +fflush (stderr); + } +vhost_log_put (hdev, true); hdev->started = false; hdev->log =NULL ;
Signature · 1 line
1.9.5 (Apple Git-50.3)
Quoted 7 lines · Shesha Sreenivasamurthy
Problem:
--------
If a guest has vhost-user enabled, then on rebootvhost_virtqueue_stopis invoked. This unmaps vring memory mappings. However, it will not give any indication to the underlying DPDK slave application about it. Therefore, a pollmode DPDK driver tries to read the ring to check for packets and segfaults.
The spec currently says:
Client must start ring upon receiving a kick (that is, detecting that file descriptor is readable) on the descriptor specified by VHOST_USER_SET_VRING_KICK, and stop ring upon receiving VHOST_USER_GET_VRING_BASE.
Why isn't this sufficient?
Quoted 14 lines
Solution:
----------VHOST_USER_RESET_OWNERAPI is issued by QEMU so that DPDK slave application is informed that mappings will be soon gone so that it can take necessary steps.Shesha Sreenivasamurthy (1):
vhost-user: Slave crashes as Master unmaps vrings during guest reboothw/virtio/vhost.c | 5 +++++ 1 file changed, 5 insertions(+)Signature · 1 line
1.9.5 (Apple Git-50.3)
Quoted 3 lines · Shesha Sreenivasamurthy
Send
VHOST_USER_RESET_OWNERwhen the device is stopped.Signed-off-by Shesha Sreenivasamurthy <[email protected]>
That's a bad commit log. A good one should describe why changes are made, not what they are (that can be seen from the change diff). The cover letter is no good for that, it
should just give some introduction in case of a large patchset.
I commented on the cover letter for now since that is where you put the motivation.
hw/virtio/vhost.c void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev) · line 1258
Quoted 12 lines
--- hw/virtio/vhost.c | 5 +++++ 1 file changed, 5 insertions(+)hw/virtio/vhost.c +0
-0@@ -1256,6 +1256,11 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev) hdev->vq_index + i); }
If rings keep going at this point then the index
retrieved above will be wrong, and we will not
be able to re-start the device.
hw/virtio/vhost.c void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev) · line 1263
Quoted 5 lines
hw/virtio/vhost.c +5
-0+if (hdev->vhost_ops->vhost_reset_device (hdev) <0 ) { +fprintf (stderr,"vhost reset device %s failed\n" , vdev->name); +fflush (stderr); + } +
Looks more or less like a revert of
commit 12b8cbac3c8243b3dd485aaebb82547aefa06adb Author: Yuanhan Liu <[email protected]> Date: Fri Nov 13 15:24:10 2015 +0800 vhost: don't send RESET_OWNER at stop
If you still think it's a good idea, pls
copy people signed on that patch.
Quoted 5 lines
hw/virtio/vhost.c +0
-0vhost_log_put (hdev, true); hdev->started = false; hdev->log =NULL ;Signature · 1 line
1.9.5 (Apple Git-50.3)
Got it. Thanks, I missed that line while reading the spec. Is docs/specs/vhost-user.txt the official spec ?
--
- Thanks
char * (*shesha) (uint64_t cache, uint8_t F00D)
{ return 0x0000C0DE; }
From: "Michael S. Tsirkin" <[email protected]<mailto:[email protected]>>
Date: Sunday, January 17, 2016 at 3:23 AM
To: Cisco Employee <[email protected]<mailto:[email protected]>>
Cc: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH] vhost-user: Slave crashes as Master unmaps vrings during guest reboot
On Fri, Jan 15, 2016 at 12:12:43PM -0800, Shesha Sreenivasamurthy wrote:
Problem:
--------
If a guest has vhost-user enabled, then on reboot vhost_virtqueue_stop is invoked. This unmaps vring memory mappings. However, it will not give any indication to the underlying DPDK slave application about it. Therefore, a pollmode DPDK driver tries to read the ring to check for packets and segfaults.
The spec currently says:
Client must start ring upon receiving a kick (that is, detecting that file descriptor is readable) on the descriptor specified by VHOST_USER_SET_VRING_KICK, and stop ring upon receiving VHOST_USER_GET_VRING_BASE.
Why isn't this sufficient?
Solution:
----------VHOST_USER_RESET_OWNER API is issued by QEMU so that DPDK slave application is informed that mappings will be soon gone so that it can take necessary steps.
Shesha Sreenivasamurthy (1):
vhost-user: Slave crashes as Master unmaps vrings during guest reboot
hw/virtio/vhost.c | 5 +++++ 1 file changed, 5 insertions(+)
--
1.9.5 (Apple Git-50.3)