hw/virtio/vhost.c | 72 ++++++- tests/qtest/vhost-user-test.c | 395 +++++++++++++++++++++++++++++++++- 2 files changed, 452 insertions(+), 15 deletions(-)
Virtio-mem dynamic memslots are intentionally exposed as separate memory regions. If a guest places a vring part across two adjacent slots, a later memory update fails vhost ring verification because the complete ring part is not contained in one vhost memory region. Coalesce coherent adjacent sections only when a descriptor table, available ring, or used ring crosses their boundary. Unrelated unmergeable sections remain separate so they can still be updated independently. Patch 2 adds an end-to-end qtest reproducer using a fake vhost-user backend and virtio-mem dynamic memslots. It also verifies that a newly activated slot is not folded into the merge required by the crossing vring. Tested with the vhost-user/mem-slots/boundary qtest. Buglink: https://redhat.atlassian.net/browse/RHEL-146583 Alex Fishman (2): vhost: coalesce unmergeable sections across vring boundaries tests/qtest: Add vhost-user memslot boundary test hw/virtio/vhost.c | 72 ++++++- tests/qtest/vhost-user-test.c | 395 +++++++++++++++++++++++++++++++++- 2 files changed, 452 insertions(+), 15 deletions(-) base-commit: ff1d2d19d7e24893e2012d879f8e73077e17b9bd -- 2.52.0
On Wed, Sep 09, 2026 at 03:59:21PM +0300, Alex Fishman wrote: > Virtio-mem dynamic memslots are intentionally exposed as separate memory > regions. If a guest places a vring part across two adjacent slots, a later > memory update fails vhost ring verification because the complete ring part > is not contained in one vhost memory region. > > Coalesce coherent adjacent sections only when a descriptor table, > available ring, or used ring crosses their boundary. Unrelated > unmergeable sections remain separate so they can still be updated > independently. > > Patch 2 adds an end-to-end qtest reproducer using a fake vhost-user > backend and virtio-mem dynamic memslots. It also verifies that a newly > activated slot is not folded into the merge required by the crossing > vring. > > Tested with the vhost-user/mem-slots/boundary qtest. > > Buglink: https://redhat.atlassian.net/browse/RHEL-146583 > > Alex Fishman (2): > vhost: coalesce unmergeable sections across vring boundaries > tests/qtest: Add vhost-user memslot boundary test > > hw/virtio/vhost.c | 72 ++++++- > tests/qtest/vhost-user-test.c | 395 +++++++++++++++++++++++++++++++++- > 2 files changed, 452 insertions(+), 15 deletions(-) > > > base-commit: ff1d2d19d7e24893e2012d879f8e73077e17b9bd > -- > 2.52.0 I'm pretty sure a similar problem exists with hw/virtio/virtio.c's MemoryRegionCaches. If a vring spans virtio-mem dynamic memslots, then the MemoryRegionCache won't work because the memory range crosses MemoryRegions. Is it worth looking at that first (e.g. triggering the issue with a test case that uses a built-in VIRTIO device instead of a vhost-user device) before implementing a solution that is specific to vhost-user? Stefan
On Wed, Sep 16, 2026 at 10:59:03AM -0400, Stefan Hajnoczi wrote: > On Wed, Sep 09, 2026 at 03:59:21PM +0300, Alex Fishman wrote: > > Virtio-mem dynamic memslots are intentionally exposed as separate memory > > regions. If a guest places a vring part across two adjacent slots, a later > > memory update fails vhost ring verification because the complete ring part > > is not contained in one vhost memory region. > > > > Coalesce coherent adjacent sections only when a descriptor table, > > available ring, or used ring crosses their boundary. Unrelated > > unmergeable sections remain separate so they can still be updated > > independently. > > > > Patch 2 adds an end-to-end qtest reproducer using a fake vhost-user > > backend and virtio-mem dynamic memslots. It also verifies that a newly > > activated slot is not folded into the merge required by the crossing > > vring. > > > > Tested with the vhost-user/mem-slots/boundary qtest. > > > > Buglink: https://redhat.atlassian.net/browse/RHEL-146583 > > > > Alex Fishman (2): > > vhost: coalesce unmergeable sections across vring boundaries > > tests/qtest: Add vhost-user memslot boundary test > > > > hw/virtio/vhost.c | 72 ++++++- > > tests/qtest/vhost-user-test.c | 395 +++++++++++++++++++++++++++++++++- > > 2 files changed, 452 insertions(+), 15 deletions(-) > > > > > > base-commit: ff1d2d19d7e24893e2012d879f8e73077e17b9bd > > -- > > 2.52.0 > > I'm pretty sure a similar problem exists with hw/virtio/virtio.c's > MemoryRegionCaches. If a vring spans virtio-mem dynamic memslots, then > the MemoryRegionCache won't work because the memory range crosses > MemoryRegions. IIUC address_space_cache_init does not check unmergeable, so virtio doesn't have this problem. > Is it worth looking at that first (e.g. triggering the issue with a test > case that uses a built-in VIRTIO device instead of a vhost-user device) > before implementing a solution that is specific to vhost-user? > > Stefan
On Wed, Sep 16, 2026 at 11:10:00AM -0400, Michael S. Tsirkin wrote: > On Wed, Sep 16, 2026 at 10:59:03AM -0400, Stefan Hajnoczi wrote: > > On Wed, Sep 09, 2026 at 03:59:21PM +0300, Alex Fishman wrote: > > > Virtio-mem dynamic memslots are intentionally exposed as separate memory > > > regions. If a guest places a vring part across two adjacent slots, a later > > > memory update fails vhost ring verification because the complete ring part > > > is not contained in one vhost memory region. > > > > > > Coalesce coherent adjacent sections only when a descriptor table, > > > available ring, or used ring crosses their boundary. Unrelated > > > unmergeable sections remain separate so they can still be updated > > > independently. > > > > > > Patch 2 adds an end-to-end qtest reproducer using a fake vhost-user > > > backend and virtio-mem dynamic memslots. It also verifies that a newly > > > activated slot is not folded into the merge required by the crossing > > > vring. > > > > > > Tested with the vhost-user/mem-slots/boundary qtest. > > > > > > Buglink: https://redhat.atlassian.net/browse/RHEL-146583 > > > > > > Alex Fishman (2): > > > vhost: coalesce unmergeable sections across vring boundaries > > > tests/qtest: Add vhost-user memslot boundary test > > > > > > hw/virtio/vhost.c | 72 ++++++- > > > tests/qtest/vhost-user-test.c | 395 +++++++++++++++++++++++++++++++++- > > > 2 files changed, 452 insertions(+), 15 deletions(-) > > > > > > > > > base-commit: ff1d2d19d7e24893e2012d879f8e73077e17b9bd > > > -- > > > 2.52.0 > > > > I'm pretty sure a similar problem exists with hw/virtio/virtio.c's > > MemoryRegionCaches. If a vring spans virtio-mem dynamic memslots, then > > the MemoryRegionCache won't work because the memory range crosses > > MemoryRegions. > > IIUC address_space_cache_init does not check unmergeable, so virtio > doesn't have this problem. You are right: address_space_cache_init() -> flatview_extend_translation() extends cache->ptr across active memslots. flatview_extend_translation() effectively merges the MemoryRegionSections whereas vhost.c's MemoryListener does not! Stefan
On Wed, Sep 09, 2026 at 03:59:21PM +0300, Alex Fishman wrote: > Virtio-mem dynamic memslots are intentionally exposed as separate memory > regions. If a guest places a vring part across two adjacent slots, a later > memory update fails vhost ring verification because the complete ring part > is not contained in one vhost memory region. when does this happen? > Coalesce coherent adjacent sections only when a descriptor table, > available ring, or used ring crosses their boundary. Unrelated > unmergeable sections remain separate so they can still be updated > independently. > > Patch 2 adds an end-to-end qtest reproducer using a fake vhost-user > backend and virtio-mem dynamic memslots. It also verifies that a newly > activated slot is not folded into the merge required by the crossing > vring. > > Tested with the vhost-user/mem-slots/boundary qtest. > > Buglink: https://redhat.atlassian.net/browse/RHEL-146583 > > Alex Fishman (2): > vhost: coalesce unmergeable sections across vring boundaries > tests/qtest: Add vhost-user memslot boundary test > > hw/virtio/vhost.c | 72 ++++++- > tests/qtest/vhost-user-test.c | 395 +++++++++++++++++++++++++++++++++- > 2 files changed, 452 insertions(+), 15 deletions(-) > > > base-commit: ff1d2d19d7e24893e2012d879f8e73077e17b9bd > -- > 2.52.0
https://redhat.atlassian.net/browse/RHEL-146583 Windows guests when hotplugging memory On Wed, Sep 9, 2026 at 4:01 PM Michael S. Tsirkin <mst@redhat.com> wrote: > On Wed, Sep 09, 2026 at 03:59:21PM +0300, Alex Fishman wrote: > > Virtio-mem dynamic memslots are intentionally exposed as separate memory > > regions. If a guest places a vring part across two adjacent slots, a > later > > memory update fails vhost ring verification because the complete ring > part > > is not contained in one vhost memory region. > > when does this happen? > > > Coalesce coherent adjacent sections only when a descriptor table, > > available ring, or used ring crosses their boundary. Unrelated > > unmergeable sections remain separate so they can still be updated > > independently. > > > > Patch 2 adds an end-to-end qtest reproducer using a fake vhost-user > > backend and virtio-mem dynamic memslots. It also verifies that a newly > > activated slot is not folded into the merge required by the crossing > > vring. > > > > Tested with the vhost-user/mem-slots/boundary qtest. > > > > Buglink: https://redhat.atlassian.net/browse/RHEL-146583 > > > > Alex Fishman (2): > > vhost: coalesce unmergeable sections across vring boundaries > > tests/qtest: Add vhost-user memslot boundary test > > > > hw/virtio/vhost.c | 72 ++++++- > > tests/qtest/vhost-user-test.c | 395 +++++++++++++++++++++++++++++++++- > > 2 files changed, 452 insertions(+), 15 deletions(-) > > > > > > base-commit: ff1d2d19d7e24893e2012d879f8e73077e17b9bd > > -- > > 2.52.0 > >
© 2016 - 2026 Red Hat, Inc.