Thread (24 messages) 24 messages, 4 authors, 10h ago

Re: [PATCH v2 1/7] KVM: arm64: Move OUTSIDE_GUEST_MODE publication past context being saved

flat view

From: Fuad Tabba <fuad.tabba@linux.dev>
Date: 2026-09-29 13:00:03
Also in: kvmarm, stable

Hi Marc,

On Tue, 29 Sep 2026 10:35:42 +0100, Marc Zyngier [off-list ref] wrote:
[...]
Move the publication of OUTSIDE_GUEST_MODE to the point where the state
is actually written, and give this write release semantics to ensure the
correct ordering.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org

No Fixes: tag?

[...]
quoted hunk ↗ jump to hunk
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
[...]
quoted hunk ↗ jump to hunk
@@ -1386,6 +1385,12 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)

              kvm_arch_vcpu_ctxsync_fp(vcpu);

+             /*
+              * All the state has been synchronised, let advertise
+              * we're outside of the guest.
+              */
+             smp_store_release(&vcpu->mode, OUTSIDE_GUEST_MODE);
Pardon my atomics :), but what does the release pair with? On the halt
path, the only reader I can find is the cmpxchg() in
kvm_vcpu_exiting_guest_mode(), and the LPI-disable and MOVALL halts
then take ap_list_lock or irq_lock. Would WRITE_ONCE() be enough?

Should the early exit path (the kvm_vcpu_exit_request() bail-out) get
the same treatment? I think that's what Sashiko is trying to say in
the patch 5 review [1].

nit: "let advertise" -> "publish"?

Cheers,
/fuad

[1] https://sashiko.dev/#/patchset/20260929093548.3598547-1-maz%40kernel.org?part=5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help