From: Siddharth Mishra <smish149@asu.edu>
To: Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <seanjc@google.com>
Cc: Shuah Khan <shuah@kernel.org>, Peter Xu <peterx@redhat.com>,
James Houghton <jthoughton@google.com>,
David Woodhouse <dwmw2@infradead.org>,
kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, Siddharth Mishra <smish149@asu.edu>
Subject: [PATCH 0/2] KVM: Fix lost dirty ring entries when a vCPU is preempted
Date: Mon, 23 Nov 2026 08:32:36 -0700 [thread overview]
Message-ID: <20261123153238.1036972-1-smish149@asu.edu> (raw)
A push to a vCPU's dirty ring can be interrupted by another push to the
same ring when the vCPU task is preempted, which leaves one entry
unwritten and makes userspace stop harvesting the ring. Patch 1 fixes
kvm_dirty_ring_push(), patch 2 adds a regression test.
Found while fuzzing. An AI tool helped with the analysis and the patches.
The series is independent of James' series that changes the same
function, and applies with or without it:
https://lore.kernel.org/all/20261117212913.3634487-1-jthoughton@google.com/
Tested on Intel with PML, in a nested VM on mainline at
commit 4843f6873f7c ("Merge tag 'sysctl-7.04-fixes-rc4' of
git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl") and on the
v7.2.8 host:
- Patch 2 fails within seconds without patch 1 (11 of 12 runs), and
passes with it (0 failures in 15 runs).
- All x86 and common KVM selftests, with PREEMPT, DEBUG_PREEMPT,
DEBUG_ATOMIC_SLEEP, PROVE_LOCKING, PROVE_RCU, DEBUG_PAGEALLOC,
SLUB_DEBUG, DEBUG_OBJECTS_RCU_HEAD, KVM_SMM and KVM_XEN: the same
results with and without the series. hardware_disable_test fails and
xen_shinfo_test triggers a lockdep "Invalid wait context" report in
kvm_xen_set_evtchn_fast() on both.
- The dirty logging tests with kvm_intel.pml=0: the same results with and
without the series.
- Builds with W=1: KVM_INTEL=m KVM_AMD=m KVM_WERROR=y, SMP=n,
allnoconfig, gcc allmodconfig and allyesconfig, clang allmodconfig, and
clang for arm64, riscv and loongarch.
- KVM-unit-tests (a2891d9) for x86 in the same nested VM: the same
results with and without the series. vmx_apicv_test times out and
vmx reports "Guest didn't run to completion" and a too high RDTSC to
VM-exit delta on both.
- sparse (84ec065) with C=2 on arch/x86/kvm/: no reports in
virt/kvm/dirty_ring.c.
Not tested: AMD, the Xen runstate path.
Siddharth Mishra (2):
KVM: Disable preemption while pushing to the dirty ring
KVM: selftests: Test dirty ring pushes from vCPU preemption
tools/testing/selftests/kvm/Makefile.kvm | 1 +
.../kvm/x86/dirty_ring_steal_time_test.c | 146 ++++++++++++++++++
virt/kvm/dirty_ring.c | 2 +
3 files changed, 149 insertions(+)
create mode 100644 tools/testing/selftests/kvm/x86/dirty_ring_steal_time_test.c
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
--
2.54.0
next reply other threads:[~2026-11-23 15:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 15:32 Siddharth Mishra [this message]
2026-11-23 15:32 ` [PATCH 1/2] KVM: Disable preemption while pushing to the dirty ring Siddharth Mishra
2026-11-23 18:55 ` James Houghton
2026-11-23 15:32 ` [PATCH 2/2] KVM: selftests: Test dirty ring pushes from vCPU preemption Siddharth Mishra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261123153238.1036972-1-smish149@asu.edu \
--to=smish149@asu.edu \
--cc=dwmw2@infradead.org \
--cc=jthoughton@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®