All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] x86/dom0: minor fixes and improvements to PVH builder
@ 2018-12-28 11:18 Roger Pau Monne
  2018-12-28 11:18 ` [PATCH v2 1/2] x86/dom0: take alignment into account when populating p2m in PVH mode Roger Pau Monne
  2018-12-28 11:18 ` [PATCH v2 2/2] x86/dom0: add verbose mode and print memory allocation stats Roger Pau Monne
  0 siblings, 2 replies; 11+ messages in thread
From: Roger Pau Monne @ 2018-12-28 11:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Roger Pau Monne

Hello,

This series contains an improvement when filling the p2m so that
alignment is taken into account when allocating and populating the p2m.

The last patch is optional and adds a verbose mode to dom0 build so more
information can be printed.

Thanks, Roger.

Roger Pau Monne (2):
  x86/dom0: take alignment into account when populating p2m in PVH mode
  x86/dom0: add verbose mode and print memory allocation stats

 docs/misc/xen-command-line.markdown |  8 +++-
 xen/arch/x86/dom0_build.c           |  3 ++
 xen/arch/x86/hvm/dom0_build.c       | 64 ++++++++++++++++++++++++++---
 xen/include/asm-x86/setup.h         |  1 +
 4 files changed, 70 insertions(+), 6 deletions(-)

-- 
2.17.2 (Apple Git-113)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* [PATCH v2 1/2] x86/dom0: take alignment into account when populating p2m in PVH mode
  2018-12-28 11:18 [PATCH v2 0/2] x86/dom0: minor fixes and improvements to PVH builder Roger Pau Monne
@ 2018-12-28 11:18 ` Roger Pau Monne
  2018-12-28 14:29   ` Andrew Cooper
  2019-01-04 14:42   ` Jan Beulich
  2018-12-28 11:18 ` [PATCH v2 2/2] x86/dom0: add verbose mode and print memory allocation stats Roger Pau Monne
  1 sibling, 2 replies; 11+ messages in thread
From: Roger Pau Monne @ 2018-12-28 11:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Wei Liu, Jan Beulich, Roger Pau Monne

Current code that allocates memory and populates the p2m for PVH Dom0
doesn't take the address alignment into account, this can lead to high
order allocations that start on a non-aligned address to be broken
down into lower order entries on the p2m page tables.

Fix this by taking into account the p2m page sizes and alignment
requirements when allocating the memory and populating the p2m.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Changes since v1:
 - Batch allocations/mappings when possible in order to allocate
   higher order regions.
---
 xen/arch/x86/hvm/dom0_build.c | 48 +++++++++++++++++++++++++++++++----
 1 file changed, 43 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 7ea29c443a..f02fb931d1 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -91,16 +91,54 @@ static int __init pvh_populate_memory_range(struct domain *d,
                                             unsigned long start,
                                             unsigned long nr_pages)
 {
-    unsigned int order = MAX_ORDER, i = 0;
+    struct {
+        unsigned long align;
+        unsigned int order;
+    } static const __initconst orders[] = {
+        /* NB: must be sorted by decreasing size. */
+        { .align = PFN_DOWN(GB(1)), .order = PAGE_ORDER_1G },
+        { .align = PFN_DOWN(MB(2)), .order = PAGE_ORDER_2M },
+        { .align = PFN_DOWN(KB(4)), .order = PAGE_ORDER_4K },
+    };
+    unsigned int max_order = MAX_ORDER, i = 0;
     struct page_info *page;
     int rc;
 #define MAP_MAX_ITER 64
 
     while ( nr_pages != 0 )
     {
-        unsigned int range_order = get_order_from_pages(nr_pages + 1);
+        unsigned int order, j;
+        unsigned long end;
+
+        for ( j = 0; j < ARRAY_SIZE(orders); j++ )
+            if ( IS_ALIGNED(start, orders[j].align) &&
+                 nr_pages >= (1UL << orders[j].order) )
+                break;
+
+        switch ( j )
+        {
+        case ARRAY_SIZE(orders):
+            printk("Unable to find allocation order for [%#lx,%#lx)\n",
+                   start, start + nr_pages);
+            return -EINVAL;
+
+        case 0:
+            /* Highest order, aim to allocate until the end of the region. */
+            end = (start + nr_pages) & ~(orders[0].align - 1);
+            break;
+
+        default:
+            /*
+             * Aim to allocate until the higher next order alignment or the
+             * end of the region.
+             */
+            end = min(ROUNDUP(start + 1, orders[j - 1].align),
+                      start + nr_pages);
+            break;
+        }
 
-        order = min(range_order ? range_order - 1 : 0, order);
+        order = get_order_from_pages(end - start + 1);
+        order = min(order ? order - 1 : 0, max_order);
         page = alloc_domheap_pages(d, order, dom0_memflags | MEMF_no_scrub);
         if ( page == NULL )
         {
@@ -108,7 +146,7 @@ static int __init pvh_populate_memory_range(struct domain *d,
             {
                 /* Try again without any dom0_memflags. */
                 dom0_memflags = 0;
-                order = MAX_ORDER;
+                max_order = MAX_ORDER;
                 continue;
             }
             if ( order == 0 )
@@ -116,7 +154,7 @@ static int __init pvh_populate_memory_range(struct domain *d,
                 printk("Unable to allocate memory with order 0!\n");
                 return -ENOMEM;
             }
-            order--;
+            max_order = order - 1;
             continue;
         }
 
-- 
2.17.2 (Apple Git-113)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* [PATCH v2 2/2] x86/dom0: add verbose mode and print memory allocation stats
  2018-12-28 11:18 [PATCH v2 0/2] x86/dom0: minor fixes and improvements to PVH builder Roger Pau Monne
  2018-12-28 11:18 ` [PATCH v2 1/2] x86/dom0: take alignment into account when populating p2m in PVH mode Roger Pau Monne
@ 2018-12-28 11:18 ` Roger Pau Monne
  2019-01-02 12:35   ` Wei Liu
  2019-01-07 10:01   ` Jan Beulich
  1 sibling, 2 replies; 11+ messages in thread
From: Roger Pau Monne @ 2018-12-28 11:18 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich, Roger Pau Monne

Add a verbose option to the dom0 command line, so that dom0 builder
can print extra debug information when required.

Use this new verbose mode to print statistics about memory allocations
when populating dom0 p2m.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 docs/misc/xen-command-line.markdown |  8 +++++++-
 xen/arch/x86/dom0_build.c           |  3 +++
 xen/arch/x86/hvm/dom0_build.c       | 16 ++++++++++++++++
 xen/include/asm-x86/setup.h         |  1 +
 4 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 78b207c0d0..e7973ee509 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -637,7 +637,7 @@ trace feature is only enabled in debugging builds of Xen.
 Specify the bit width of the DMA heap.
 
 ### dom0 (x86)
-> `= List of [ pvh | shadow ]`
+> `= List of [ pvh | shadow | verbose ]`
 
 > Sub-options:
 
@@ -654,6 +654,12 @@ Flag that makes a dom0 boot in PVHv2 mode.
 Flag that makes a dom0 use shadow paging. Only works when "pvh" is
 enabled.
 
+> `verbose`
+
+> Default: `false`
+
+Print debug information during dom0 build.
+
 ### dom0-iommu
 > `= List of [ passthrough | strict | map-inclusive ]`
 
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 54737daf6a..c0bc022a83 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -281,6 +281,7 @@ struct vcpu *__init alloc_dom0_vcpu0(struct domain *dom0)
 bool __initdata opt_dom0_shadow;
 #endif
 bool __initdata dom0_pvh;
+bool __initdata dom0_verbose;
 
 /*
  * List of parameters that affect Dom0 creation:
@@ -306,6 +307,8 @@ static int __init parse_dom0_param(const char *s)
         else if ( (val = parse_boolean("shadow", s, ss)) >= 0 )
             opt_dom0_shadow = val;
 #endif
+        else if ( (val = parse_boolean("verbose", s, ss)) >= 0 )
+            dom0_verbose = val;
         else
             rc = -EINVAL;
 
diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index f02fb931d1..72d98fac78 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -60,6 +60,18 @@ static struct acpi_madt_interrupt_override __initdata *intsrcovr;
 static unsigned int __initdata acpi_nmi_sources;
 static struct acpi_madt_nmi_source __initdata *nmisrc;
 
+static unsigned int __initdata order_stats[MAX_ORDER + 1] = { };
+
+static void __init print_order_stats(void)
+{
+    unsigned int i;
+
+    printk("Memory allocation stats:\n");
+    for ( i = 0; i < ARRAY_SIZE(order_stats); i++ )
+        if ( order_stats[i] )
+            printk("order: %2u allocations: %u\n", i, order_stats[i]);
+}
+
 static int __init modify_identity_mmio(struct domain *d, unsigned long pfn,
                                        unsigned long nr_pages, const bool map)
 {
@@ -168,6 +180,7 @@ static int __init pvh_populate_memory_range(struct domain *d,
         }
         start += 1UL << order;
         nr_pages -= 1UL << order;
+        order_stats[order]++;
         if ( (++i % MAP_MAX_ITER) == 0 )
             process_pending_softirqs();
     }
@@ -464,6 +477,9 @@ static int __init pvh_setup_p2m(struct domain *d)
             return rc;
     }
 
+    if ( dom0_verbose )
+        print_order_stats();
+
     return 0;
 #undef MB1_PAGES
 }
diff --git a/xen/include/asm-x86/setup.h b/xen/include/asm-x86/setup.h
index 1c8078340d..bb4c38567c 100644
--- a/xen/include/asm-x86/setup.h
+++ b/xen/include/asm-x86/setup.h
@@ -65,6 +65,7 @@ extern bool opt_dom0_shadow;
 #define opt_dom0_shadow false
 #endif
 extern bool dom0_pvh;
+extern bool dom0_verbose;
 
 #define max_init_domid (0)
 
-- 
2.17.2 (Apple Git-113)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH v2 1/2] x86/dom0: take alignment into account when populating p2m in PVH mode
  2018-12-28 11:18 ` [PATCH v2 1/2] x86/dom0: take alignment into account when populating p2m in PVH mode Roger Pau Monne
@ 2018-12-28 14:29   ` Andrew Cooper
  2019-01-04 14:42   ` Jan Beulich
  1 sibling, 0 replies; 11+ messages in thread
From: Andrew Cooper @ 2018-12-28 14:29 UTC (permalink / raw)
  To: Roger Pau Monne, xen-devel; +Cc: Wei Liu, Jan Beulich

On 28/12/2018 11:18, Roger Pau Monne wrote:
> Current code that allocates memory and populates the p2m for PVH Dom0
> doesn't take the address alignment into account, this can lead to high
> order allocations that start on a non-aligned address to be broken
> down into lower order entries on the p2m page tables.
>
> Fix this by taking into account the p2m page sizes and alignment
> requirements when allocating the memory and populating the p2m.
>
> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Nice.  I now get a layout as follows:

(XEN) *** Building a PVH Dom0 ***
(XEN) pvh_populate_memory_range(d0, 0, a0)
(XEN) guest_physmap_add_page(d0, 00000, 100b00, 7 = 512kB)
(XEN) guest_physmap_add_page(d0, 00080, 100bc0, 5 = 128kB)
(XEN) pvh_populate_memory_range(d0, 100, 360)
(XEN) guest_physmap_add_page(d0, 00100, 100a00, 8 = 1024kB)
(XEN) guest_physmap_add_page(d0, 00200, 100800, 9 = 2048kB)
(XEN) guest_physmap_add_page(d0, 00400, 100b80, 6 = 256kB)
(XEN) guest_physmap_add_page(d0, 00440, 1007e0, 5 = 128kB)

which looks to be correct.

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH v2 2/2] x86/dom0: add verbose mode and print memory allocation stats
  2018-12-28 11:18 ` [PATCH v2 2/2] x86/dom0: add verbose mode and print memory allocation stats Roger Pau Monne
@ 2019-01-02 12:35   ` Wei Liu
  2019-01-02 12:48     ` Roger Pau Monné
  2019-01-07 10:01   ` Jan Beulich
  1 sibling, 1 reply; 11+ messages in thread
From: Wei Liu @ 2019-01-02 12:35 UTC (permalink / raw)
  To: Roger Pau Monne
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich, xen-devel

On Fri, Dec 28, 2018 at 12:18:57PM +0100, Roger Pau Monne wrote:
> Add a verbose option to the dom0 command line, so that dom0 builder
> can print extra debug information when required.
> 
> Use this new verbose mode to print statistics about memory allocations
> when populating dom0 p2m.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Cc: George Dunlap <George.Dunlap@eu.citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Julien Grall <julien.grall@arm.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Tim Deegan <tim@xen.org>
> Cc: Wei Liu <wei.liu2@citrix.com>
> ---
>  docs/misc/xen-command-line.markdown |  8 +++++++-
>  xen/arch/x86/dom0_build.c           |  3 +++
>  xen/arch/x86/hvm/dom0_build.c       | 16 ++++++++++++++++
>  xen/include/asm-x86/setup.h         |  1 +
>  4 files changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
> index 78b207c0d0..e7973ee509 100644
> --- a/docs/misc/xen-command-line.markdown
> +++ b/docs/misc/xen-command-line.markdown
> @@ -637,7 +637,7 @@ trace feature is only enabled in debugging builds of Xen.
>  Specify the bit width of the DMA heap.
>  
>  ### dom0 (x86)
> -> `= List of [ pvh | shadow ]`
> +> `= List of [ pvh | shadow | verbose ]`
>  
>  > Sub-options:
>  
> @@ -654,6 +654,12 @@ Flag that makes a dom0 boot in PVHv2 mode.
>  Flag that makes a dom0 use shadow paging. Only works when "pvh" is
>  enabled.
>  
> +> `verbose`
> +
> +> Default: `false`
> +
> +Print debug information during dom0 build.
> +

Is there plan to expand this to PV as well? A user reading this may
specify dom0=verbose in a PV setup but find nothing in the log.

The rest looks correct.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH v2 2/2] x86/dom0: add verbose mode and print memory allocation stats
  2019-01-02 12:35   ` Wei Liu
@ 2019-01-02 12:48     ` Roger Pau Monné
  2019-01-02 12:53       ` Wei Liu
  0 siblings, 1 reply; 11+ messages in thread
From: Roger Pau Monné @ 2019-01-02 12:48 UTC (permalink / raw)
  To: Wei Liu
  Cc: Stefano Stabellini, Konrad Rzeszutek Wilk, George Dunlap,
	Andrew Cooper, Ian Jackson, Tim Deegan, Julien Grall,
	Jan Beulich, xen-devel

On Wed, Jan 02, 2019 at 12:35:17PM +0000, Wei Liu wrote:
> On Fri, Dec 28, 2018 at 12:18:57PM +0100, Roger Pau Monne wrote:
> > Add a verbose option to the dom0 command line, so that dom0 builder
> > can print extra debug information when required.
> > 
> > Use this new verbose mode to print statistics about memory allocations
> > when populating dom0 p2m.
> > 
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > ---
> > Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> > Cc: George Dunlap <George.Dunlap@eu.citrix.com>
> > Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> > Cc: Jan Beulich <jbeulich@suse.com>
> > Cc: Julien Grall <julien.grall@arm.com>
> > Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > Cc: Stefano Stabellini <sstabellini@kernel.org>
> > Cc: Tim Deegan <tim@xen.org>
> > Cc: Wei Liu <wei.liu2@citrix.com>
> > ---
> >  docs/misc/xen-command-line.markdown |  8 +++++++-
> >  xen/arch/x86/dom0_build.c           |  3 +++
> >  xen/arch/x86/hvm/dom0_build.c       | 16 ++++++++++++++++
> >  xen/include/asm-x86/setup.h         |  1 +
> >  4 files changed, 27 insertions(+), 1 deletion(-)
> > 
> > diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
> > index 78b207c0d0..e7973ee509 100644
> > --- a/docs/misc/xen-command-line.markdown
> > +++ b/docs/misc/xen-command-line.markdown
> > @@ -637,7 +637,7 @@ trace feature is only enabled in debugging builds of Xen.
> >  Specify the bit width of the DMA heap.
> >  
> >  ### dom0 (x86)
> > -> `= List of [ pvh | shadow ]`
> > +> `= List of [ pvh | shadow | verbose ]`
> >  
> >  > Sub-options:
> >  
> > @@ -654,6 +654,12 @@ Flag that makes a dom0 boot in PVHv2 mode.
> >  Flag that makes a dom0 use shadow paging. Only works when "pvh" is
> >  enabled.
> >  
> > +> `verbose`
> > +
> > +> Default: `false`
> > +
> > +Print debug information during dom0 build.
> > +
> 
> Is there plan to expand this to PV as well? A user reading this may
> specify dom0=verbose in a PV setup but find nothing in the log.

Dom0 PV build is already quite verbose in comparison to PVH. The only
user ATM is indeed PVH Dom0 builder, but it could be used by PV also.

I could add something to the documentation, but I'm afraid it would
get stale.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH v2 2/2] x86/dom0: add verbose mode and print memory allocation stats
  2019-01-02 12:48     ` Roger Pau Monné
@ 2019-01-02 12:53       ` Wei Liu
  0 siblings, 0 replies; 11+ messages in thread
From: Wei Liu @ 2019-01-02 12:53 UTC (permalink / raw)
  To: Roger Pau Monné
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich, xen-devel

On Wed, Jan 02, 2019 at 01:48:43PM +0100, Roger Pau Monné wrote:
> On Wed, Jan 02, 2019 at 12:35:17PM +0000, Wei Liu wrote:
> > On Fri, Dec 28, 2018 at 12:18:57PM +0100, Roger Pau Monne wrote:
> > > Add a verbose option to the dom0 command line, so that dom0 builder
> > > can print extra debug information when required.
> > > 
> > > Use this new verbose mode to print statistics about memory allocations
> > > when populating dom0 p2m.
> > > 
> > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > > ---
> > > Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> > > Cc: George Dunlap <George.Dunlap@eu.citrix.com>
> > > Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> > > Cc: Jan Beulich <jbeulich@suse.com>
> > > Cc: Julien Grall <julien.grall@arm.com>
> > > Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > > Cc: Stefano Stabellini <sstabellini@kernel.org>
> > > Cc: Tim Deegan <tim@xen.org>
> > > Cc: Wei Liu <wei.liu2@citrix.com>
> > > ---
> > >  docs/misc/xen-command-line.markdown |  8 +++++++-
> > >  xen/arch/x86/dom0_build.c           |  3 +++
> > >  xen/arch/x86/hvm/dom0_build.c       | 16 ++++++++++++++++
> > >  xen/include/asm-x86/setup.h         |  1 +
> > >  4 files changed, 27 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
> > > index 78b207c0d0..e7973ee509 100644
> > > --- a/docs/misc/xen-command-line.markdown
> > > +++ b/docs/misc/xen-command-line.markdown
> > > @@ -637,7 +637,7 @@ trace feature is only enabled in debugging builds of Xen.
> > >  Specify the bit width of the DMA heap.
> > >  
> > >  ### dom0 (x86)
> > > -> `= List of [ pvh | shadow ]`
> > > +> `= List of [ pvh | shadow | verbose ]`
> > >  
> > >  > Sub-options:
> > >  
> > > @@ -654,6 +654,12 @@ Flag that makes a dom0 boot in PVHv2 mode.
> > >  Flag that makes a dom0 use shadow paging. Only works when "pvh" is
> > >  enabled.
> > >  
> > > +> `verbose`
> > > +
> > > +> Default: `false`
> > > +
> > > +Print debug information during dom0 build.
> > > +
> > 
> > Is there plan to expand this to PV as well? A user reading this may
> > specify dom0=verbose in a PV setup but find nothing in the log.
> 
> Dom0 PV build is already quite verbose in comparison to PVH. The only
> user ATM is indeed PVH Dom0 builder, but it could be used by PV also.
> 
> I could add something to the documentation, but I'm afraid it would
> get stale.

I'm not too fussed.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH v2 1/2] x86/dom0: take alignment into account when populating p2m in PVH mode
  2018-12-28 11:18 ` [PATCH v2 1/2] x86/dom0: take alignment into account when populating p2m in PVH mode Roger Pau Monne
  2018-12-28 14:29   ` Andrew Cooper
@ 2019-01-04 14:42   ` Jan Beulich
  2019-01-04 15:16     ` Roger Pau Monné
  1 sibling, 1 reply; 11+ messages in thread
From: Jan Beulich @ 2019-01-04 14:42 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: Andrew Cooper, Wei Liu, xen-devel

>>> On 28.12.18 at 12:18, <roger.pau@citrix.com> wrote:
> --- a/xen/arch/x86/hvm/dom0_build.c
> +++ b/xen/arch/x86/hvm/dom0_build.c
> @@ -91,16 +91,54 @@ static int __init pvh_populate_memory_range(struct domain *d,
>                                              unsigned long start,
>                                              unsigned long nr_pages)
>  {
> -    unsigned int order = MAX_ORDER, i = 0;
> +    struct {
> +        unsigned long align;

It's .init.* data only, but anyway - why "long" instead of "int"?

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH v2 1/2] x86/dom0: take alignment into account when populating p2m in PVH mode
  2019-01-04 14:42   ` Jan Beulich
@ 2019-01-04 15:16     ` Roger Pau Monné
  0 siblings, 0 replies; 11+ messages in thread
From: Roger Pau Monné @ 2019-01-04 15:16 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Andrew Cooper, Wei Liu, xen-devel

On Fri, Jan 04, 2019 at 07:42:35AM -0700, Jan Beulich wrote:
> >>> On 28.12.18 at 12:18, <roger.pau@citrix.com> wrote:
> > --- a/xen/arch/x86/hvm/dom0_build.c
> > +++ b/xen/arch/x86/hvm/dom0_build.c
> > @@ -91,16 +91,54 @@ static int __init pvh_populate_memory_range(struct domain *d,
> >                                              unsigned long start,
> >                                              unsigned long nr_pages)
> >  {
> > -    unsigned int order = MAX_ORDER, i = 0;
> > +    struct {
> > +        unsigned long align;
> 
> It's .init.* data only, but anyway - why "long" instead of "int"?

A mistake, unsigned int is fine to store the current alignments, will
send a patch to fix it.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH v2 2/2] x86/dom0: add verbose mode and print memory allocation stats
  2018-12-28 11:18 ` [PATCH v2 2/2] x86/dom0: add verbose mode and print memory allocation stats Roger Pau Monne
  2019-01-02 12:35   ` Wei Liu
@ 2019-01-07 10:01   ` Jan Beulich
  2019-01-07 15:35     ` Roger Pau Monné
  1 sibling, 1 reply; 11+ messages in thread
From: Jan Beulich @ 2019-01-07 10:01 UTC (permalink / raw)
  To: Roger Pau Monne
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, xen-devel

>>> On 28.12.18 at 12:18, <roger.pau@citrix.com> wrote:
> --- a/xen/arch/x86/hvm/dom0_build.c
> +++ b/xen/arch/x86/hvm/dom0_build.c
> @@ -60,6 +60,18 @@ static struct acpi_madt_interrupt_override __initdata *intsrcovr;
>  static unsigned int __initdata acpi_nmi_sources;
>  static struct acpi_madt_nmi_source __initdata *nmisrc;
>  
> +static unsigned int __initdata order_stats[MAX_ORDER + 1] = { };

Pointless initializer.

> +static void __init print_order_stats(void)
> +{
> +    unsigned int i;
> +
> +    printk("Memory allocation stats:\n");

I think this wants prefixing with "Dom0".

> +    for ( i = 0; i < ARRAY_SIZE(order_stats); i++ )
> +        if ( order_stats[i] )
> +            printk("order: %2u allocations: %u\n", i, order_stats[i]);

Why the first of the two colons?

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH v2 2/2] x86/dom0: add verbose mode and print memory allocation stats
  2019-01-07 10:01   ` Jan Beulich
@ 2019-01-07 15:35     ` Roger Pau Monné
  0 siblings, 0 replies; 11+ messages in thread
From: Roger Pau Monné @ 2019-01-07 15:35 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, xen-devel

On Mon, Jan 07, 2019 at 03:01:54AM -0700, Jan Beulich wrote:
> >>> On 28.12.18 at 12:18, <roger.pau@citrix.com> wrote:
> > --- a/xen/arch/x86/hvm/dom0_build.c
> > +++ b/xen/arch/x86/hvm/dom0_build.c
> > @@ -60,6 +60,18 @@ static struct acpi_madt_interrupt_override __initdata *intsrcovr;
> >  static unsigned int __initdata acpi_nmi_sources;
> >  static struct acpi_madt_nmi_source __initdata *nmisrc;
> >  
> > +static unsigned int __initdata order_stats[MAX_ORDER + 1] = { };
> 
> Pointless initializer.
> 
> > +static void __init print_order_stats(void)
> > +{
> > +    unsigned int i;
> > +
> > +    printk("Memory allocation stats:\n");
> 
> I think this wants prefixing with "Dom0".

I will use Dom%u and d->domain_id.

> > +    for ( i = 0; i < ARRAY_SIZE(order_stats); i++ )
> > +        if ( order_stats[i] )
> > +            printk("order: %2u allocations: %u\n", i, order_stats[i]);
> 
> Why the first of the two colons?

Because it's printing the order, I will remove it in the next version.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2019-01-07 15:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-28 11:18 [PATCH v2 0/2] x86/dom0: minor fixes and improvements to PVH builder Roger Pau Monne
2018-12-28 11:18 ` [PATCH v2 1/2] x86/dom0: take alignment into account when populating p2m in PVH mode Roger Pau Monne
2018-12-28 14:29   ` Andrew Cooper
2019-01-04 14:42   ` Jan Beulich
2019-01-04 15:16     ` Roger Pau Monné
2018-12-28 11:18 ` [PATCH v2 2/2] x86/dom0: add verbose mode and print memory allocation stats Roger Pau Monne
2019-01-02 12:35   ` Wei Liu
2019-01-02 12:48     ` Roger Pau Monné
2019-01-02 12:53       ` Wei Liu
2019-01-07 10:01   ` Jan Beulich
2019-01-07 15:35     ` Roger Pau Monné

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.