Skip to contentSkip to conversation

KVM: PPC: Book3s HV: Don't access runnable threads list without vcore lock

PATCH In review Paul Mackerras 1 participant 1 message Oct 15, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/8 KVM: PPC: Book3s HV: Don't access runnable threads list without vcore lock

There were a few places where we were traversing the list of runnable threads in a virtual core, i.e. vc->runnable_threads, without holding the vcore spinlock. This extends the places where we hold the vcore spinlock to cover everywhere that we traverse that list.

Since we possibly need to sleep inside kvmppc_book3s_hv_page_fault, this moves the call of it from kvmppc_handle_exit out to kvmppc_vcpu_run, where we don't hold the vcore lock.

In kvmppc_vcore_blocked, we don't actually need to check whether all vcpus are ceded and don't have any pending exceptions, since the caller has already done that. The caller (kvmppc_run_vcpu) wasn't actually checking for pending exceptions, so we add that.

The change of if to while in kvmppc_run_vcpu is to make sure that we never call kvmppc_remove_runnable() when the vcore state is RUNNING or EXITING.

---
 arch/powerpc/include/asm/kvm_asm.h |    1 +
 arch/powerpc/kvm/book3s_hv.c       |   67 ++++++++++++++++++------------------
 2 files changed, 34 insertions(+), 34 deletions(-)
arch/powerpc/include/asm/kvm_asm.h +1 -0
index 76fdcfe..aabcdba 100644
@@ -118,6 +118,7 @@
 
 #define RESUME_FLAG_NV          (1<<0)  /* Reload guest nonvolatile state? */
 #define RESUME_FLAG_HOST        (1<<1)  /* Resume host? */
+#define RESUME_FLAG_ARCH1	(1<<2)
 
 #define RESUME_GUEST            0
 #define RESUME_GUEST_NV         RESUME_FLAG_NV
arch/powerpc/kvm/book3s_hv.c +33 -34

168 lines not on this page · raw message

Signature · 1 line
1.7.10.4