summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2015-07-16 09:11:13 +0200
committerAlexander Graf <agraf@suse.de>2015-08-22 11:16:19 +0200
commit402813fe39db66e8f3be2a1b5b62dd664e33f6b8 (patch)
tree0aa0b6b1fc26316ce313bcfd74ef666a1b1298f3 /arch/powerpc/kvm
parentKVM: PPC: Book3S HV: Implement H_CLEAR_REF and H_CLEAR_MOD (diff)
downloadlinux-402813fe39db66e8f3be2a1b5b62dd664e33f6b8.tar.xz
linux-402813fe39db66e8f3be2a1b5b62dd664e33f6b8.zip
KVM: PPC: Book3S HV: Fix preempted vcore list locking
When a vcore gets preempted, we put it on the preempted vcore list for the current CPU. The runner task then calls schedule() and comes back some time later and takes itself off the list. We need to be careful to lock the list that it was put onto, which may not be the list for the current CPU since the runner task may have moved to another CPU. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm')
-rw-r--r--arch/powerpc/kvm/book3s_hv.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 6e3ef308b4c5..3d022766294a 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -1962,10 +1962,11 @@ static void kvmppc_vcore_preempt(struct kvmppc_vcore *vc)
static void kvmppc_vcore_end_preempt(struct kvmppc_vcore *vc)
{
- struct preempted_vcore_list *lp = this_cpu_ptr(&preempted_vcores);
+ struct preempted_vcore_list *lp;
kvmppc_core_end_stolen(vc);
if (!list_empty(&vc->preempt_list)) {
+ lp = &per_cpu(preempted_vcores, vc->pcpu);
spin_lock(&lp->lock);
list_del_init(&vc->preempt_list);
spin_unlock(&lp->lock);