Thread (4 messages) flat view 4 messages, 1 author, 2026-08-14
COLD31d

Revision v5 of 3 in this series.

Revisions (3)
  1. v5 current
  2. v6 [diff vs current]
  3. v7 [diff vs current]

[PATCH v5 0/3] vhost: fix device IOTLB feature lifecycle

From: Jia Jia <hidden>
Date: 2026-08-14 14:46:12
Also in: kvm, lkml, virtualization

Both vhost-vsock and vhost-net can leave the device IOTLB attached when
userspace clears VIRTIO_F_ACCESS_PLATFORM. They also replace an existing
IOTLB with a new empty table when a later feature update keeps
ACCESS_PLATFORM enabled, for example when updating logging.

The stale IOTLB can keep old translations active after a memory table
change, while replacing an existing table discards valid translations and
causes avoidable IOTLB misses.

Patch 1 makes device IOTLB initialization idempotent and adds a common
teardown helper. The helper detaches the table from every virtqueue,
resets metadata caches, clears queued IOTLB miss messages, and frees the
old table after the virtqueue handoff. It is a no-op when no device IOTLB
is installed.

Patches 2 and 3 use the common helper when vhost-vsock and vhost-net clear
ACCESS_PLATFORM. The backend-specific code continues to update
acked_features in its own virtqueue loop.

Changes since v4:
- move the existing-IOTLB check into vhost_init_device_iotlb()
- remove the vhost-vsock-specific keep-IOTLB patch
- add the corresponding ACCESS_PLATFORM teardown to vhost-net
- make vhost_clear_device_iotlb() handle an absent device IOTLB

Jia Jia (3):
  vhost: add helpers for device IOTLB lifecycle
  vhost/vsock: discard IOTLB when ACCESS_PLATFORM is cleared
  vhost/net: discard IOTLB when ACCESS_PLATFORM is cleared

 drivers/vhost/net.c   |  4 ++++
 drivers/vhost/vhost.c | 28 ++++++++++++++++++++++++++++
 drivers/vhost/vhost.h |  1 +
 drivers/vhost/vsock.c |  4 ++++
 4 files changed, 36 insertions(+), 3 deletions(-)

-- 
2.34.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help