[PATCH v2 0/2] vhost: set dirty log bits without pinning pages on x86
From: zhaoguohan
Date: Tue Nov 17 2026 - 03:34:10 EST
From: Khan Zhao <zhaoguohan@xxxxxxxxxx>
This replaces my v1 with Michael's set_bit_user() from the RFC thread,
plus the userspace test from v1 extended with a cross-page case.
Patch 2 adds tools/virtio/vhost_log_test
Median of five runs of "vhost_log_test --bench", which pushes batches
of 128 descriptors through vhost_test and reports the time per
descriptor (lower is better). "logging enabled" sets
VHOST_VRING_F_LOG, so each descriptor logs two used ring writes (the
used element and used->idx); data buffer logging (VHOST_F_LOG_ALL) is
not exercised. baseline is the same tree without this series.
baseline v2 change
logging disabled 155.04 158.78 +2.4%
logging enabled 287.58 189.20 -34.2%
Changes since v1:
- Patch 1 is now Michael's set_bit_user() with scoped user access,
replacing my cmpxchg loop and its GUP fallback. I added __label__
for the efault label so it stays local to the macro.
- Patch 2: add the cross-page case, use VHOST_PAGE_SIZE from the
UAPI, and print the bitmap when the cross-page check fails.
v1: https://lore.kernel.org/all/20261112085631.128819-1-zhaoguohan@xxxxxxxxxx/
RFC: https://lore.kernel.org/all/af7f05bf637337d35fdd10f3e0dbb5e39d7780e7.1794480795.git.mst@xxxxxxxxxx/
Khan Zhao (1):
tools/virtio: add a vhost dirty log test
Michael S. Tsirkin (1):
vhost: set dirty log bits without pinning pages on x86
arch/x86/include/asm/uaccess.h | 23 ++
drivers/vhost/vhost.c | 7 +
tools/virtio/.gitignore | 1 +
tools/virtio/Makefile | 7 +-
tools/virtio/vhost_log_test.c | 432 ++++++++++++++++++++++++++++++++
tools/virtio/vhost_log_test.rst | 61 +++++
6 files changed, 529 insertions(+), 2 deletions(-)
create mode 100644 tools/virtio/vhost_log_test.c
create mode 100644 tools/virtio/vhost_log_test.rst
base-commit: 666539eecdf4db623f5e3c3e55cf9f2dfad24aa4
--
2.43.0