From: Sean Christopherson <seanjc@google.com>
To: harry harry <hiharryharryharry@gmail.com>
Cc: Maxim Levitsky <mlevitsk@redhat.com>,
kvm@vger.kernel.org, qemu-devel@nongnu.org,
Sean Christopherson <sean.j.christopherson@intel.com>,
Paolo Bonzini <pbonzini@redhat.com>,
stefanha@redhat.com, mathieu.tarral@protonmail.com
Subject: Re: About two-dimensional page translation (e.g., Intel EPT) and shadow page table in Linux QEMU/KVM
Date: Wed, 21 Jul 2021 21:00:52 +0000 [thread overview]
Message-ID: <YPiLBLA2IjwovNCP@google.com> (raw)
In-Reply-To: <CA+-xGqN75O37cr9uh++dyPj57tKcYm0fD=+-GBErki8nGNcemQ@mail.gmail.com>
On Thu, Jul 15, 2021, harry harry wrote:
> Hi Sean,
>
> Thanks for the explanations. Please see my comments below. Thanks!
>
> > When TDP (EPT) is used, the hardware MMU has two parts: the TDP PTEs that
> > are controlled by KVM, and the IA32 PTEs that are controlled by the guest.
> > And there's still a KVM MMU for the guest; the KVM MMU in that case knows
> > how to connfigure the TDP PTEs in hardware _and_ walk the guest IA32 PTEs,
> > e.g. to handle memory accesses during emulation.
>
> Sorry, I could not understand why the emulated MMU is still needed
> when TDP (e.g., Intel EPT) is used?
> In particular, in what situations, we need the emulated MMU to
> configure the TDP PTEs in hardware and walk the guest IA32 PTEs?
Ignoring some weird corner cases that blur the lines between emulation and
hardware configuration, the emulated IA32 MMU isn't used to configure TDP PTEs in
hardware, it's only used to walk the the guest page tables.
> Why do we need the emulated MMU in these situations?
For emulation of any instruction/flow that starts with a guest virtual address.
On Intel CPUs, that includes quite literally any "full" instruction emulation,
since KVM needs to translate CS:RIP to a guest physical address in order to fetch
the guest's code stream. KVM can't avoid "full" emulation unless the guest is
heavily enlightened, e.g. to avoid string I/O, among many other things.
next prev parent reply other threads:[~2021-07-21 21:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-11 20:13 About two-dimensional page translation (e.g., Intel EPT) and shadow page table in Linux QEMU/KVM harry harry
2021-07-12 9:49 ` Maxim Levitsky
2021-07-12 13:02 ` harry harry
2021-07-12 13:11 ` Maxim Levitsky
2021-07-12 14:56 ` Sean Christopherson
2021-07-14 5:30 ` harry harry
2021-07-14 17:47 ` Sean Christopherson
2021-07-15 5:49 ` harry harry
2021-07-15 22:24 ` Sean Christopherson
2021-07-16 3:20 ` harry harry
2021-07-21 21:00 ` Sean Christopherson [this message]
2021-07-28 19:00 ` harry harry
2021-07-28 20:01 ` Sean Christopherson
2021-08-05 19:42 ` harry harry
2021-07-14 5:22 ` harry harry
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=YPiLBLA2IjwovNCP@google.com \
--to=seanjc@google.com \
--cc=hiharryharryharry@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=mathieu.tarral@protonmail.com \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sean.j.christopherson@intel.com \
--cc=stefanha@redhat.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;
as well as URLs for NNTP newsgroup(s).