Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-10-09 Thread Cathy Avery
On 10/8/20 6:23 AM, Maxim Levitsky wrote: diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 0a06e62010d8c..7293ba23b3cbc 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -436,6 +436,9 @@ int enter_svm_guest_mode(struct vcpu_svm *svm, u64 vmcb_gpa,

Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-10-08 Thread Maxim Levitsky
On Thu, 2020-10-08 at 09:52 -0400, Cathy Avery wrote: > On 10/8/20 9:11 AM, Maxim Levitsky wrote: > > On Thu, 2020-10-08 at 08:46 -0400, Cathy Avery wrote: > > > On 10/8/20 6:54 AM, Maxim Levitsky wrote: > > > > On Thu, 2020-10-08 at 13:39 +0300, Maxim Levitsky wrote: > > > > > On Thu, 2020-10-08 a

Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-10-08 Thread Cathy Avery
On 10/8/20 9:11 AM, Maxim Levitsky wrote: On Thu, 2020-10-08 at 08:46 -0400, Cathy Avery wrote: On 10/8/20 6:54 AM, Maxim Levitsky wrote: On Thu, 2020-10-08 at 13:39 +0300, Maxim Levitsky wrote: On Thu, 2020-10-08 at 13:23 +0300, Maxim Levitsky wrote: On Thu, 2020-10-08 at 07:52 +0200, Paolo

Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-10-08 Thread Maxim Levitsky
On Thu, 2020-10-08 at 08:46 -0400, Cathy Avery wrote: > On 10/8/20 6:54 AM, Maxim Levitsky wrote: > > On Thu, 2020-10-08 at 13:39 +0300, Maxim Levitsky wrote: > > > On Thu, 2020-10-08 at 13:23 +0300, Maxim Levitsky wrote: > > > > On Thu, 2020-10-08 at 07:52 +0200, Paolo Bonzini wrote: > > > > > On

Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-10-08 Thread Cathy Avery
On 10/8/20 6:54 AM, Maxim Levitsky wrote: On Thu, 2020-10-08 at 13:39 +0300, Maxim Levitsky wrote: On Thu, 2020-10-08 at 13:23 +0300, Maxim Levitsky wrote: On Thu, 2020-10-08 at 07:52 +0200, Paolo Bonzini wrote: On 08/10/20 00:14, Maxim Levitsky wrote: + if (svm->vmcb01->control.asid ==

Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-10-08 Thread Maxim Levitsky
On Thu, 2020-10-08 at 13:39 +0300, Maxim Levitsky wrote: > On Thu, 2020-10-08 at 13:23 +0300, Maxim Levitsky wrote: > > On Thu, 2020-10-08 at 07:52 +0200, Paolo Bonzini wrote: > > > On 08/10/20 00:14, Maxim Levitsky wrote: > > > > > + if (svm->vmcb01->control.asid == 0) > > > > > +

Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-10-08 Thread Maxim Levitsky
On Thu, 2020-10-08 at 13:23 +0300, Maxim Levitsky wrote: > On Thu, 2020-10-08 at 07:52 +0200, Paolo Bonzini wrote: > > On 08/10/20 00:14, Maxim Levitsky wrote: > > > > + if (svm->vmcb01->control.asid == 0) > > > > + svm->vmcb01->control.asid = > > > > svm->nested.vmcb02->contro

Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-10-08 Thread Maxim Levitsky
On Thu, 2020-10-08 at 07:52 +0200, Paolo Bonzini wrote: > On 08/10/20 00:14, Maxim Levitsky wrote: > > > + if (svm->vmcb01->control.asid == 0) > > > + svm->vmcb01->control.asid = svm->nested.vmcb02->control.asid; > > > > I think that the above should be done always. The asid field is curre

Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-10-07 Thread Paolo Bonzini
On 08/10/20 00:14, Maxim Levitsky wrote: >> >> +if (svm->vmcb01->control.asid == 0) >> +svm->vmcb01->control.asid = svm->nested.vmcb02->control.asid; > > I think that the above should be done always. The asid field is currently host > controlled only (that is L2 value is ignored, s

Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-10-07 Thread Maxim Levitsky
On Thu, 2020-09-17 at 15:23 -0400, Cathy Avery wrote: > svm->vmcb will now point to either a separate vmcb L1 ( not nested ) or L2 > vmcb ( nested ). > > Issues: > > 1) There is some wholesale copying of vmcb.save and vmcb.contol >areas which will need to be refined. > > 2) There is a worka

Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-09-24 Thread Maxim Levitsky
On Thu, 2020-09-17 at 15:23 -0400, Cathy Avery wrote: > svm->vmcb will now point to either a separate vmcb L1 ( not nested ) or L2 > vmcb ( nested ). > > Issues: > > 1) There is some wholesale copying of vmcb.save and vmcb.contol >areas which will need to be refined. > > 2) There is a worka

Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-09-22 Thread Paolo Bonzini
On 17/09/20 21:23, Cathy Avery wrote: > > 2) There is a workaround in nested_svm_vmexit() where > >if (svm->vmcb01->control.asid == 0) >svm->vmcb01->control.asid = svm->nested.vmcb02->control.asid; > >This was done as a result of the kvm selftest 'state_test'. In that >test s

Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-09-22 Thread Paolo Bonzini
On 21/09/20 16:07, Cathy Avery wrote: >>>   -    if (npt_enabled) >>> -    svm->vmcb->save.cr3 = hsave->save.cr3; >>> +    if (!npt_enabled) >>> +    svm->vmcb01->save.cr3 = kvm_read_cr3(&svm->vcpu); >> Does this mean the original code is missing the following? >> >> else >>   

Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-09-21 Thread Cathy Avery
On 9/18/20 5:11 PM, Wei Huang wrote: On 09/17 03:23, Cathy Avery wrote: svm->vmcb will now point to either a separate vmcb L1 ( not nested ) or L2 vmcb ( nested ). Issues: 1) There is some wholesale copying of vmcb.save and vmcb.contol areas which will need to be refined. 2) There is a w

Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-09-18 Thread Wei Huang
On 09/17 03:23, Cathy Avery wrote: > svm->vmcb will now point to either a separate vmcb L1 ( not nested ) or L2 > vmcb ( nested ). > > Issues: > > 1) There is some wholesale copying of vmcb.save and vmcb.contol >areas which will need to be refined. > > 2) There is a workaround in nested_svm

RE: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-09-18 Thread Babu Moger
r.kernel.org; k...@vger.kernel.org; > >> pbonz...@redhat.com > >> Cc: vkuzn...@redhat.com; Huang2, Wei > >> Subject: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 > >> guest > >> > >> svm->vmcb will now point to either a separate vmcb L1

Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-09-18 Thread Cathy Avery
vmcb. Few comments below. -Original Message- From: Cathy Avery Sent: Thursday, September 17, 2020 2:23 PM To: linux-kernel@vger.kernel.org; k...@vger.kernel.org; pbonz...@redhat.com Cc: vkuzn...@redhat.com; Huang2, Wei Subject: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

RE: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-09-18 Thread Babu Moger
nal Message- > From: Cathy Avery > Sent: Thursday, September 17, 2020 2:23 PM > To: linux-kernel@vger.kernel.org; k...@vger.kernel.org; pbonz...@redhat.com > Cc: vkuzn...@redhat.com; Huang2, Wei > Subject: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest > >

[PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

2020-09-17 Thread Cathy Avery
svm->vmcb will now point to either a separate vmcb L1 ( not nested ) or L2 vmcb ( nested ). Issues: 1) There is some wholesale copying of vmcb.save and vmcb.contol areas which will need to be refined. 2) There is a workaround in nested_svm_vmexit() where if (svm->vmcb01->control.asid ==