xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH, resend] x86/32-on-64: adjust Dom0 initial page table layout
@ 2012-09-07 12:39 Jan Beulich
  2012-09-07 12:42 ` Keir Fraser
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2012-09-07 12:39 UTC (permalink / raw)
  To: xen-devel; +Cc: Konrad Rzeszutek Wilk

[-- Attachment #1: Type: text/plain, Size: 2594 bytes --]

Drop the unnecessary reservation of the L4 page for 32on64 Dom0, and
allocate its L3 first (to match behavior when running identical bit-
width hypervisor and Dom0 kernel).

Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/domain_build.c
+++ b/xen/arch/x86/domain_build.c
@@ -510,7 +510,7 @@ int __init construct_dom0(
 #define NR(_l,_h,_s) \
     (((((_h) + ((1UL<<(_s))-1)) & ~((1UL<<(_s))-1)) - \
        ((_l) & ~((1UL<<(_s))-1))) >> (_s))
-        if ( (1 + /* # L4 */
+        if ( (!is_pv_32on64_domain(d) + /* # L4 */
               NR(v_start, v_end, L4_PAGETABLE_SHIFT) + /* # L3 */
               (!is_pv_32on64_domain(d) ?
                NR(v_start, v_end, L3_PAGETABLE_SHIFT) : /* # L2 */
@@ -756,6 +756,8 @@ int __init construct_dom0(
             panic("Not enough RAM for domain 0 PML4.\n");
         page->u.inuse.type_info = PGT_l4_page_table|PGT_validated|1;
         l4start = l4tab = page_to_virt(page);
+        maddr_to_page(mpt_alloc)->u.inuse.type_info = PGT_l3_page_table;
+        l3start = __va(mpt_alloc); mpt_alloc += PAGE_SIZE;
     }
     copy_page(l4tab, idle_pg_table);
     l4tab[0] = l4e_empty(); /* zap trampoline mapping */
@@ -787,9 +789,13 @@ int __init construct_dom0(
                     l2tab += l2_table_offset(v_start);
                 if ( !((unsigned long)l3tab & (PAGE_SIZE-1)) )
                 {
-                    maddr_to_page(mpt_alloc)->u.inuse.type_info =
-                        PGT_l3_page_table;
-                    l3start = l3tab = __va(mpt_alloc); mpt_alloc += PAGE_SIZE;
+                    if ( count || !l3start )
+                    {
+                        maddr_to_page(mpt_alloc)->u.inuse.type_info =
+                            PGT_l3_page_table;
+                        l3start = __va(mpt_alloc); mpt_alloc += PAGE_SIZE;
+                    }
+                    l3tab = l3start;
                     clear_page(l3tab);
                     if ( count == 0 )
                         l3tab += l3_table_offset(v_start);
@@ -938,7 +944,7 @@ int __init construct_dom0(
     if ( !vinitrd_start && initrd_len )
         si->flags   |= SIF_MOD_START_PFN;
     si->flags       |= (xen_processor_pmbits << 8) & SIF_PM_MASK;
-    si->pt_base      = vpt_start + 2 * PAGE_SIZE * !!is_pv_32on64_domain(d);
+    si->pt_base      = vpt_start;
     si->nr_pt_frames = nr_pt_pages;
     si->mfn_list     = vphysmap_start;
     snprintf(si->magic, sizeof(si->magic), "xen-3.0-x86_%d%s",




[-- Attachment #2: 32on64-bogus-pt_base-adjust.patch --]
[-- Type: text/plain, Size: 2643 bytes --]

x86/32-on-64: adjust Dom0 initial page table layout

Drop the unnecessary reservation of the L4 page for 32on64 Dom0, and
allocate its L3 first (to match behavior when running identical bit-
width hypervisor and Dom0 kernel).

Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/domain_build.c
+++ b/xen/arch/x86/domain_build.c
@@ -510,7 +510,7 @@ int __init construct_dom0(
 #define NR(_l,_h,_s) \
     (((((_h) + ((1UL<<(_s))-1)) & ~((1UL<<(_s))-1)) - \
        ((_l) & ~((1UL<<(_s))-1))) >> (_s))
-        if ( (1 + /* # L4 */
+        if ( (!is_pv_32on64_domain(d) + /* # L4 */
               NR(v_start, v_end, L4_PAGETABLE_SHIFT) + /* # L3 */
               (!is_pv_32on64_domain(d) ?
                NR(v_start, v_end, L3_PAGETABLE_SHIFT) : /* # L2 */
@@ -756,6 +756,8 @@ int __init construct_dom0(
             panic("Not enough RAM for domain 0 PML4.\n");
         page->u.inuse.type_info = PGT_l4_page_table|PGT_validated|1;
         l4start = l4tab = page_to_virt(page);
+        maddr_to_page(mpt_alloc)->u.inuse.type_info = PGT_l3_page_table;
+        l3start = __va(mpt_alloc); mpt_alloc += PAGE_SIZE;
     }
     copy_page(l4tab, idle_pg_table);
     l4tab[0] = l4e_empty(); /* zap trampoline mapping */
@@ -787,9 +789,13 @@ int __init construct_dom0(
                     l2tab += l2_table_offset(v_start);
                 if ( !((unsigned long)l3tab & (PAGE_SIZE-1)) )
                 {
-                    maddr_to_page(mpt_alloc)->u.inuse.type_info =
-                        PGT_l3_page_table;
-                    l3start = l3tab = __va(mpt_alloc); mpt_alloc += PAGE_SIZE;
+                    if ( count || !l3start )
+                    {
+                        maddr_to_page(mpt_alloc)->u.inuse.type_info =
+                            PGT_l3_page_table;
+                        l3start = __va(mpt_alloc); mpt_alloc += PAGE_SIZE;
+                    }
+                    l3tab = l3start;
                     clear_page(l3tab);
                     if ( count == 0 )
                         l3tab += l3_table_offset(v_start);
@@ -938,7 +944,7 @@ int __init construct_dom0(
     if ( !vinitrd_start && initrd_len )
         si->flags   |= SIF_MOD_START_PFN;
     si->flags       |= (xen_processor_pmbits << 8) & SIF_PM_MASK;
-    si->pt_base      = vpt_start + 2 * PAGE_SIZE * !!is_pv_32on64_domain(d);
+    si->pt_base      = vpt_start;
     si->nr_pt_frames = nr_pt_pages;
     si->mfn_list     = vphysmap_start;
     snprintf(si->magic, sizeof(si->magic), "xen-3.0-x86_%d%s",

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH, resend] x86/32-on-64: adjust Dom0 initial page table layout
  2012-09-07 12:39 [PATCH, resend] x86/32-on-64: adjust Dom0 initial page table layout Jan Beulich
@ 2012-09-07 12:42 ` Keir Fraser
  2012-09-07 13:06   ` Jan Beulich
  0 siblings, 1 reply; 4+ messages in thread
From: Keir Fraser @ 2012-09-07 12:42 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Konrad Rzeszutek Wilk

On 07/09/2012 13:39, "Jan Beulich" <JBeulich@suse.com> wrote:

> Drop the unnecessary reservation of the L4 page for 32on64 Dom0, and
> allocate its L3 first (to match behavior when running identical bit-
> width hypervisor and Dom0 kernel).
> 
> Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Keir Fraser <keir@xen.org>

Not for 4.2.0.

> --- a/xen/arch/x86/domain_build.c
> +++ b/xen/arch/x86/domain_build.c
> @@ -510,7 +510,7 @@ int __init construct_dom0(
>  #define NR(_l,_h,_s) \
>      (((((_h) + ((1UL<<(_s))-1)) & ~((1UL<<(_s))-1)) - \
>         ((_l) & ~((1UL<<(_s))-1))) >> (_s))
> -        if ( (1 + /* # L4 */
> +        if ( (!is_pv_32on64_domain(d) + /* # L4 */
>                NR(v_start, v_end, L4_PAGETABLE_SHIFT) + /* # L3 */
>                (!is_pv_32on64_domain(d) ?
>                 NR(v_start, v_end, L3_PAGETABLE_SHIFT) : /* # L2 */
> @@ -756,6 +756,8 @@ int __init construct_dom0(
>              panic("Not enough RAM for domain 0 PML4.\n");
>          page->u.inuse.type_info = PGT_l4_page_table|PGT_validated|1;
>          l4start = l4tab = page_to_virt(page);
> +        maddr_to_page(mpt_alloc)->u.inuse.type_info = PGT_l3_page_table;
> +        l3start = __va(mpt_alloc); mpt_alloc += PAGE_SIZE;
>      }
>      copy_page(l4tab, idle_pg_table);
>      l4tab[0] = l4e_empty(); /* zap trampoline mapping */
> @@ -787,9 +789,13 @@ int __init construct_dom0(
>                      l2tab += l2_table_offset(v_start);
>                  if ( !((unsigned long)l3tab & (PAGE_SIZE-1)) )
>                  {
> -                    maddr_to_page(mpt_alloc)->u.inuse.type_info =
> -                        PGT_l3_page_table;
> -                    l3start = l3tab = __va(mpt_alloc); mpt_alloc +=
> PAGE_SIZE;
> +                    if ( count || !l3start )
> +                    {
> +                        maddr_to_page(mpt_alloc)->u.inuse.type_info =
> +                            PGT_l3_page_table;
> +                        l3start = __va(mpt_alloc); mpt_alloc += PAGE_SIZE;
> +                    }
> +                    l3tab = l3start;
>                      clear_page(l3tab);
>                      if ( count == 0 )
>                          l3tab += l3_table_offset(v_start);
> @@ -938,7 +944,7 @@ int __init construct_dom0(
>      if ( !vinitrd_start && initrd_len )
>          si->flags   |= SIF_MOD_START_PFN;
>      si->flags       |= (xen_processor_pmbits << 8) & SIF_PM_MASK;
> -    si->pt_base      = vpt_start + 2 * PAGE_SIZE * !!is_pv_32on64_domain(d);
> +    si->pt_base      = vpt_start;
>      si->nr_pt_frames = nr_pt_pages;
>      si->mfn_list     = vphysmap_start;
>      snprintf(si->magic, sizeof(si->magic), "xen-3.0-x86_%d%s",
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH, resend] x86/32-on-64: adjust Dom0 initial page table layout
  2012-09-07 12:42 ` Keir Fraser
@ 2012-09-07 13:06   ` Jan Beulich
  2012-09-07 15:07     ` Keir Fraser
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2012-09-07 13:06 UTC (permalink / raw)
  To: Keir Fraser; +Cc: Konrad Rzeszutek Wilk, xen-devel

>>> On 07.09.12 at 14:42, Keir Fraser <keir@xen.org> wrote:
> On 07/09/2012 13:39, "Jan Beulich" <JBeulich@suse.com> wrote:
> 
>> Drop the unnecessary reservation of the L4 page for 32on64 Dom0, and
>> allocate its L3 first (to match behavior when running identical bit-
>> width hypervisor and Dom0 kernel).
>> 
>> Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Acked-by: Keir Fraser <keir@xen.org>
> 
> Not for 4.2.0.

Of course, that's why we held it back. I think that ought to be
the default until the release, and we want to explicitly name the
ones we want ported over.

Jan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH, resend] x86/32-on-64: adjust Dom0 initial page table layout
  2012-09-07 13:06   ` Jan Beulich
@ 2012-09-07 15:07     ` Keir Fraser
  0 siblings, 0 replies; 4+ messages in thread
From: Keir Fraser @ 2012-09-07 15:07 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Konrad Rzeszutek Wilk, xen-devel

On 07/09/2012 14:06, "Jan Beulich" <JBeulich@suse.com> wrote:

>>>> On 07.09.12 at 14:42, Keir Fraser <keir@xen.org> wrote:
>> On 07/09/2012 13:39, "Jan Beulich" <JBeulich@suse.com> wrote:
>> 
>>> Drop the unnecessary reservation of the L4 page for 32on64 Dom0, and
>>> allocate its L3 first (to match behavior when running identical bit-
>>> width hypervisor and Dom0 kernel).
>>> 
>>> Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> 
>> Acked-by: Keir Fraser <keir@xen.org>
>> 
>> Not for 4.2.0.
> 
> Of course, that's why we held it back. I think that ought to be
> the default until the release, and we want to explicitly name the
> ones we want ported over.

Yes, good.

 -- Keir

> Jan
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-09-07 15:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-07 12:39 [PATCH, resend] x86/32-on-64: adjust Dom0 initial page table layout Jan Beulich
2012-09-07 12:42 ` Keir Fraser
2012-09-07 13:06   ` Jan Beulich
2012-09-07 15:07     ` Keir Fraser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).