All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emre Can Sezer <ecsezer@ncsu.edu>
To: Xen Devel <xen-devel@lists.xensource.com>
Subject: Re: Two shadow page tables for HVM
Date: Mon, 22 Dec 2008 13:28:08 -0500	[thread overview]
Message-ID: <494FDC38.7040400@ncsu.edu> (raw)
In-Reply-To: <20081218113225.GN460@york.uk.xensource.com>

Tim Deegan wrote:
> Hi,
>
> At 18:06 -0500 on 17 Dec (1229537167), Emre Can Sezer wrote:
>   
>> So far I can think of only two ways of doing this.  First, I can have two 
>> top level shadow page tables and use one of the unused slots in struct 
>> arch_domain to store this page.  Then I modify propagate_l*e_from_guest 
>> functions to ensure that they create and synchronize the second page table. 
>>     
>
> You could double up the shadow pagetable types, so that as well as
> having a 32-bit l1 shadow there would also be a 32-bit alternate-mode
> shadow.  Then by doubling the number of times multi.c is built, you
> could hopefully do what you want without _too_ much extra hacking.
> Switching back and forth would involve chaging the paging mode and
> calling shadow_update_paging_modes() to cause the right set of shadows
> to be loaded.
>   
Wouldn't this mean that the two page tables are NOT synchronized?  When
we switch paging modes, wouldn't we have to rebuild the entire shadow
page tables from guest?

The reason I was thinking of synchronized page tables is because I will
have to switch between them quite often - several times during a system
call.  So I want to minimize the tlb flushes and make the switch as fast
as possible.  With synced PT's, my plan was to set the guest CR3 to
point to the new top level page table and only flush the kernel pages.

When considering the performance penalties of flushing the kernel page
tables from the TLB, how significant is traversing all the shadow page
tables for the guest kernel and updating their permissions?  If there
isn't an order of magnitude of difference, it might be reasonable to
take the short cut in implementation.


>>  Second, I can have pages that are twice as large as original page tables.  
>> I'm not sure what the implications are concerning shadow cache and the 
>> linear page table mappings. 
>>     
>
> I think that would involve a lot more hacking around in the code that
> builds the tables, and probably many more infuriating bugs. :)
>
>   
>> Which one of these methods would be easier to implement?  Is there an 
>> easier way of having two sets of page tables?  If I had the means, would it 
>> be worth switching to AMD for the NPT?
>>     
>
> Probably -- duplicating the p2m table with appropriate changes would be
> simpler than duplicating all shadows everywhere, and the switchover
> would be trivial.
>
> One thing to consider in either case is how to choose which frames are
> accessible: if you modify the shadows you will at least be able to see
> the virtual addresses so you can decide what's kernel and what isn't;
> with NPT you deal only in guest-physical addresses.  But then again, in
> the NPT case you don't have to worry about aliased mappings of the
> frame.
>
> Cheers,
>
> Tim.
>
>   

  reply	other threads:[~2008-12-22 18:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-17 23:06 Two shadow page tables for HVM Emre Can Sezer
2008-12-18  3:50 ` Sina Bahram
2008-12-18 11:32 ` Tim Deegan
2008-12-22 18:28   ` Emre Can Sezer [this message]
2008-12-23 12:03     ` Gianluca Guida
     [not found]   ` <494FC8C7.8030508@ncsu.edu>
     [not found]     ` <20081223161006.GB28336@york.uk.xensource.com>
2008-12-29 16:17       ` Emre Can Sezer
     [not found]       ` <4958F7E0.8050207@ncsu.edu>
     [not found]         ` <20081229165415.GB5734@york.uk.xensource.com>
2009-01-09 22:08           ` Emre Can Sezer
2009-01-12  9:46             ` Tim Deegan
2009-01-27  0:39               ` Emre Can Sezer
2009-01-27 10:34                 ` Tim Deegan
2009-01-27 19:07                   ` Emre Can Sezer
2009-01-28  9:25                     ` Tim Deegan
2009-01-30 16:15                   ` Emre Can Sezer

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=494FDC38.7040400@ncsu.edu \
    --to=ecsezer@ncsu.edu \
    --cc=xen-devel@lists.xensource.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 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.