OpenCloudOS-Kernel/arch/arm64/kvm
Marc Zyngier ef3691683d KVM: arm64: GICv4.1: Fix race with doorbell on VPE activation/deactivation
To save the vgic LPI pending state with GICv4.1, the VPEs must all be
unmapped from the ITSs so that the sGIC caches can be flushed.
The opposite is done once the state is saved.

This is all done by using the activate/deactivate irqdomain callbacks
directly from the vgic code. Crutially, this is done without holding
the irqdesc lock for the interrupts that represent the VPE. And these
callbacks are changing the state of the irqdesc. What could possibly
go wrong?

If a doorbell fires while we are messing with the irqdesc state,
it will acquire the lock and change the interrupt state concurrently.
Since we don't hole the lock, curruption occurs in on the interrupt
state. Oh well.

While acquiring the lock would fix this (and this was Shanker's
initial approach), this is still a layering violation we could do
without. A better approach is actually to free the VPE interrupt,
do what we have to do, and re-request it.

It is more work, but this usually happens only once in the lifetime
of the VM and we don't really care about this sort of overhead.

Fixes: f66b7b151e ("KVM: arm64: GICv4.1: Try to save VLPI state in save_pending_tables")
Reported-by: Shanker Donthineni <sdonthineni@nvidia.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230118022348.4137094-1-sdonthineni@nvidia.com
2023-01-21 11:02:19 +00:00
..
hyp KVM: arm64: Convert FSC_* over to ESR_ELx_FSC_* 2023-01-03 10:01:52 +00:00
vgic KVM: arm64: GICv4.1: Fix race with doorbell on VPE activation/deactivation 2023-01-21 11:02:19 +00:00
.gitignore
Kconfig KVM: arm64: Enable ring-based dirty memory tracking 2022-11-10 13:11:58 +00:00
Makefile KVM: arm64: Move nVHE stacktrace unwinding into its own compilation unit 2022-07-27 18:18:03 +01:00
arch_timer.c Merge branch kvm-arm64/burn-the-flags into kvmarm-master/next 2022-06-29 10:30:10 +01:00
arm.c KVM/arm64 updates for 6.2 2022-12-09 09:12:12 +01:00
debug.c Merge branch kvm-arm64/single-step-async-exception into kvmarm-master/next 2022-09-19 10:59:29 +01:00
fpsimd.c arm64/fp: Use a struct to pass data to fpsimd_bind_state_to_cpu() 2022-11-29 15:01:56 +00:00
guest.c KVM: arm64: Pass the actual page address to mte_clear_page_tags() 2023-01-21 11:02:19 +00:00
handle_exit.c KVM: arm64: Clear PSTATE.SS when the Software Step state was Active-pending 2022-09-19 10:48:53 +01:00
hypercalls.c KVM: arm64: Fix hypercall bitmap writeback when vcpus have already run 2022-05-16 17:40:48 +01:00
inject_fault.c KVM: arm64: Move vcpu PC/Exception flags to the input flag set 2022-06-10 09:54:34 +01:00
mmio.c KVM: arm64: Generalise VM features into a set of flags 2022-03-18 14:02:33 +00:00
mmu.c KVM: arm64: Convert FSC_* over to ESR_ELx_FSC_* 2023-01-03 10:01:52 +00:00
pkvm.c KVM: arm64: Return guest memory from EL2 via dedicated teardown memcache 2022-11-11 17:18:58 +00:00
pmu-emul.c KVM: arm64: PMU: Fix period computation for 64bit counters with 32bit overflow 2022-12-05 12:05:51 +00:00
pmu.c KVM: arm64: Pass pmu events to hyp via vcpu 2022-05-15 11:26:41 +01:00
psci.c Merge branch kvm-arm64/psci-suspend into kvmarm-master/next 2022-05-16 17:48:20 +01:00
pvtime.c
reset.c KVM: arm64: Consolidate stage-2 initialisation into a single function 2022-11-11 17:16:25 +00:00
stacktrace.c arm64: stacktrace: track hyp stacks in unwinder's address space 2022-09-09 12:30:08 +01:00
sys_regs.c KVM: arm64: PMU: Fix PMCR_EL0 reset value 2022-12-12 09:07:14 +00:00
sys_regs.h KVM: arm64: Add a visibility bit to ignore user writes 2022-09-14 11:36:16 +01:00
trace.h
trace_arm.h
trace_handle_exit.h
trng.c
va_layout.c arm64: alternatives: kvm: prepare for cap changes 2022-09-16 17:15:02 +01:00
vgic-sys-reg-v3.c KVM: arm64: vgic-v3: Convert userspace accessors over to FIELD_GET/FIELD_PREP 2022-07-17 11:55:33 +01:00
vmid.c KVM: arm64: Fix inconsistent indenting 2022-06-07 15:27:05 +01:00