diff mbox series

[RFC,23/27] vhost: unmap qemu's shadow virtqueues on sw live migration

Message ID 20201120185105.279030-24-eperezma@redhat.com (mailing list archive)
State New, archived
Headers show
Series vDPA software assisted live migration | expand

Commit Message

Eugenio Perez Martin Nov. 20, 2020, 6:51 p.m. UTC
Since vhost does not need to access it, it has no sense to keep it
mapped.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
 hw/virtio/vhost.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Stefano Garzarella Nov. 27, 2020, 3:29 p.m. UTC | #1
On Fri, Nov 20, 2020 at 07:51:01PM +0100, Eugenio Pérez wrote:
>Since vhost does not need to access it, it has no sense to keep it
>mapped.
>
>Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
>---
> hw/virtio/vhost.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
>index f640d4edf0..eebfac4455 100644
>--- a/hw/virtio/vhost.c
>+++ b/hw/virtio/vhost.c
>@@ -1124,6 +1124,7 @@ static int vhost_sw_live_migration_start(struct vhost_dev *dev)
>
>         dev->sw_lm_shadow_vq[idx] = vhost_sw_lm_shadow_vq(dev, idx);
>         event_notifier_set_handler(&vq->masked_notifier, vhost_handle_call);
>+        vhost_virtqueue_memory_unmap(dev, &dev->vqs[idx], true);

IIUC vhost_virtqueue_memory_unmap() is already called at the end of 
vhost_virtqueue_stop(), so we can skip this call, right?

>
>         vhost_vring_write_addr(dev->sw_lm_shadow_vq[idx], &addr);
>         r = dev->vhost_ops->vhost_set_vring_addr(dev, &addr);
>-- 2.18.4
>
Eugenio Perez Martin Nov. 30, 2020, 7:54 a.m. UTC | #2
On Fri, Nov 27, 2020 at 4:29 PM Stefano Garzarella <sgarzare@redhat.com> wrote:
>
> On Fri, Nov 20, 2020 at 07:51:01PM +0100, Eugenio Pérez wrote:
> >Since vhost does not need to access it, it has no sense to keep it
> >mapped.
> >
> >Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> >---
> > hw/virtio/vhost.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> >diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> >index f640d4edf0..eebfac4455 100644
> >--- a/hw/virtio/vhost.c
> >+++ b/hw/virtio/vhost.c
> >@@ -1124,6 +1124,7 @@ static int vhost_sw_live_migration_start(struct vhost_dev *dev)
> >
> >         dev->sw_lm_shadow_vq[idx] = vhost_sw_lm_shadow_vq(dev, idx);
> >         event_notifier_set_handler(&vq->masked_notifier, vhost_handle_call);
> >+        vhost_virtqueue_memory_unmap(dev, &dev->vqs[idx], true);
>
> IIUC vhost_virtqueue_memory_unmap() is already called at the end of
> vhost_virtqueue_stop(), so we can skip this call, right?
>

You are totally right Stefano, thanks for the catch!

> >
> >         vhost_vring_write_addr(dev->sw_lm_shadow_vq[idx], &addr);
> >         r = dev->vhost_ops->vhost_set_vring_addr(dev, &addr);
> >-- 2.18.4
> >
>
diff mbox series

Patch

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index f640d4edf0..eebfac4455 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1124,6 +1124,7 @@  static int vhost_sw_live_migration_start(struct vhost_dev *dev)
 
         dev->sw_lm_shadow_vq[idx] = vhost_sw_lm_shadow_vq(dev, idx);
         event_notifier_set_handler(&vq->masked_notifier, vhost_handle_call);
+        vhost_virtqueue_memory_unmap(dev, &dev->vqs[idx], true);
 
         vhost_vring_write_addr(dev->sw_lm_shadow_vq[idx], &addr);
         r = dev->vhost_ops->vhost_set_vring_addr(dev, &addr);