linux-stable/include/kvm
Marc Zyngier 4368f59a29 KVM: arm64: vgic-v4: Make the doorbell request robust w.r.t preemption
commit b321c31c9b upstream.

Xiang reports that VMs occasionally fail to boot on GICv4.1 systems when
running a preemptible kernel, as it is possible that a vCPU is blocked
without requesting a doorbell interrupt.

The issue is that any preemption that occurs between vgic_v4_put() and
schedule() on the block path will mark the vPE as nonresident and *not*
request a doorbell irq. This occurs because when the vcpu thread is
resumed on its way to block, vcpu_load() will make the vPE resident
again. Once the vcpu actually blocks, we don't request a doorbell
anymore, and the vcpu won't be woken up on interrupt delivery.

Fix it by tracking that we're entering WFI, and key the doorbell
request on that flag. This allows us not to make the vPE resident
when going through a preempt/schedule cycle, meaning we don't lose
any state.

Cc: stable@vger.kernel.org
Fixes: 8e01d9a396 ("KVM: arm64: vgic-v4: Move the GICv4 residency flow to be driven by vcpu_load/put")
Reported-by: Xiang Chen <chenxiang66@hisilicon.com>
Suggested-by: Zenghui Yu <yuzenghui@huawei.com>
Tested-by: Xiang Chen <chenxiang66@hisilicon.com>
Co-developed-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Acked-by: Zenghui Yu <yuzenghui@huawei.com>
Link: https://lore.kernel.org/r/20230713070657.3873244-1-maz@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-07-27 08:56:43 +02:00
..
arm_arch_timer.h Merge branch kvm-arm64/timer-vm-offsets into kvmarm-master/next 2023-04-21 09:36:40 +01:00
arm_hypercalls.h KVM: arm64: Introduce support for userspace SMCCC filtering 2023-04-05 12:07:41 +01:00
arm_pmu.h arm64: perf: Move PMUv3 driver to drivers/perf 2023-03-27 14:01:18 +01:00
arm_psci.h KVM: arm64: Factor out firmware register handling from psci.c 2022-05-03 14:48:54 +01:00
arm_vgic.h KVM: arm64: vgic-v4: Make the doorbell request robust w.r.t preemption 2023-07-27 08:56:43 +02:00
iodev.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 342 2019-06-05 17:37:07 +02:00