qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: Alexander Graf <agraf@suse.de>,
	edk2-devel@lists.sourceforge.net,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Bruce Rogers <brogers@suse.com>,
	Gary Ching-Pang Lin <glin@suse.com>,
	Ludwig Nussel <lnussel@suse.de>, Laszlo Ersek <lersek@redhat.com>,
	afaerber@suse.de
Subject: Re: [Qemu-devel] [edk2]   OVMF hung on qemu 1.6.0 with KVM
Date: Fri, 30 Aug 2013 14:42:02 +0200	[thread overview]
Message-ID: <5220931A.9050608@redhat.com> (raw)
In-Reply-To: <20130830121038.GC1844@redhat.com>

Il 30/08/2013 14:10, Gleb Natapov ha scritto:
> On Fri, Aug 30, 2013 at 01:58:59PM +0200, Paolo Bonzini wrote:
>> Il 30/08/2013 11:37, Laszlo Ersek ha scritto:
>>> Disclaimer: I don't know what I'm talking about.
>>
>> No problem. :)
>>
>>> So, Jordan's patch for OVMF (SVN r14494) builds the page tables (and
>>> finally writes the root to CR3) in a phase when paging is not enabled
>>> yet in the VM.
>>>
>>> Again, I have no clue, but if the guest hasn't even enabled paging yet,
>>> then the hypervisor (without EPT?) might have no idea that what the
>>> guest is writing to memory are its pagetables-to-be. The first notice
>>> the hypervisor might take is the store to CR3. At which point (or maybe
>>> even later, when paging is enabled?) the hypervisor would have to walk
>>> the guest's tables all at once, and build the shadow tables "in batch".
>>
>> The hypervisor builds shadow page tables lazily; as soon as CR0.PG is
>> set the next instruction will pagefault and shadow page tables will
>> start to get populated.
>>
>> However, surprise!  There is another set of "flat" page tables for X64,
>> built by UefiCpuPkg/ResetVector/Vtf0/Tools/FixupForRawSection.py when
>> you run UefiCpuPkg/ResetVector/Vtf0/Build.py.  These are always in ROM.
>>
>> As in Jordan's patches, the problem is that the hypervisor is expecting
>> to be able to write to the page tables, but this is not the case because
>> the page tables are in a read-only memory slot.
>>
> Only when setting dirty/accessed bits, are they not set in ROM version
> of page tables?

They are set, but the hypervisor is using gfn_to_hva unconditionally.
See the patch I just posted.

Paolo

  reply	other threads:[~2013-08-30 12:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20130828103552.GC2038@GaryOffice.site>
2013-08-28 11:45 ` [Qemu-devel] [edk2] OVMF hung on qemu 1.6.0 with KVM Laszlo Ersek
2013-08-28 11:49   ` Andreas Färber
2013-08-28 12:10     ` Laszlo Ersek
2013-08-28 12:55       ` Andreas Färber
2013-08-28 14:09         ` Ludwig Nussel
2013-08-29  8:23         ` Gary Ching-Pang Lin
2013-08-29 16:04           ` Bruce Rogers
     [not found]           ` <521F1CB802000048000E30E0@suse.com>
2013-08-30  3:28             ` Gary Ching-Pang Lin
2013-08-30  5:59               ` Paolo Bonzini
2013-08-30  9:37               ` Laszlo Ersek
2013-08-30 11:58                 ` Paolo Bonzini
2013-08-30 12:10                   ` Gleb Natapov
2013-08-30 12:42                     ` Paolo Bonzini [this message]
2013-08-30 17:33                       ` Jordan Justen
2013-08-30 17:39                   ` Jordan Justen
2013-08-30 18:44                     ` Paolo Bonzini
2013-08-30 19:05                       ` Jordan Justen
2013-08-31  7:00                         ` Paolo Bonzini
2013-08-31  7:16               ` Jordan Justen
2013-09-02  2:58                 ` Gary Ching-Pang Lin

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=5220931A.9050608@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=brogers@suse.com \
    --cc=edk2-devel@lists.sourceforge.net \
    --cc=gleb@redhat.com \
    --cc=glin@suse.com \
    --cc=lersek@redhat.com \
    --cc=lnussel@suse.de \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).