public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Peter Feiner <pfeiner@google.com>
Cc: Jim Mattson <jmattson@google.com>, kvm list <kvm@vger.kernel.org>
Subject: Re: Nested virtualization and software page walks in the L1 hypervsior
Date: Wed, 4 Mar 2020 08:19:12 -0800	[thread overview]
Message-ID: <20200304161912.GC21662@linux.intel.com> (raw)
In-Reply-To: <CAM3pwhEXonbu-He1KD52ggEHHKVWok4Bac-4Woq7FvYL9pHykA@mail.gmail.com>

On Tue, Mar 03, 2020 at 04:22:57PM -0800, Peter Feiner wrote:
> On Sat, Feb 29, 2020 at 2:31 PM Jim Mattson <jmattson@google.com> wrote:
> >
> > Peter Feiner asked me an intriguing question the other day. If you
> > have a hypervisor that walks  its guest's x86 page tables in software
> > during emulation, how can you make that software page walk behave
> > exactly like a hardware page walk? In particular, when the hypervisor
> > is running as an L1 guest, how is it possible to write the software
> > page walk so that accesses to L2's x86 page tables are treated as
> > reads if L0 isn't using EPT A/D bits, but they're treated as writes if
> > L0 is using EPT A/D bits? (Paravirtualization is not allowed.)
> >
> > It seems to me that this behavior isn't virtualizable. Am I wrong?
> 
> Jim, I thought about this some more after talking to you. I think it's
> entirely moot what L0 sees so long as L1 and L2 work correctly. So,
> the question becomes, is there anything that L0 could possibly rely on
> this behavior for? My first thought was dirty tracking, but that's not
> a problem because *writes* to the L2 x86 page tables' A/D bits will
> still be intercepted by L0. The missing D bit on a guest page that
> doesn't actually change doesn't matter :-)

Ya.  The hardware behavior of setting the Dirty bit is effectively a
spurious update.  Not emulating that behavior is arguably a good thing :-).

Presumably, the EPT walks are overzealous in treating IA32 page walks as
writes to allow for simpler hardware implementations, e.g. the mechanism to
handle A/D bit updates doesn't need to handle the case where setting an A/D
bit in an IA32 page walk would also trigger an D bit update for the
associated EPT walk.

  reply	other threads:[~2020-03-04 16:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-29 22:30 Nested virtualization and software page walks in the L1 hypervsior Jim Mattson
2020-03-04  0:22 ` Peter Feiner
2020-03-04 16:19   ` Sean Christopherson [this message]
2020-03-04 17:13     ` Jim Mattson
2020-03-04 17:47       ` Sean Christopherson

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=20200304161912.GC21662@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pfeiner@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox