From: Marc Zyngier Date: Sat, 28 May 2022 11:38:28 +0000 (+0100) Subject: KVM: arm64: Document why pause cannot be turned into a flag X-Git-Tag: v6.1-rc5~198^2~37^2~6^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0fa4a3137e943cd6acab386ff26cd8d5e94e9559;p=platform%2Fkernel%2Flinux-starfive.git KVM: arm64: Document why pause cannot be turned into a flag It would be tempting to turn the 'pause' state into a flag. However, this cannot easily be done as it is updated out of context, while all the flags expect to only be updated from the vcpu thread. Turning it into a flag would require to make all flag updates atomic, which isn't necessary desireable. Document this, and take this opportunity to move the field next to the flag sets, filling a hole in the vcpu structure. Reviewed-by: Fuad Tabba Reviewed-by: Reiji Watanabe Signed-off-by: Marc Zyngier --- diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index c6975ec..2cc42e1 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -342,6 +342,15 @@ struct kvm_vcpu_arch { u8 sflags; /* + * Don't run the guest (internal implementation need). + * + * Contrary to the flags above, this is set/cleared outside of + * a vcpu context, and thus cannot be mixed with the flags + * themselves (or the flag accesses need to be made atomic). + */ + bool pause; + + /* * We maintain more than a single set of debug registers to support * debugging the guest from the host and to maintain separate host and * guest state during world switches. vcpu_debug_state are the debug @@ -394,9 +403,6 @@ struct kvm_vcpu_arch { /* vcpu power state */ struct kvm_mp_state mp_state; - /* Don't run the guest (internal implementation need) */ - bool pause; - /* Cache some mmu pages needed inside spinlock regions */ struct kvm_mmu_memory_cache mmu_page_cache;