All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, kvm <kvm@vger.kernel.org>,
	Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	Yang Zhang <yang.z.zhang@intel.com>,
	Arthur Chunqi Li <yzt356@gmail.com>
Subject: Re: [PATCH v3 5/6] KVM: nVMX: Update mmu.base_role.nxe after EFER loading on VM-entry/exit
Date: Tue, 03 Sep 2013 11:32:10 +0200	[thread overview]
Message-ID: <5225AC9A.1030600@siemens.com> (raw)
In-Reply-To: <20130903090411.GX22899@redhat.com>

On 2013-09-03 11:04, Gleb Natapov wrote:
> On Tue, Sep 03, 2013 at 10:51:31AM +0200, Jan Kiszka wrote:
>> On 2013-09-03 10:39, Gleb Natapov wrote:
>>> On Thu, Aug 08, 2013 at 04:26:32PM +0200, Jan Kiszka wrote:
>>>> This job is normally performed by the architectural EFER set service
>>>> which we cannot use as it prevents transitions that are valid when
>>>> switching between L1 and L2. So open-code the update of base_role.nxe
>>>> after changing EFER on VM-entry and exit.
>>>>
>>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>> ---
>>>>  arch/x86/kvm/vmx.c |    4 ++++
>>>>  1 files changed, 4 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>>>> index 9b0510b..7cc208a 100644
>>>> --- a/arch/x86/kvm/vmx.c
>>>> +++ b/arch/x86/kvm/vmx.c
>>>> @@ -7735,6 +7735,8 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
>>>>  		vcpu->arch.efer &= ~(EFER_LMA | EFER_LME);
>>>>  	/* Note: modifies VM_ENTRY/EXIT_CONTROLS and GUEST/HOST_IA32_EFER */
>>>>  	vmx_set_efer(vcpu, vcpu->arch.efer);
>>>> +	vcpu->arch.mmu.base_role.nxe =
>>>> +		(vcpu->arch.efer & EFER_NX) && !enable_ept;
>>>>  
>>> kvm_mmu_reset_context() called later in this function does that.
>>
>> For all relevant scenarios? The code is pretty convoluted, so this is
>> non-obvious for me: kvm_mmu_reset_context calls init_kvm_mmu which may
>> call init_kvm_softmmu that does kvm_init_shadow_mmu with nxe
>> initialization. But is that path always taken?
>>
> What scenarios are relevant here? kvm_mmu_reset_context() is what
> kvm_set_efer() would have called anyway. Since you use !enable_ept
> here I assume that relevant scenario is shadow on shadow and in this
> case it is easy to see that kvm_mmu_reset_context() will call
> kvm_init_shadow_mmu() eventually. For all other scenarios guest nx
> setting is irrelevant.

Indeed... Ah! I missed that 2c9afa52 changed the picture. OK, another
obsolete one.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux

  reply	other threads:[~2013-09-03  9:32 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-08 14:26 [PATCH v3 0/6] KVM: nVMX: Enable unrestricted guest mode and fix some nEPT issues Jan Kiszka
2013-08-08 14:26 ` [PATCH v3 1/6] KVM: nVMX: Replace kvm_set_cr0 with vmx_set_cr0 in load_vmcs12_host_state Jan Kiszka
2013-09-02  8:21   ` Gleb Natapov
2013-09-02  9:06     ` Jan Kiszka
2013-09-02  9:36       ` Gleb Natapov
2013-09-03 17:44         ` Jan Kiszka
2013-09-03 17:55           ` Gleb Natapov
2013-09-03 19:11             ` [PATCH v4] " Jan Kiszka
2013-09-08  8:57               ` Gleb Natapov
2013-09-10 13:14     ` [PATCH v3 1/6] " Arthur Chunqi Li
2013-09-10 13:26       ` Paolo Bonzini
2013-09-15 11:01       ` Gleb Natapov
2013-08-08 14:26 ` [PATCH v3 2/6] KVM: nVMX: Do not set identity page map for L2 Jan Kiszka
2013-08-08 14:26 ` [PATCH v3 3/6] KVM: nVMX: Load nEPT state after EFER Jan Kiszka
2013-09-02 13:16   ` Gleb Natapov
2013-09-02 17:58     ` Jan Kiszka
2013-09-02 18:09       ` Gleb Natapov
2013-09-02 18:20         ` Jan Kiszka
2013-09-02 18:38           ` Jan Kiszka
2013-08-08 14:26 ` [PATCH v3 4/6] KVM: nVMX: Implement support for EFER saving on VM-exit Jan Kiszka
2013-08-08 14:26 ` [PATCH v3 5/6] KVM: nVMX: Update mmu.base_role.nxe after EFER loading on VM-entry/exit Jan Kiszka
2013-09-03  8:39   ` Gleb Natapov
2013-09-03  8:51     ` Jan Kiszka
2013-09-03  9:04       ` Gleb Natapov
2013-09-03  9:32         ` Jan Kiszka [this message]
2013-08-08 14:26 ` [PATCH v3 6/6] KVM: nVMX: Enable unrestricted guest mode support Jan Kiszka
2013-08-25  6:46 ` [PATCH v3 0/6] KVM: nVMX: Enable unrestricted guest mode and fix some nEPT issues Jan Kiszka
2013-08-25 10:01   ` Paolo Bonzini
2013-08-27 11:18     ` Gleb Natapov
2013-09-12 16:34 ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5225AC9A.1030600@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=gleb@redhat.com \
    --cc=jun.nakajima@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=xiaoguangrong@linux.vnet.ibm.com \
    --cc=yang.z.zhang@intel.com \
    --cc=yzt356@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.