public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: VMX: do not exit to user space with error when PML full VMEXIT occurs during event delivery
       [not found] <201607151313.u6FDDnDT017747@dev1.sn.stratus.com>
@ 2016-07-15 13:54 ` Cao, Lei
  2016-07-15 18:28   ` Cao, Lei
  0 siblings, 1 reply; 4+ messages in thread
From: Cao, Lei @ 2016-07-15 13:54 UTC (permalink / raw)
  To: kvm@vger.kernel.org

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(+)

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;
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] KVM: VMX: do not exit to user space with error when PML full VMEXIT occurs during event delivery
  2016-07-15 13:54 ` [PATCH] KVM: VMX: do not exit to user space with error when PML full VMEXIT occurs during event delivery Cao, Lei
@ 2016-07-15 18:28   ` Cao, Lei
  2016-07-16 13:10     ` Radim Krčmář
  0 siblings, 1 reply; 4+ messages in thread
From: Cao, Lei @ 2016-07-15 18:28 UTC (permalink / raw)
  To: Paolo Bonzini, Radim Krčmář, kvm@vger.kernel.org

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(+)

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;
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: VMX: do not exit to user space with error when PML full VMEXIT occurs during event delivery
  2016-07-15 18:28   ` Cao, Lei
@ 2016-07-16 13:10     ` Radim Krčmář
  2016-07-18  6:56       ` Yang Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Radim Krčmář @ 2016-07-16 13:10 UTC (permalink / raw)
  To: Cao, Lei; +Cc: Paolo Bonzini, kvm@vger.kernel.org

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.)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: VMX: do not exit to user space with error when PML full VMEXIT occurs during event delivery
  2016-07-16 13:10     ` Radim Krčmář
@ 2016-07-18  6:56       ` Yang Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Yang Zhang @ 2016-07-18  6:56 UTC (permalink / raw)
  To: Radim Krčmář, Cao, Lei; +Cc: Paolo Bonzini, kvm@vger.kernel.org

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.

-- 
Yang
Alibaba Cloud Computing

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-18  6:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <201607151313.u6FDDnDT017747@dev1.sn.stratus.com>
2016-07-15 13:54 ` [PATCH] KVM: VMX: do not exit to user space with error when PML full VMEXIT occurs during event delivery Cao, Lei
2016-07-15 18:28   ` Cao, Lei
2016-07-16 13:10     ` Radim Krčmář
2016-07-18  6:56       ` Yang Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox