[PATCH v11 31/43] KVM: arm64: nv: Don't block in WFI from nested state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If trapping WFI from a L2 guest, and that L1 hasn't asked for
such trap, it is very hard to decide when to unblock the vcpu,
as we only have a very partial view on the guest's nested
interrupt state (the L1 hypervisor knows about it, but L0 doesn't).

In such a case, we're better off just returning to the L2 guest
immediately. It isn't wrong from an architecture perspective.

Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx>
---
 arch/arm64/kvm/arm.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index 95760ed448bf..d684a2af3406 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -781,6 +781,15 @@ static void kvm_vcpu_sleep(struct kvm_vcpu *vcpu)
  */
 void kvm_vcpu_wfi(struct kvm_vcpu *vcpu)
 {
+	/*
+	 * If we're in nested state and the guest hypervisor does not trap
+	 * WFI, we're in a bit of trouble, as we don't have a good handle
+	 * on the interrupts that are pending for the guest yet. Revisit
+	 * this at some point.
+	 */
+	if (vgic_state_is_nested(vcpu))
+		return;
+
 	/*
 	 * Sync back the state of the GIC CPU interface so that we have
 	 * the latest PMR and group enables. This ensures that
-- 
2.39.2





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux