From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>, kvm@vger.kernel.org
Subject: Re: cr3 OOS optimisation breaks 32-bit GNU/kFreeBSD guest
Date: Sun, 5 Apr 2009 08:29:17 -0300 [thread overview]
Message-ID: <20090405112917.GA4105@amt.cnet> (raw)
In-Reply-To: <49D86EC3.3070902@redhat.com>
On Sun, Apr 05, 2009 at 11:41:39AM +0300, Avi Kivity wrote:
> Marcelo Tosatti wrote:
>> The problem is when the page is unreachable due to a higher level path
>> being unlinked. Say:
>>
>> level 4 -> level 3 . level 2 -> level 1 (global unsync)
>>
>> The dot there means level 3 is not linked to level 2, so invlpg can't
>> reach the global unsync at level 1.
>>
>> kvm_mmu_get_page does sync pages when it finds them, so the code is
>> already safe for the "linking a page which contains global ptes" case
>> you mention above.
>>
>
> The recursive resync ignores global pages (or it would hit them on cr3
> switch too).
>
> But we have a bigger problem, invlpg can miss even if nothing is unlinked:
>
> access address x through global pte
> -> pte instantiated into spte
> switch to cr3 where x is not mapped, or mapped differently
> write to pte
> -> no fault since pte is unsync
> invlpg x
> -> no way this can hit the spte
> switch cr3 back
> access address x
> -> use old spte
>
> Here's one way to make this work:
>
> - add a hash of global pagetables, indexed by virtual address instead
> of the pagetable's gfn
> - invlpg checks this hash in addition to the recursive walk
>
> We'd need to make the virtual address part of sp->role to avoid needing
> to link the same page multiple times in the virtual address hash.
Humpf, yes. It seems its too expensive/complex to handle this, for such
small gain (~= 2% on AIM7 with RHEL3 guest).
Are you okay with just disabling the global pages optimization?
next prev parent reply other threads:[~2009-04-05 11:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-23 0:33 cr3 OOS optimisation breaks 32-bit GNU/kFreeBSD guest Aurelien Jarno
2009-02-23 1:47 ` Marcelo Tosatti
2009-02-23 14:01 ` Aurelien Jarno
2009-02-23 14:52 ` Marcelo Tosatti
2009-02-23 14:59 ` Avi Kivity
2009-02-23 15:06 ` Marcelo Tosatti
2009-02-23 15:16 ` Avi Kivity
2009-03-20 23:14 ` Marcelo Tosatti
2009-03-21 8:51 ` Aurelien Jarno
2009-03-22 9:35 ` Avi Kivity
2009-03-23 17:27 ` Marcelo Tosatti
2009-03-24 9:47 ` Avi Kivity
2009-03-24 11:49 ` Marcelo Tosatti
2009-04-03 21:45 ` Marcelo Tosatti
2009-04-04 10:37 ` Avi Kivity
2009-04-04 17:01 ` Marcelo Tosatti
2009-04-05 8:41 ` Avi Kivity
2009-04-05 11:29 ` Marcelo Tosatti [this message]
2009-04-05 11:41 ` Avi Kivity
2009-04-04 23:23 ` Aurelien Jarno
2009-03-24 10:39 ` Aurelien Jarno
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=20090405112917.GA4105@amt.cnet \
--to=mtosatti@redhat.com \
--cc=aurelien@aurel32.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.