[v2] vhost: cleanup resubmit info before inflight setup
Checks
Commit Message
This patch fixes a potential VM hang bug when the VM reboots after
vhost live recovery due to missing cleanup virtqueue resubmit info.
Specifically, if inflight IO that should be resubmitted during
the latest vhost reconnection has not been submitted yet while
VM rebooting, so GET_VRING_BASE would not wait for the inflight
IO, at this time the resubmit info has been. When the VM restarts,
SET_VRING_KICK will resubmit the inflight IO (If resubmit info
is not null, function set_vring_kick will return without updating
resubmit info).
It’s an error, any stale inflight IO should not be resubmitted
after the VM restart.
The solution is to clean up virtqueue resubmit info when function
set_inflight_fd before function set_vring_kick.
Fixes: ad0a4ae491fe ("vhost: checkout resubmit inflight information")
Cc: stable@dpdk.org
Signed-off-by: Haoqian He <haoqian.he@smartx.com>
---
v2: rewrite the commit message.
lib/vhost/vhost_user.c | 1 +
1 file changed, 1 insertion(+)
Comments
Recheck-request: iol-compile-amd64-testing
The DPDK Community Lab updated to the latest Alpine image yesterday, which
resulted in all Alpine builds failing. The failure is unrelated to your
patch, and this recheck should remove the fail on Patchwork, as we have
disabled Alpine testing for now.
> 2024年4月26日 19:09,Haoqian He <haoqian.he@smartx.com> 写道:
>
> This patch fixes a potential VM hang bug when the VM reboots after
> vhost live recovery due to missing cleanup virtqueue resubmit info.
>
> Specifically, if inflight IO that should be resubmitted during
> the latest vhost reconnection has not been submitted yet while
> VM rebooting, so GET_VRING_BASE would not wait for the inflight
> IO, at this time the resubmit info has been. When the VM restarts,
> SET_VRING_KICK will resubmit the inflight IO (If resubmit info
> is not null, function set_vring_kick will return without updating
> resubmit info).
>
> It’s an error, any stale inflight IO should not be resubmitted
> after the VM restart.
>
> The solution is to clean up virtqueue resubmit info when function
> set_inflight_fd before function set_vring_kick.
>
> Fixes: ad0a4ae491fe ("vhost: checkout resubmit inflight information")
> Cc: stable@dpdk.org
>
> Signed-off-by: Haoqian He <haoqian.he@smartx.com>
> ---
> v2: rewrite the commit message.
>
> lib/vhost/vhost_user.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index 414192500e..7c54afc5fb 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -1871,6 +1871,7 @@ vhost_user_set_inflight_fd(struct virtio_net **pdev,
> if (!vq)
> continue;
>
> + cleanup_vq_inflight(dev, vq);
> if (vq_is_packed(dev)) {
> vq->inflight_packed = addr;
> vq->inflight_packed->desc_num = queue_size;
> --
> 2.44.0
>
Ping.
Hi Maxime and Chenbo,
Do u have any suggestions for this patch?
Looking forward to hearing from u!
Thanks,
Haoqian
@@ -1871,6 +1871,7 @@ vhost_user_set_inflight_fd(struct virtio_net **pdev,
if (!vq)
continue;
+ cleanup_vq_inflight(dev, vq);
if (vq_is_packed(dev)) {
vq->inflight_packed = addr;
vq->inflight_packed->desc_num = queue_size;