WSL2-Linux-Kernel/arch/powerpc/kvm
Paul Mackerras 5390e7fa84 KVM: PPC: Book3S HV: Don't take kvm->lock around kvm_for_each_vcpu
[ Upstream commit 5a3f49364c ]

Currently the HV KVM code takes the kvm->lock around calls to
kvm_for_each_vcpu() and kvm_get_vcpu_by_id() (which can call
kvm_for_each_vcpu() internally).  However, that leads to a lock
order inversion problem, because these are called in contexts where
the vcpu mutex is held, but the vcpu mutexes nest within kvm->lock
according to Documentation/virtual/kvm/locking.txt.  Hence there
is a possibility of deadlock.

To fix this, we simply don't take the kvm->lock mutex around these
calls.  This is safe because the implementations of kvm_for_each_vcpu()
and kvm_get_vcpu_by_id() have been designed to be able to be called
locklessly.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-06-22 08:16:18 +02:00
..
Kconfig
Makefile
book3s.c KVM: PPC: Book3S: Use new mutex to synchronize access to rtas token list 2019-06-22 08:16:17 +02:00
book3s.h
book3s_32_mmu.c
book3s_32_mmu_host.c
book3s_32_sr.S
book3s_64_mmu.c
book3s_64_mmu_host.c
book3s_64_mmu_hv.c KVM: PPC: Book3S HV: Don't truncate HPTE index in xlate function 2018-10-10 08:54:19 +02:00
book3s_64_mmu_radix.c KVM: PPC: Book3S HV: Fix handling of large pages in radix page fault handler 2018-05-16 10:10:31 +02:00
book3s_64_slb.S
book3s_64_vio.c KVM: PPC: Check if IOMMU page is contained in the pinned physical page 2018-07-28 07:55:41 +02:00
book3s_64_vio_hv.c KVM: PPC: Check if IOMMU page is contained in the pinned physical page 2018-07-28 07:55:41 +02:00
book3s_emulate.c
book3s_exports.c
book3s_hv.c KVM: PPC: Book3S HV: Don't take kvm->lock around kvm_for_each_vcpu 2019-06-22 08:16:18 +02:00
book3s_hv_builtin.c
book3s_hv_hmi.c
book3s_hv_interrupts.S
book3s_hv_ras.c
book3s_hv_rm_mmu.c
book3s_hv_rm_xics.c
book3s_hv_rm_xive.c
book3s_hv_rmhandlers.S KVM: PPC: Book3S HV: Fix trap number return from __kvmppc_vcore_entry 2018-05-16 10:10:25 +02:00
book3s_interrupts.S
book3s_mmu_hpte.c
book3s_paired_singles.c
book3s_pr.c
book3s_pr_papr.c
book3s_rmhandlers.S
book3s_rtas.c KVM: PPC: Book3S: Use new mutex to synchronize access to rtas token list 2019-06-22 08:16:17 +02:00
book3s_segment.S
book3s_xics.c
book3s_xics.h
book3s_xive.c KVM: PPC: Book3S HV: XIVE: Do not clear IRQ data of passthrough interrupts 2019-06-09 09:18:16 +02:00
book3s_xive.h
book3s_xive_template.c
booke.c
booke.h
booke_emulate.c
booke_interrupts.S
bookehv_interrupts.S powerpc/fsl: Flush branch predictor when entering KVM 2019-04-03 06:25:14 +02:00
e500.c
e500.h
e500_emulate.c powerpc/fsl: Emulate SPRN_BUCSR register 2019-04-03 06:25:14 +02:00
e500_mmu.c
e500_mmu_host.c
e500_mmu_host.h
e500mc.c
emulate.c
emulate_loadstore.c
fpu.S
irq.h
mpic.c
powerpc.c KVM: s390: Do not report unusabled IDs via KVM_CAP_MAX_VCPU_ID 2019-06-09 09:18:16 +02:00
timing.c
timing.h
trace.h KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE 2018-12-01 09:42:53 +01:00
trace_book3s.h
trace_booke.h KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE 2018-12-01 09:42:53 +01:00
trace_hv.h KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE 2018-12-01 09:42:53 +01:00
trace_pr.h KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE 2018-12-01 09:42:53 +01:00