public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Sheng Yang <sheng@linux.intel.com>,
	KVM list <kvm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] KVM MMU: thinking of shadow page cache
Date: Tue, 30 Mar 2010 16:32:25 +0300	[thread overview]
Message-ID: <4BB1FD69.6040409@redhat.com> (raw)
In-Reply-To: <4BB15B1A.7090901@cn.fujitsu.com>

On 03/30/2010 04:59 AM, Xiao Guangrong wrote:
> When we cached shadow page tables, one guest page table may have
> many shadow pages, take below case for example:
>
>   (RO+U) --->  |------| __     |------|
>   (W+U ) --->  |  GP1 |   |    |  GP2 |
>   (W+P ) --->  |------|   |-->  |------|
>
> There have 3 kinds of permission mapping to GP1, so we should
> allocate 3 shadow pages for GP1 and 3 shadow pages for GP2.
> And it has 3 class permissions(R/W, U/S, X/NX) in x86's architecture,
> for the worst case, we should allocate 2^3 pages for every paging
> mapping level.
>
> This waste is caused by that we only set the permission bits in PTE,
> not in the middle mapping level.
>
> So, i think we can mapping guest page table's permission into cache
> shadow page table, then it can be shared between many shadow page tables
> if their map to the same gust physics address. For above case, we only need 2
> pages.
>
> Any comments?
>    

We've considered this in the past, it makes sense.  The big question is 
whether any guests actually map the same page table through PDEs with 
different permissions (mapping the same page table through multiple PDEs 
is very common, but always with the same permissions).  Do you know of 
any such guest?

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


  reply	other threads:[~2010-03-30 13:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-30  1:59 [RFC] KVM MMU: thinking of shadow page cache Xiao Guangrong
2010-03-30 13:32 ` Avi Kivity [this message]
2010-04-01  9:05   ` Xiao Guangrong
2010-04-01  9:12     ` Avi Kivity

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=4BB1FD69.6040409@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mtosatti@redhat.com \
    --cc=sheng@linux.intel.com \
    --cc=xiaoguangrong@cn.fujitsu.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