[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v8 08/16] xen/domain: Add vmtrace_size domain creation parameter
- To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Mon, 1 Feb 2021 11:51:40 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KYLg1wGSXbQKI4Z4xRkQiVWoIqP80XI6rUhcotB2DRg=; b=jOIGhg2wWTLoakI2+7zIL9e0JJXu38Fjbr0I2DPWEvzLiPVwJmY4JeMToQcgLQz9H2NpTsuo0RDIiVryy1Bf07lwx6noI1nWAQVU/+JdlVYCdBEt50QgpZlNkR7upJJYv4WVwiM7kjsm360sinB9k1jfmoyjWZ+fRRW6eaYtooAXkl5S9+XOJXxKjIUxrvrzaNcz4DP/0dE3YaC3i8l3fttSf1GkC6aGhPjoj3jnSK/KKR1b1WFHo1sZ2b316SzXyRs5Egtv5Pfesc5Ltc5wweLPovNlC2nidMLFWNy/S8Z1NzFthR41SkTdmeLdwXTOa8JeHMHndR/IrWJ5cnjBkA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a2IEpwaaUalgnFYdc+kBa1wsK8LQ3gbR/CjyAfYv2mguFYANJRA8oSO2jm4udJK+jMGzFsRXnSeKmQofFcXjdE7kiwbwAkXttN9bZIwA23kgFiE0q6oMdmPR+Te/y6RB0gK8sl0BQA9GrypeApcxqpAUIUpZ/whVeO8ALtihLoYhKD7bFWnvqGb+cc/VAwHS7pwA6KeiOxZu3ZnqYubNrmiuvg+ICNhR6TuCFuCcNPSNha8VDmfsCQRgyeofue9E4qIWifLJYFdwtT/IM5Vt6wH/Ae8eZWtH48870V6eIscsA0QiodNgnTWEtfuaP67naiHyEk5Z43q8XYamsEgVcw==
- Authentication-results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Michał Leszczyński <michal.leszczynski@xxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>
- Delivery-date: Mon, 01 Feb 2021 10:52:05 +0000
- Ironport-sdr: 3jBgMnvTeCgPLpUuyhrNiTegVVrAdxvSNhexpm2gNTbol48gS1D737pY/K3Nrlz1HJViOXP12j AjOXelFhS+IO4jsJ2gl+KFoUHjtryomFvvjybHoZXRsW8W23FlFBK+0AbmCGAkzwDJveg5Rt7a h1zWeSY+QzP5j/N8QkIkVFK1EaLtxzSdBWwfgcqdYScPM+Uw8N/83K4pAUfOwYLXwuCHfsGG8o 7/HNt/i8v4XRg33edxpgvkZT9Rzyh/2lq7D0BWdJhnmf0novThBbn06ylfIL4NGZwYBV8TFA/7 OpQ=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Sat, Jan 30, 2021 at 02:58:44AM +0000, Andrew Cooper wrote:
> From: Michał Leszczyński <michal.leszczynski@xxxxxxx>
>
> To use vmtrace, buffers of a suitable size need allocating, and different
> tasks will want different sizes.
>
> Add a domain creation parameter, and audit it appropriately in the
> {arch_,}sanitise_domain_config() functions.
>
> For now, the x86 specific auditing is tuned to Processor Trace running in
> Single Output mode, which requires a single contiguous range of memory.
>
> The size is given an arbitrary limit of 64M which is expected to be enough for
> anticipated usecases, but not large enough to get into long-running-hypercall
> problems.
>
> Signed-off-by: Michał Leszczyński <michal.leszczynski@xxxxxxx>
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> diff --git a/xen/common/domain.c b/xen/common/domain.c
> index d1e94d88cf..491b32812e 100644
> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -132,6 +132,71 @@ static void vcpu_info_reset(struct vcpu *v)
> v->vcpu_info_mfn = INVALID_MFN;
> }
>
> +static void vmtrace_free_buffer(struct vcpu *v)
> +{
> + const struct domain *d = v->domain;
> + struct page_info *pg = v->vmtrace.pg;
> + unsigned int i;
> +
> + if ( !pg )
> + return;
> +
> + v->vmtrace.pg = NULL;
> +
> + for ( i = 0; i < (d->vmtrace_size >> PAGE_SHIFT); i++ )
> + {
> + put_page_alloc_ref(&pg[i]);
> + put_page_and_type(&pg[i]);
> + }
> +}
> +
> +static int vmtrace_alloc_buffer(struct vcpu *v)
You might as well make this return true/false, as the error code is
ignored by the caller (at least in this patch).
Thanks, Roger.
|