[lkml]   [2010]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] x86: use pgd accessors when cloning a pgd range.
On Wed, 2010-10-27 at 18:51 +0100, Jeremy Fitzhardinge wrote:
> On 10/27/2010 10:42 AM, H. Peter Anvin wrote:

> > Ian's message just mentioned "a failure" and never described in any way what
> > kind of "failure" it was.
> It would be a pagefault from Xen preventing a direct write to the pgd
> level of an active pagetable. At the point in setup_arch() where it
> does the first clone_pgd_range() we're already running on swapper_pg_dir
> and the copy from initial_page_table is outright wrong.

I'd missed that aspect, yes the contents of initial_page_table are
wrong. I'm not sure now how my patch to clone_pgd_range even made a

> As Ian suggests, we could switch Xen to use initial_page_table at boot
> then move to swapper_pg_dir in the same way native does.

Accidentally did that in private mail, for everyone else the gory
details are:

> xen_setup_kernel_pagetable operates on initial_page_table instead of
> swapper_pg_dir. We do not pin initial_page_table apart from the
> implicit
> one from writing it to cr3 (it is necessarily r/o though).
> So we enter setup_arch running on initial_page_table and with
> swapper_pg_dir mapped r/w, which is how it looks on native too. So at
> this point the:
> clone_pgd_range(swapper_pg_dir + KERNEL_PGD_BOUNDARY,
> initial_page_table + KERNEL_PGD_BOUNDARY,
> works just fine and we reach:
> load_cr3(swapper_pg_dir);
> Then in __xen_write_cr3 we notice the first attempt to switch to
> swapper_pg_dir and only at that point do we make it r/o and pin it.
> When
> we then actually do the switch to swapper_pg_dir that releases the
> implicit pin on initial_page_table so we can make it r/o again.
> The later on we reach the:
> clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY,
> swapper_pg_dir + KERNEL_PGD_BOUNDARY,
> which will succeed because initial_page_table is r/w again.
> We don't care about the pin on initial_page_table because we should
> never need it again.


 \ /
  Last update: 2010-10-27 20:05    [W:0.116 / U:7.028 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site