diff mbox

Handle pml in nested vmx

Message ID CACzj_yWd7Cusg6QmKn7roxMNgiip1U4s5EmoKTqzpkHYVH5CXw@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wincy Van May 2, 2017, 11:43 a.m. UTC
I find that L2 can't boot in the kvm queue branch.
L0 KVM will inject a nested vmx exit reason 62 (EXIT_REASON_PML_FULL)
to L1, if L1 can't handle this exit reason, it will report a hardware error.

According to my test, both RHEL 6.x (kernel 2.6.32) and VirtualBox for Windows
will be affected by this bug.

Here is my workaround:



If this patch applied, the bug seems to be fixed, but I can't ensure
that L0's pml is
working properly in this scene.

Is this patch doing the right thing (without implement nested pml)?

Thanks,
Wincy

Comments

Paolo Bonzini May 2, 2017, 1:04 p.m. UTC | #1
On 02/05/2017 13:43, Wincy Van wrote:
> I find that L2 can't boot in the kvm queue branch.
> L0 KVM will inject a nested vmx exit reason 62 (EXIT_REASON_PML_FULL)
> to L1, if L1 can't handle this exit reason, it will report a hardware error.
> 
> According to my test, both RHEL 6.x (kernel 2.6.32) and VirtualBox for Windows
> will be affected by this bug.
> 
> Here is my workaround:
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 379087a..72784ac 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -8135,6 +8135,8 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
>                  * the XSS exit bitmap in vmcs12.
>                  */
>                 return nested_cpu_has2(vmcs12, SECONDARY_EXEC_XSAVES);
> +       case EXIT_REASON_PML_FULL:
> +               return false;
>         case EXIT_REASON_PREEMPTION_TIMER:
>                 return false;
>         default:
> 
> 
> If this patch applied, the bug seems to be fixed, but I can't ensure
> that L0's pml is working properly in this scene.
> 
> Is this patch doing the right thing (without implement nested pml)?

Yes, the patch has been posted already (and will be in 4.12) as "[PATCH]
KVM: nVMX: do not leak PML full vmexit to L1"

Thanks,

Paolo
Wincy Van May 3, 2017, 1:53 a.m. UTC | #2
On Tue, May 2, 2017 at 9:04 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
> On 02/05/2017 13:43, Wincy Van wrote:
>> I find that L2 can't boot in the kvm queue branch.
>> L0 KVM will inject a nested vmx exit reason 62 (EXIT_REASON_PML_FULL)
>> to L1, if L1 can't handle this exit reason, it will report a hardware error.
>>
>> According to my test, both RHEL 6.x (kernel 2.6.32) and VirtualBox for Windows
>> will be affected by this bug.
>>
>> Here is my workaround:
>>
>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>> index 379087a..72784ac 100644
>> --- a/arch/x86/kvm/vmx.c
>> +++ b/arch/x86/kvm/vmx.c
>> @@ -8135,6 +8135,8 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
>>                  * the XSS exit bitmap in vmcs12.
>>                  */
>>                 return nested_cpu_has2(vmcs12, SECONDARY_EXEC_XSAVES);
>> +       case EXIT_REASON_PML_FULL:
>> +               return false;
>>         case EXIT_REASON_PREEMPTION_TIMER:
>>                 return false;
>>         default:
>>
>>
>> If this patch applied, the bug seems to be fixed, but I can't ensure
>> that L0's pml is working properly in this scene.
>>
>> Is this patch doing the right thing (without implement nested pml)?
>
> Yes, the patch has been posted already (and will be in 4.12) as "[PATCH]
> KVM: nVMX: do not leak PML full vmexit to L1"
>
OK, missed that, thank you Paolo :-)

Wincy
diff mbox

Patch

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 379087a..72784ac 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -8135,6 +8135,8 @@  static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
                 * the XSS exit bitmap in vmcs12.
                 */
                return nested_cpu_has2(vmcs12, SECONDARY_EXEC_XSAVES);
+       case EXIT_REASON_PML_FULL:
+               return false;
        case EXIT_REASON_PREEMPTION_TIMER:
                return false;
        default: