x86/dom0: add verbose mode and print memory allocation stats
PATCH v3 1/1 x86/dom0: add verbose mode and print memory allocation stats
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.
---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
---
Changes since v2:
- Remove pointless initialization.
- Print domain id.
- Change print format.
--- docs/misc/xen-command-line.pandoc | 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(-)
docs/misc/xen-command-line.pandoc +7 -1
@@ -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 ]`
xen/arch/x86/dom0_build.c +3 -0
@@ -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 ;
xen/arch/x86/hvm/dom0_build.c +16 -0
@@ -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 (const struct domain *d) +{ +unsigned int i; + +printk ("Dom%u memory allocation stats:\n" , 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]); +} +static int __init modify_identity_mmio (struct domain *d,unsigned long pfn,unsigned long nr_pages,const bool map) {
@@ -169,6 +181,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 (); }
@@ -465,6 +478,9 @@ static int __init pvh_setup_p2m(struct domain *d)return rc; } +if ( dom0_verbose ) +print_order_stats (d); +return 0 ;#undef MB1_PAGES }
xen/include/asm-x86/setup.h +1 -0
@@ -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)
Signature · 7 lines
2.17.2 (Apple Git-113) _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 07.01.19 at 17:22, <[email protected]> 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é <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel