|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v4 03/10] tools/libxl: add vmtrace_pt_size parameter
On Tue, Jun 30, 2020 at 02:33:46PM +0200, Michał Leszczyński wrote:
> From: Michal Leszczynski <michal.leszczynski@xxxxxxx>
>
> Allow to specify the size of per-vCPU trace buffer upon
> domain creation. This is zero by default (meaning: not enabled).
>
> Signed-off-by: Michal Leszczynski <michal.leszczynski@xxxxxxx>
> ---
> docs/man/xl.cfg.5.pod.in | 10 ++++++++++
> tools/golang/xenlight/helpers.gen.go | 2 ++
> tools/golang/xenlight/types.gen.go | 1 +
> tools/libxl/libxl.h | 8 ++++++++
> tools/libxl/libxl_create.c | 1 +
> tools/libxl/libxl_types.idl | 2 ++
> tools/xl/xl_parse.c | 20 ++++++++++++++++++++
> xen/common/domain.c | 12 ++++++++++++
> xen/include/public/domctl.h | 1 +
> 9 files changed, 57 insertions(+)
>
> diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
> index 0532739c1f..78f434b722 100644
> --- a/docs/man/xl.cfg.5.pod.in
> +++ b/docs/man/xl.cfg.5.pod.in
> @@ -278,6 +278,16 @@ memory=8096 will report significantly less memory
> available for use
> than a system with maxmem=8096 memory=8096 due to the memory overhead
> of having to track the unused pages.
>
> +=item B<vmtrace_pt_size=BYTES>
> +
> +Specifies the size of processor trace buffer that would be allocated
> +for each vCPU belonging to this domain. Disabled (i.e. B<vmtrace_pt_size=0>
> +by default. This must be set to non-zero value in order to be able to
> +use processor tracing features with this domain.
> +
> +B<NOTE>: The size value must be between 4 kB and 4 GB and it must
I think the minimum value is 8kB, since 4kB would be order 0, which
is used to signal that the feature is disabled?
> diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
> index 61b4ef7b7e..4eba224590 100644
> --- a/tools/xl/xl_parse.c
> +++ b/tools/xl/xl_parse.c
> @@ -1861,6 +1861,26 @@ void parse_config_data(const char *config_source,
> }
> }
>
> + if (!xlu_cfg_get_long(config, "vmtrace_pt_size", &l, 1) && l) {
> + int32_t shift = 0;
unsigned int? I don't think there's a reason for this to be a fixed
width signed integer.
> +
> + if (l & (l - 1))
> + {
> + fprintf(stderr, "ERROR: pt buffer size must be a power of 2\n");
> + exit(1);
> + }
> +
> + while (l >>= 1) ++shift;
> +
> + if (shift <= XEN_PAGE_SHIFT)
> + {
> + fprintf(stderr, "ERROR: too small pt buffer\n");
> + exit(1);
> + }
> +
> + b_info->vmtrace_pt_order = shift - XEN_PAGE_SHIFT;
> + }
> +
> if (!xlu_cfg_get_list(config, "ioports", &ioports, &num_ioports, 0)) {
> b_info->num_ioports = num_ioports;
> b_info->ioports = calloc(num_ioports, sizeof(*b_info->ioports));
> diff --git a/xen/common/domain.c b/xen/common/domain.c
> index 0a33e0dfd6..27dcfbac8c 100644
> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -338,6 +338,12 @@ static int sanitise_domain_config(struct
> xen_domctl_createdomain *config)
> return -EINVAL;
> }
>
> + if ( config->vmtrace_pt_order && !vmtrace_supported )
> + {
> + dprintk(XENLOG_INFO, "Processor tracing is not supported\n");
> + return -EINVAL;
> + }
> +
> return arch_sanitise_domain_config(config);
> }
>
> @@ -443,6 +449,12 @@ struct domain *domain_create(domid_t domid,
> d->nr_pirqs = min(d->nr_pirqs, nr_irqs);
>
> radix_tree_init(&d->pirq_tree);
> +
> + if ( config->vmtrace_pt_order )
> + {
> + uint32_t shift_val = config->vmtrace_pt_order + PAGE_SHIFT;
> + d->vmtrace_pt_size = (1ULL << shift_val);
I don't think the vmtrace_pt_size domain field has been introduced
yet?
Please check that each patch builds on it's own, or else we would
break bisectability of the tree.
Also I would consider just storing this directly as an order, there's
no reason to convert it back to a size?
Thanks, Roger.
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |