[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1704919215-91319-8-git-send-email-steven.sistare@oracle.com>
Date: Wed, 10 Jan 2024 12:40:09 -0800
From: Steve Sistare <steven.sistare@...cle.com>
To: virtualization@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Cc: "Michael S. Tsirkin" <mst@...hat.com>, Jason Wang <jasowang@...hat.com>,
Si-Wei Liu <si-wei.liu@...cle.com>,
Eugenio Perez Martin <eperezma@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Dragos Tatulea <dtatulea@...dia.com>, Eli Cohen <elic@...dia.com>,
Xie Yongji <xieyongji@...edance.com>,
Steve Sistare <steven.sistare@...cle.com>
Subject: [RFC V1 07/13] vhost-vdpa: flush workers on suspend
To pass ownership of a live vdpa device to a new process, the user
suspends the device, calls VHOST_NEW_OWNER to change the mm, and calls
VHOST_IOTLB_REMAP to change the user virtual addresses to match the new
mm. Flush workers in suspend to guarantee that no worker sees the new
mm and old VA in between.
Signed-off-by: Steve Sistare <steven.sistare@...cle.com>
---
drivers/vhost/vdpa.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 8fe1562d24af..9673e8e20d11 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -591,10 +591,14 @@ static long vhost_vdpa_suspend(struct vhost_vdpa *v)
{
struct vdpa_device *vdpa = v->vdpa;
const struct vdpa_config_ops *ops = vdpa->config;
+ struct vhost_dev *vdev = &v->vdev;
if (!ops->suspend)
return -EOPNOTSUPP;
+ if (vdev->use_worker)
+ vhost_dev_flush(vdev);
+
return ops->suspend(vdpa);
}
--
2.39.3
Powered by blists - more mailing lists