public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Yang, Sheng" <sheng.yang@intel.com>
To: Avi Kivity <avi@qumranet.com>
Cc: kvm@vger.kernel.org, Joerg Roedel <joerg.roedel@amd.com>
Subject: Re: [PATCH] allow enabling/disabling NPT by reloading only the architecture module
Date: Wed, 16 Jul 2008 14:27:15 +0800	[thread overview]
Message-ID: <200807161427.15583.sheng.yang@intel.com> (raw)
In-Reply-To: <487C8229.80006@qumranet.com>

On Tuesday 15 July 2008 18:55:37 Avi Kivity wrote:
> Yang, Sheng wrote:
> > On Tuesday 15 July 2008 02:36:36 Joerg Roedel wrote:
> >> If NPT is enabled after loading both KVM modules on AMD and it
> >> should be disabled, both KVM modules must be reloaded. If only
> >> the architecture module is reloaded the behavior is undefined.
> >> With this patch it is possible to disable NPT only by reloading
> >> the kvm_amd module.
> >>
> >> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
> >> ---
> >
> > From 3dd7fa4abb1cfc702b3fbd7038d585b541f981a4 Mon Sep 17 00:00:00
> > 2001 From: Sheng Yang <sheng.yang@intel.com>
> > Date: Tue, 15 Jul 2008 14:18:29 +0800
> > Subject: [PATCH] KVM: VMX: Fix undefined beaviour of EPT after
> > reload kvm-intel.ko
> >
> > Based on Joerg Roedel's fix for NPT.
> >
> > Thanks Joerg!
> >
> > Signed-off-by: Sheng Yang <sheng.yang@intel.com>
> > ---
> >  arch/x86/kvm/vmx.c |   15 +++++++++------
> >  1 files changed, 9 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> > index 5f807e3..374e1ca 100644
> > --- a/arch/x86/kvm/vmx.c
> > +++ b/arch/x86/kvm/vmx.c
> > @@ -3108,14 +3108,17 @@ static struct kvm_vcpu
> > *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
> >  		return ERR_PTR(-ENOMEM);
> >
> >  	allocate_vpid(vmx);
> > -	if (id == 0 && vm_need_ept()) {
> > -		kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK |
> > -			VMX_EPT_WRITABLE_MASK |
> > -			VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT);
> > -		kvm_mmu_set_mask_ptes(0ull, VMX_EPT_FAKE_ACCESSED_MASK,
> > +	if (id == 0) {
> > +		if (vm_need_ept()) {
> > +			kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK |
> > +				VMX_EPT_WRITABLE_MASK |
> > +				VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT);
> > +			kvm_mmu_set_mask_ptes(0ull, VMX_EPT_FAKE_ACCESSED_MASK,
> >  				VMX_EPT_FAKE_DIRTY_MASK, 0ull,
> >  				VMX_EPT_EXECUTABLE_MASK);
> > -		kvm_enable_tdp();
> > +			kvm_enable_tdp();
> > +		} else
> > +			kvm_disable_tdp();
> >  	}
>
> hmm, what is this code doing in vmx_create_vcpu()?  surely
> vmx_init() is a better place?

Oh, may be a historic reason :)

Move it to vmx_init() now.

-- 
regards
Yang, Sheng

  reply	other threads:[~2008-07-16  6:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-14 18:36 [PATCH] allow enabling/disabling NPT by reloading only the architecture module Joerg Roedel
2008-07-15  6:13 ` Yang, Sheng
2008-07-15 10:55   ` Avi Kivity
2008-07-16  6:27     ` Yang, Sheng [this message]
2008-07-15 10:53 ` Avi Kivity

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=200807161427.15583.sheng.yang@intel.com \
    --to=sheng.yang@intel.com \
    --cc=avi@qumranet.com \
    --cc=joerg.roedel@amd.com \
    --cc=kvm@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox