diff mbox

KVM: VMX: do not exit to user space with error when PML full VMEXIT occurs during event delivery

Message ID CY1PR08MB1992920CB4B9067286F3B351F0330@CY1PR08MB1992.namprd08.prod.outlook.com (mailing list archive)
State New, archived
Headers show

Commit Message

Cao, Lei July 15, 2016, 6:28 p.m. UTC
With PML enabled, guest will shut down if a PML full VMEXIT occurs during
event delivery. According to Intel SDM 27.2.3, PML full VMEXIT can occur when
event is being delivered through IDT, so KVM should not exit to user space
with error. Instead, it should let EXIT_REASON_PML_FULL go through and the
event will be re-injected on the next VMENTRY.

Signed-off-by: Lei Cao <lei.cao@stratus.com>
---
 arch/x86/kvm/vmx.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Radim Krčmář July 16, 2016, 1:10 p.m. UTC | #1
2016-07-15 18:28+0000, Cao, Lei:
> With PML enabled, guest will shut down if a PML full VMEXIT occurs during
> event delivery. According to Intel SDM 27.2.3, PML full VMEXIT can occur when
> event is being delivered through IDT, so KVM should not exit to user space
> with error. Instead, it should let EXIT_REASON_PML_FULL go through and the
> event will be re-injected on the next VMENTRY.
> 
> Signed-off-by: Lei Cao <lei.cao@stratus.com>
> ---

Applied, thanks.

I have Cc'd stable and shortened the summary to "KVM: VMX: handle PML
full VMEXIT that occurs during event delivery".
(See Documentation/SubmittingPatches for reasoning about the 70-75
 character limit.)
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yang Zhang July 18, 2016, 6:56 a.m. UTC | #2
On 2016/7/16 21:10, Radim Krčmář wrote:
> 2016-07-15 18:28+0000, Cao, Lei:
>> With PML enabled, guest will shut down if a PML full VMEXIT occurs during
>> event delivery. According to Intel SDM 27.2.3, PML full VMEXIT can occur when
>> event is being delivered through IDT, so KVM should not exit to user space
>> with error. Instead, it should let EXIT_REASON_PML_FULL go through and the
>> event will be re-injected on the next VMENTRY.
>>
>> Signed-off-by: Lei Cao <lei.cao@stratus.com>
>> ---
>
> Applied, thanks.
>
> I have Cc'd stable and shortened the summary to "KVM: VMX: handle PML
> full VMEXIT that occurs during event delivery".
> (See Documentation/SubmittingPatches for reasoning about the 70-75
>  character limit.)

According to intel SDM 27.2.3, APIC-access VM exit also is possible 
during event delivery, but i don't see KVM considers it in 
vmx_handle_exit(). Am i missing something?

27.2.3 Information for VM Exits During Event Delivery
Section 24.9.3 defined fields containing information for VM exits that 
occur while delivering an event through the IDT and as a result of any 
of the following cases:
• A fault occurs during event delivery and causes a VM exit (because the 
bit associated with the fault is set to 1 in the exception bitmap).
• A task switch is invoked through a task gate in the IDT. The VM exit 
occurs due to the task switch only after the initial checks of the task 
switch pass (see Section 25.4.2).
• Event delivery causes an APIC-access VM exit (see Section 29.4).
• An EPT violation, EPT misconfiguration, or page-modification log-full 
event that occurs during event delivery.
diff mbox

Patch

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 64a79f2..85bf9f3 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -8224,6 +8224,7 @@  static int vmx_handle_exit(struct kvm_vcpu *vcpu)
 	if ((vectoring_info & VECTORING_INFO_VALID_MASK) &&
 			(exit_reason != EXIT_REASON_EXCEPTION_NMI &&
 			exit_reason != EXIT_REASON_EPT_VIOLATION &&
+			exit_reason != EXIT_REASON_PML_FULL &&
 			exit_reason != EXIT_REASON_TASK_SWITCH)) {
 		vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
 		vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_DELIVERY_EV;