aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/vhost/vhost.c
diff options
context:
space:
mode:
authorEric Auger <eric.auger@redhat.com>2023-01-17 10:15:18 -0500
committerMichael S. Tsirkin <mst@redhat.com>2023-01-27 06:18:41 -0500
commit9526f9a2b762af16be94a72aca5d65c677d28f50 (patch)
tree867ef7feabc780255ac03d53f2afc3b036513fdd /drivers/vhost/vhost.c
parentLinux 6.2-rc5 (diff)
downloadwireguard-linux-9526f9a2b762af16be94a72aca5d65c677d28f50.tar.xz
wireguard-linux-9526f9a2b762af16be94a72aca5d65c677d28f50.zip
vhost/net: Clear the pending messages when the backend is removed
When the vhost iotlb is used along with a guest virtual iommu and the guest gets rebooted, some MISS messages may have been recorded just before the reboot and spuriously executed by the virtual iommu after the reboot. As vhost does not have any explicit reset user API, VHOST_NET_SET_BACKEND looks a reasonable point where to clear the pending messages, in case the backend is removed. Export vhost_clear_msg() and call it in vhost_net_set_backend() when fd == -1. Signed-off-by: Eric Auger <eric.auger@redhat.com> Suggested-by: Jason Wang <jasowang@redhat.com> Fixes: 6b1e6cc7855b0 ("vhost: new device IOTLB API") Message-Id: <20230117151518.44725-3-eric.auger@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost/vhost.c')
-rw-r--r--drivers/vhost/vhost.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index cbe72bfd2f1f..43c9770b86e5 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -661,7 +661,7 @@ void vhost_dev_stop(struct vhost_dev *dev)
}
EXPORT_SYMBOL_GPL(vhost_dev_stop);
-static void vhost_clear_msg(struct vhost_dev *dev)
+void vhost_clear_msg(struct vhost_dev *dev)
{
struct vhost_msg_node *node, *n;
@@ -679,6 +679,7 @@ static void vhost_clear_msg(struct vhost_dev *dev)
spin_unlock(&dev->iotlb_lock);
}
+EXPORT_SYMBOL_GPL(vhost_clear_msg);
void vhost_dev_cleanup(struct vhost_dev *dev)
{