Re: [PATCH] KVM: nVMX: Handle split-lock #AC exceptions that happen in L2

From: Paolo Bonzini
Date: Wed Jun 23 2021 - 08:30:44 EST


On 23/06/21 04:43, Xiaoyao Li wrote:

+        else if (is_alignment_check(intr_info) &&
+             !vmx_guest_inject_ac(vcpu))
+            return true;

Why choose to check in nested_vmx_l0_wants_exit, not in nested_vmx_l1_wants_exit()?

nested_vmx_l0_wants_exit() == true means "this is a vmexit that needs some transformation before being injected into L1". Instead, nested_vmx_l1_wants_exit() == true means "this is an event that should either be processed directly by L0, or cause a vmexit in L1"

Typically, nested_vmx_l1_wants_exit() checks the controls in vmcs12, while nested_vmx_l0_wants_exit() returns true unconditionally for most vmexits; for others it checks processor state, or other state set up by userspace with ioctls such as vcpu->guest_debug.

In this case it's *L0* that wants that vmexit, in order to either disable split-lock detection or inject a SIGBUS, so nested_vmx_l0_wants_exit() is the right one to test.

Paolo