Skip to content

Commit 0fa4a31

Browse files
author
Marc Zyngier
committed
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 <[email protected]> Reviewed-by: Reiji Watanabe <[email protected]> Signed-off-by: Marc Zyngier <[email protected]>
1 parent 54ddda9 commit 0fa4a31

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

arch/arm64/include/asm/kvm_host.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,15 @@ struct kvm_vcpu_arch {
341341
/* State flags for kernel bookkeeping, unused by the hypervisor code */
342342
u8 sflags;
343343

344+
/*
345+
* Don't run the guest (internal implementation need).
346+
*
347+
* Contrary to the flags above, this is set/cleared outside of
348+
* a vcpu context, and thus cannot be mixed with the flags
349+
* themselves (or the flag accesses need to be made atomic).
350+
*/
351+
bool pause;
352+
344353
/*
345354
* We maintain more than a single set of debug registers to support
346355
* debugging the guest from the host and to maintain separate host and
@@ -394,9 +403,6 @@ struct kvm_vcpu_arch {
394403
/* vcpu power state */
395404
struct kvm_mp_state mp_state;
396405

397-
/* Don't run the guest (internal implementation need) */
398-
bool pause;
399-
400406
/* Cache some mmu pages needed inside spinlock regions */
401407
struct kvm_mmu_memory_cache mmu_page_cache;
402408

0 commit comments

Comments
 (0)