qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 2/2] vhost-user: remove VirtQ notifier restore


From: Michael S. Tsirkin
Subject: Re: [PATCH v5 2/2] vhost-user: remove VirtQ notifier restore
Date: Tue, 19 Oct 2021 06:55:49 -0400

On Tue, Oct 19, 2021 at 03:57:43PM +0800, Xueming Li wrote:
> When vhost-user vdpa client restart, VQ notifier mmap address and MR
> become invalid, restore MR only is wrong.

wrong how? as opposed to what?

> vdpa client will set VQ
> notifier after reconnect.
> 
> This patch removes VQ notifier restore and related flags.

with the result that ...

> 
> Fixes: 44866521bd6e ("vhost-user: support registering external host 
> notifiers")
> Cc: qemu-stable@nongnu.org
> Cc: Yuwei Zhang <zhangyuwei.9149@bytedance.com>
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> ---
>  hw/virtio/vhost-user.c         | 19 +------------------
>  include/hw/virtio/vhost-user.h |  1 -
>  2 files changed, 1 insertion(+), 19 deletions(-)
> 
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index cfca1b9adc..cc33f4b042 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -1144,19 +1144,6 @@ static int vhost_user_set_vring_num(struct vhost_dev 
> *dev,
>      return vhost_set_vring(dev, VHOST_USER_SET_VRING_NUM, ring);
>  }
>  
> -static void vhost_user_host_notifier_restore(struct vhost_dev *dev,
> -                                             int queue_idx)
> -{
> -    struct vhost_user *u = dev->opaque;
> -    VhostUserHostNotifier *n = &u->user->notifier[queue_idx];
> -    VirtIODevice *vdev = dev->vdev;
> -
> -    if (n->addr && !n->set) {
> -        virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, true);
> -        n->set = true;
> -    }
> -}
> -
>  static void vhost_user_host_notifier_remove(struct vhost_dev *dev,
>                                              int queue_idx)
>  {
> @@ -1164,7 +1151,7 @@ static void vhost_user_host_notifier_remove(struct 
> vhost_dev *dev,
>      VhostUserHostNotifier *n = &u->user->notifier[queue_idx];
>      VirtIODevice *vdev = dev->vdev;
>  
> -    if (n->addr && n->set) {
> +    if (n->addr) {
>          virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, false);
>          if (!qemu_in_vcpu_thread()) { /* Avoid vCPU dead lock. */
>              /* Wait for VM threads accessing old flatview which contains 
> notifier. */
> @@ -1172,15 +1159,12 @@ static void vhost_user_host_notifier_remove(struct 
> vhost_dev *dev,
>          }
>          munmap(n->addr, qemu_real_host_page_size);
>          n->addr = NULL;
> -        n->set = false;
>      }
>  }
>  
>  static int vhost_user_set_vring_base(struct vhost_dev *dev,
>                                       struct vhost_vring_state *ring)
>  {
> -    vhost_user_host_notifier_restore(dev, ring->index);
> -
>      return vhost_set_vring(dev, VHOST_USER_SET_VRING_BASE, ring);
>  }
>  
> @@ -1540,7 +1524,6 @@ static int 
> vhost_user_slave_handle_vring_host_notifier(struct vhost_dev *dev,
>      }
>  
>      n->addr = addr;
> -    n->set = true;
>  
>      return 0;
>  }
> diff --git a/include/hw/virtio/vhost-user.h b/include/hw/virtio/vhost-user.h
> index a9abca3288..f6012b2078 100644
> --- a/include/hw/virtio/vhost-user.h
> +++ b/include/hw/virtio/vhost-user.h
> @@ -14,7 +14,6 @@
>  typedef struct VhostUserHostNotifier {
>      MemoryRegion mr;
>      void *addr;
> -    bool set;
>  } VhostUserHostNotifier;
>  
>  typedef struct VhostUserState {
> -- 
> 2.33.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]