[PATCH v2 07/20] KVM: selftests: Actually deactivate the HVA-based shared_info cache in xen_shinfo_test
From: David Woodhouse
Date: Wed Nov 04 2026 - 21:47:07 EST
From: David Woodhouse <dwmw@xxxxxxxxxxxx>
The "deactivate by HVA" leg of juggle_shinfo_state() uses attribute
type KVM_XEN_ATTR_TYPE_SHARED_INFO with .u.shared_info.hva = 0. The
hva field shares a union with gfn, so this activates the shared_info
cache at guest GFN 0 — zero is not KVM_XEN_INVALID_GFN — instead of
deactivating it.
The juggle thread therefore cycles through an unintended fourth
state, with three consequences:
- Every "deactivation" splats wallclock data over guest frame 0.
- The HVA-based deactivation path is never tested at all.
- In the TEST_LOCKING_POLL_RACE phase, a SCHEDOP_poll which samples
the shared_info in this state finds evtchn_pending[0] bit 0 clear
(the real shared_info page has it set; frame 0 does not) and
blocks in kvm_vcpu_halt() — the only state in which that poll can
block, as a deactivated cache fails kvm_gpc_check() and reports
the port pending. If the timer event is then dropped, nothing
ever wakes the guest and the test hangs.
Use KVM_XEN_ATTR_TYPE_SHARED_INFO_HVA, where hva = 0 deactivates.
Fixes: 9397b5334af1 ("KVM: selftests: map Xen's shared_info page using HVA rather than GFN")
Reported-by: sashiko-bot@xxxxxxxxxx
Closes: https://lore.kernel.org/all/sashiko-outbox-177931@xxxxxxxxxx
Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
---
tools/testing/selftests/kvm/x86/xen_shinfo_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kvm/x86/xen_shinfo_test.c b/tools/testing/selftests/kvm/x86/xen_shinfo_test.c
index aaa414c677ad..fb3c834c7cb7 100644
--- a/tools/testing/selftests/kvm/x86/xen_shinfo_test.c
+++ b/tools/testing/selftests/kvm/x86/xen_shinfo_test.c
@@ -410,7 +410,7 @@ static void *juggle_shinfo_state(void *arg)
};
struct kvm_xen_hvm_attr cache_deactivate_hva = {
- .type = KVM_XEN_ATTR_TYPE_SHARED_INFO,
+ .type = KVM_XEN_ATTR_TYPE_SHARED_INFO_HVA,
.u.shared_info.hva = 0
};
--
2.43.0