Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Xen: Devel

[PATCH 3/7] xen/mmu: Release the Xen provided L4 (PGD) back.

 

 

Xen devel RSS feed   Index | Next | Previous | View Threaded


konrad.wilk at oracle

Jul 26, 2012, 1:47 PM

Post #1 of 3 (49 views)
Permalink
[PATCH 3/7] xen/mmu: Release the Xen provided L4 (PGD) back.

Since we are not using it and somebody else could use it.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk [at] oracle>
---
arch/x86/xen/mmu.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index a59070b..48bdc9f 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1782,20 +1782,21 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
/* Unpin Xen-provided one */
pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd)));

- /* Switch over */
- pgd = init_level4_pgt;
-
/*
* At this stage there can be no user pgd, and no page
* structure to attach it to, so make sure we just set kernel
* pgd.
*/
xen_mc_batch();
- __xen_write_cr3(true, __pa(pgd));
+ __xen_write_cr3(true, __pa(init_level4_pgt));
xen_mc_issue(PARAVIRT_LAZY_CPU);

- memblock_reserve(__pa(xen_start_info->pt_base),
- xen_start_info->nr_pt_frames * PAGE_SIZE);
+ /* Offset by one page since the original pgd is going bye bye */
+ memblock_reserve(__pa(xen_start_info->pt_base + PAGE_SIZE),
+ (xen_start_info->nr_pt_frames * PAGE_SIZE) - PAGE_SIZE);
+ /* and also RW it so it can actually be used. */
+ set_page_prot(pgd, PAGE_KERNEL);
+ clear_page(pgd);
}
#else /* !CONFIG_X86_64 */
static RESERVE_BRK_ARRAY(pmd_t, initial_kernel_pmd, PTRS_PER_PMD);
--
1.7.7.6


_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


stefano.stabellini at eu

Jul 27, 2012, 4:37 AM

Post #2 of 3 (45 views)
Permalink
Re: [PATCH 3/7] xen/mmu: Release the Xen provided L4 (PGD) back. [In reply to]

On Thu, 26 Jul 2012, Konrad Rzeszutek Wilk wrote:
> Since we are not using it and somebody else could use it.

make sense except it is almost entirely rewritten by the following
patch...

> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk [at] oracle>
> ---
> arch/x86/xen/mmu.c | 13 +++++++------
> 1 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
> index a59070b..48bdc9f 100644
> --- a/arch/x86/xen/mmu.c
> +++ b/arch/x86/xen/mmu.c
> @@ -1782,20 +1782,21 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
> /* Unpin Xen-provided one */
> pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd)));
>
> - /* Switch over */
> - pgd = init_level4_pgt;
> -
> /*
> * At this stage there can be no user pgd, and no page
> * structure to attach it to, so make sure we just set kernel
> * pgd.
> */
> xen_mc_batch();
> - __xen_write_cr3(true, __pa(pgd));
> + __xen_write_cr3(true, __pa(init_level4_pgt));
> xen_mc_issue(PARAVIRT_LAZY_CPU);
>
> - memblock_reserve(__pa(xen_start_info->pt_base),
> - xen_start_info->nr_pt_frames * PAGE_SIZE);
> + /* Offset by one page since the original pgd is going bye bye */
> + memblock_reserve(__pa(xen_start_info->pt_base + PAGE_SIZE),
> + (xen_start_info->nr_pt_frames * PAGE_SIZE) - PAGE_SIZE);
> + /* and also RW it so it can actually be used. */
> + set_page_prot(pgd, PAGE_KERNEL);
> + clear_page(pgd);
> }
> #else /* !CONFIG_X86_64 */
> static RESERVE_BRK_ARRAY(pmd_t, initial_kernel_pmd, PTRS_PER_PMD);
> --
> 1.7.7.6
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel [at] lists
> http://lists.xen.org/xen-devel
>

_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


konrad at darnok

Jul 27, 2012, 10:35 AM

Post #3 of 3 (44 views)
Permalink
Re: [PATCH 3/7] xen/mmu: Release the Xen provided L4 (PGD) back. [In reply to]

On Fri, Jul 27, 2012 at 12:37:24PM +0100, Stefano Stabellini wrote:
> On Thu, 26 Jul 2012, Konrad Rzeszutek Wilk wrote:
> > Since we are not using it and somebody else could use it.
>
> make sense except it is almost entirely rewritten by the following
> patch...

Yeah, I should squash them.
>
> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk [at] oracle>
> > ---
> > arch/x86/xen/mmu.c | 13 +++++++------
> > 1 files changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
> > index a59070b..48bdc9f 100644
> > --- a/arch/x86/xen/mmu.c
> > +++ b/arch/x86/xen/mmu.c
> > @@ -1782,20 +1782,21 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
> > /* Unpin Xen-provided one */
> > pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd)));
> >
> > - /* Switch over */
> > - pgd = init_level4_pgt;
> > -
> > /*
> > * At this stage there can be no user pgd, and no page
> > * structure to attach it to, so make sure we just set kernel
> > * pgd.
> > */
> > xen_mc_batch();
> > - __xen_write_cr3(true, __pa(pgd));
> > + __xen_write_cr3(true, __pa(init_level4_pgt));
> > xen_mc_issue(PARAVIRT_LAZY_CPU);
> >
> > - memblock_reserve(__pa(xen_start_info->pt_base),
> > - xen_start_info->nr_pt_frames * PAGE_SIZE);
> > + /* Offset by one page since the original pgd is going bye bye */
> > + memblock_reserve(__pa(xen_start_info->pt_base + PAGE_SIZE),
> > + (xen_start_info->nr_pt_frames * PAGE_SIZE) - PAGE_SIZE);
> > + /* and also RW it so it can actually be used. */
> > + set_page_prot(pgd, PAGE_KERNEL);
> > + clear_page(pgd);
> > }
> > #else /* !CONFIG_X86_64 */
> > static RESERVE_BRK_ARRAY(pmd_t, initial_kernel_pmd, PTRS_PER_PMD);
> > --
> > 1.7.7.6
> >
> >
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel [at] lists
> > http://lists.xen.org/xen-devel
> >
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel [at] lists
> http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel

Xen devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.