From: Sheng Yang <sheng@linux.intel.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Avi Kivity <avi@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: VMX: Set IGMT bit in EPT entry
Date: Fri, 7 Nov 2008 09:26:34 +0800 [thread overview]
Message-ID: <200811070926.34615.sheng@linux.intel.com> (raw)
In-Reply-To: <4912F58F.8090605@codemonkey.ws>
On Thursday 06 November 2008 21:47:59 Anthony Liguori wrote:
> Sheng Yang wrote:
> > (Patch for 2.6.27, based on kvm-updates/2.6.27)
> >
> > There is a potential issue that, when guest using pagetable without
> > vmexit when EPT enabled, guest would use PAT/PCD/PWT bits to index PAT
> > msr for it's memory, which would be inconsistent with host side and would
> > cause host MCE due to inconsistent cache attribute.
> >
> > The patch set IGMT bit in EPT entry to ignore guest PAT and use WB as
> > default memory type to protect host (notice that all memory mapped by KVM
> > should be WB).
>
> So this seems incompatible with hardware passthrough, since that would
> require being able to map guest memory as something other than WB. Is
> there a fix for that?
Well, this comment is for 2.6.27/2.6.28 which lacks of EPT memory type
support, so it based on the assumption there is no memory type other than WB
for EPT... And indeed a new fix is needed for 2.6.28 which lacks of EPT memory
type support and got device assignment, but we haven't decided yet how to
fix...
It's compatible with hardware passthrough, if kernel got EPT memory type(as
current KVM upstream). The EPT memory type derived from guest MTRR, and guest
would set MMIO region as UC, then the EPT memory type in EPT entry was UC, and
this determined the memory type. Well, still a issue here, guest and host may
access same region of memory use different memory type, and we are still in the
discussion...
--
regards
Yang, Sheng
>
> Regards,
>
> Anthony Liguori
>
> > Signed-off-by: Sheng Yang <sheng@linux.intel.com>
> > ---
> > arch/x86/kvm/vmx.c | 3 ++-
> > arch/x86/kvm/vmx.h | 1 +
> > 2 files changed, 3 insertions(+), 1 deletions(-)
> >
> > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> > index 7041cc5..8277466 100644
> > --- a/arch/x86/kvm/vmx.c
> > +++ b/arch/x86/kvm/vmx.c
> > @@ -3300,7 +3300,8 @@ static int __init vmx_init(void)
> > bypass_guest_pf = 0;
> > kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK |
> > VMX_EPT_WRITABLE_MASK |
> > - VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT);
> > + VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT |
> > + VMX_EPT_IGMT_BIT);
> > kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull,
> > VMX_EPT_EXECUTABLE_MASK);
> > kvm_enable_tdp();
> > diff --git a/arch/x86/kvm/vmx.h b/arch/x86/kvm/vmx.h
> > index 23e8373..198cdf3 100644
> > --- a/arch/x86/kvm/vmx.h
> > +++ b/arch/x86/kvm/vmx.h
> > @@ -370,6 +370,7 @@ enum vmcs_field {
> > #define VMX_EPT_READABLE_MASK 0x1ull
> > #define VMX_EPT_WRITABLE_MASK 0x2ull
> > #define VMX_EPT_EXECUTABLE_MASK 0x4ull
> > +#define VMX_EPT_IGMT_BIT (1ull << 6)
> >
> > #define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul
prev parent reply other threads:[~2008-11-07 1:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-06 6:55 [PATCH] KVM: VMX: Set IGMT bit in EPT entry Sheng Yang
2008-11-06 12:54 ` Avi Kivity
2008-11-06 13:47 ` Anthony Liguori
2008-11-07 1:26 ` Sheng Yang [this message]
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=200811070926.34615.sheng@linux.intel.com \
--to=sheng@linux.intel.com \
--cc=anthony@codemonkey.ws \
--cc=avi@redhat.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