From nobody Fri Nov 22 18:42:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=cloud.com ARC-Seal: i=1; a=rsa-sha256; t=1716457326; cv=none; d=zohomail.com; s=zohoarc; b=h4ntGpoVBWjRVm2wnsvzxwj9oPmXd2XfEOdBb2syKdHFvgIu1XgZkuvfxYUYIsFHs+gTXLUmjCpCFnrPe9HyFd9UOKiCE5ztdCKHXvP48C1PUHbrRmYeqcRvI5fkQiANfM6i9p0Eugtpu/SUOKSPStn5S/ObKDtK+lmaPOUJlJc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716457326; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=d4DEPVfsDZMMBgcybIhN0dPitEHEoXs+kEgdv7X07o8=; b=Ks5YBPTuqpoLDqWNzFAucuMhAcQP40UN55YxNTl8Z2kWUlnLKHutC6J7D8Z8zSO0NwZvpmXZUtOJHy0kYysBJ9WySE2NUBAYYg7hXkU3krp8ipu4Igaw/YDeQxKaLMCsvSoTtIjIkCD7wR7bKXWNW1O254LZT4smn87rYk8CPpE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1716457326861320.4064573972097; Thu, 23 May 2024 02:42:06 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.728282.1133164 (Exim 4.92) (envelope-from ) id 1sA4xI-0004JZ-Ie; Thu, 23 May 2024 09:41:48 +0000 Received: by outflank-mailman (output) from mailman id 728282.1133164; Thu, 23 May 2024 09:41:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sA4xI-0004JQ-Eq; Thu, 23 May 2024 09:41:48 +0000 Received: by outflank-mailman (input) for mailman id 728282; Thu, 23 May 2024 09:41:47 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sA4xH-00043S-3I for xen-devel@lists.xenproject.org; Thu, 23 May 2024 09:41:47 +0000 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [2a00:1450:4864:20::433]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a9d7a555-18e8-11ef-b4bb-af5377834399; Thu, 23 May 2024 11:41:43 +0200 (CEST) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-34d7d04808bso1550423f8f.0 for ; Thu, 23 May 2024 02:41:43 -0700 (PDT) Received: from EMEAENGAAD19049.citrite.net (0545937c.skybroadband.com. [5.69.147.124]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-354c7df311esm9533383f8f.3.2024.05.23.02.41.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 02:41:42 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a9d7a555-18e8-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1716457303; x=1717062103; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=d4DEPVfsDZMMBgcybIhN0dPitEHEoXs+kEgdv7X07o8=; b=PLmfQk065Nm7BW7ZPPoD/qejUW34303F1zR1jCnXWxZwVdIIk5MGi0wZzkJejUb027 AyAmjZV/wYQ1Q5b8unyNv83wzSdtqsAUCewS5B5XBQtkWXRXL3Llnll99WToZkRD56uG AkuC+9OlcmiLR7U4M5xrGNiccNoz1Ysfu0vgM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716457303; x=1717062103; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d4DEPVfsDZMMBgcybIhN0dPitEHEoXs+kEgdv7X07o8=; b=VrXS6wejdV7DmGeL0BNu7FQxe5lYsYH8MUzPeib8/F0yM/M+STnoKSVPRbtlIRjazE xf7k4EkBSs/SpZIG0nfXZVBPw3xt2N8tAcLh7lFdS47yMC2uaAPPRA+zm96ExtoSxCoJ 1HiT8kiPEegvgbdfeItKt/OAgBk4udy4wTDJdzZK/r8K6qMlDPVbNClGO1Oiw8WvcdIx LInutPIumtIx7nRiNRk4nOPAafMdVbMYFBe4pv7giZB+vfKEbjQZKYJH6RF2586jGu60 8+VPBD1O3YYdHs53mWB18yUC5GReg1pvfUzTtfL81YUee8KHwZBROOFp5rSl9rgWbxSp 8eqQ== X-Gm-Message-State: AOJu0YxciTjkklnlsm0N9wXrKpHnQ9Hr9vPwVfa1oXp/v6PgpXDnBhar VrnkCDiIcHDCsHGWSptobf7I7hjqIT54ZEiUy/2pm8T+Q9FrbmAOngd+RZTmb+uXlF9Fq6quM3R M X-Google-Smtp-Source: AGHT+IEJytYQW8m3Pu7Ukg+JaaaH8S60s+n5e0NtgoSsx2Rit7ASpqlL97DlKIg4YVIt5cqTMF5k7Q== X-Received: by 2002:adf:9bdc:0:b0:354:e729:c100 with SMTP id ffacd0b85a97d-354e729c251mr3530141f8f.3.1716457302632; Thu, 23 May 2024 02:41:42 -0700 (PDT) From: Alejandro Vallejo To: Xen-devel Cc: Alejandro Vallejo , Anthony PERARD , Juergen Gross , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v3 1/2] tools/xg: Streamline cpu policy serialise/deserialise calls Date: Thu, 23 May 2024 10:41:29 +0100 Message-Id: <5c6ee74b60bad4eb9cc8e17dbfcf7158d38bd32c.1716457040.git.alejandro.vallejo@cloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @cloud.com) X-ZM-MESSAGEID: 1716457327335100005 Content-Type: text/plain; charset="utf-8" The idea is to use xc_cpu_policy_t as a single object containing both the serialised and deserialised forms of the policy. Note that we need lengths for the arrays, as the serialised policies may be shorter than the array capacities. * Add the serialised lengths to the struct so we can distinguish between length and capacity of the serialisation buffers. * Remove explicit buffer+lengths in serialise/deserialise calls and use the internal buffer inside xc_cpu_policy_t instead. * Refactor everything to use the new serialisation functions. * Remove redundant serialization calls and avoid allocating dynamic memory aside from the policy objects in xen-cpuid. Also minor cleanup in the policy print call sites. No functional change intended. Signed-off-by: Alejandro Vallejo Acked-by: Roger Pau Monn=C3=A9 --- v3: * Better context scoping in xg_sr_common_x86. * Can't be const because write_record() takes non-const. * Adjusted line length of xen-cpuid's print_policy. * Adjusted error messages in xen-cpuid's print_policy. * Reverted removal of overscoped loop indices. --- tools/include/xenguest.h | 8 ++- tools/libs/guest/xg_cpuid_x86.c | 98 ++++++++++++++++++++--------- tools/libs/guest/xg_private.h | 2 + tools/libs/guest/xg_sr_common_x86.c | 56 ++++++----------- tools/misc/xen-cpuid.c | 41 ++++-------- 5 files changed, 106 insertions(+), 99 deletions(-) diff --git a/tools/include/xenguest.h b/tools/include/xenguest.h index e01f494b772a..563811cd8dde 100644 --- a/tools/include/xenguest.h +++ b/tools/include/xenguest.h @@ -799,14 +799,16 @@ int xc_cpu_policy_set_domain(xc_interface *xch, uint3= 2_t domid, xc_cpu_policy_t *policy); =20 /* Manipulate a policy via architectural representations. */ -int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t *poli= cy, - xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves, - xen_msr_entry_t *msrs, uint32_t *nr_msrs); +int xc_cpu_policy_serialise(xc_interface *xch, xc_cpu_policy_t *policy); int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t *policy, const xen_cpuid_leaf_t *leaves, uint32_t nr); int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t *policy, const xen_msr_entry_t *msrs, uint32_t nr); +int xc_cpu_policy_get_leaves(xc_interface *xch, const xc_cpu_policy_t *pol= icy, + const xen_cpuid_leaf_t **leaves, uint32_t *nr= ); +int xc_cpu_policy_get_msrs(xc_interface *xch, const xc_cpu_policy_t *polic= y, + const xen_msr_entry_t **msrs, uint32_t *nr); =20 /* Compatibility calculations. */ bool xc_cpu_policy_is_compatible(xc_interface *xch, xc_cpu_policy_t *host, diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x8= 6.c index 4453178100ad..4f4b86b59470 100644 --- a/tools/libs/guest/xg_cpuid_x86.c +++ b/tools/libs/guest/xg_cpuid_x86.c @@ -834,14 +834,13 @@ void xc_cpu_policy_destroy(xc_cpu_policy_t *policy) } } =20 -static int deserialize_policy(xc_interface *xch, xc_cpu_policy_t *policy, - unsigned int nr_leaves, unsigned int nr_entr= ies) +static int deserialize_policy(xc_interface *xch, xc_cpu_policy_t *policy) { uint32_t err_leaf =3D -1, err_subleaf =3D -1, err_msr =3D -1; int rc; =20 rc =3D x86_cpuid_copy_from_buffer(&policy->policy, policy->leaves, - nr_leaves, &err_leaf, &err_subleaf); + policy->nr_leaves, &err_leaf, &err_sub= leaf); if ( rc ) { if ( err_leaf !=3D -1 ) @@ -851,7 +850,7 @@ static int deserialize_policy(xc_interface *xch, xc_cpu= _policy_t *policy, } =20 rc =3D x86_msr_copy_from_buffer(&policy->policy, policy->msrs, - nr_entries, &err_msr); + policy->nr_msrs, &err_msr); if ( rc ) { if ( err_msr !=3D -1 ) @@ -878,7 +877,10 @@ int xc_cpu_policy_get_system(xc_interface *xch, unsign= ed int policy_idx, return rc; } =20 - rc =3D deserialize_policy(xch, policy, nr_leaves, nr_msrs); + policy->nr_leaves =3D nr_leaves; + policy->nr_msrs =3D nr_msrs; + + rc =3D deserialize_policy(xch, policy); if ( rc ) { errno =3D -rc; @@ -903,7 +905,10 @@ int xc_cpu_policy_get_domain(xc_interface *xch, uint32= _t domid, return rc; } =20 - rc =3D deserialize_policy(xch, policy, nr_leaves, nr_msrs); + policy->nr_leaves =3D nr_leaves; + policy->nr_msrs =3D nr_msrs; + + rc =3D deserialize_policy(xch, policy); if ( rc ) { errno =3D -rc; @@ -917,17 +922,14 @@ int xc_cpu_policy_set_domain(xc_interface *xch, uint3= 2_t domid, xc_cpu_policy_t *policy) { uint32_t err_leaf =3D -1, err_subleaf =3D -1, err_msr =3D -1; - unsigned int nr_leaves =3D ARRAY_SIZE(policy->leaves); - unsigned int nr_msrs =3D ARRAY_SIZE(policy->msrs); int rc; =20 - rc =3D xc_cpu_policy_serialise(xch, policy, policy->leaves, &nr_leaves, - policy->msrs, &nr_msrs); + rc =3D xc_cpu_policy_serialise(xch, policy); if ( rc ) return rc; =20 - rc =3D xc_set_domain_cpu_policy(xch, domid, nr_leaves, policy->leaves, - nr_msrs, policy->msrs, + rc =3D xc_set_domain_cpu_policy(xch, domid, policy->nr_leaves, policy-= >leaves, + policy->nr_msrs, policy->msrs, &err_leaf, &err_subleaf, &err_msr); if ( rc ) { @@ -942,34 +944,32 @@ int xc_cpu_policy_set_domain(xc_interface *xch, uint3= 2_t domid, return rc; } =20 -int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t *p, - xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves, - xen_msr_entry_t *msrs, uint32_t *nr_msrs) +int xc_cpu_policy_serialise(xc_interface *xch, xc_cpu_policy_t *p) { + unsigned int nr_leaves =3D ARRAY_SIZE(p->leaves); + unsigned int nr_msrs =3D ARRAY_SIZE(p->msrs); int rc; =20 - if ( leaves ) + rc =3D x86_cpuid_copy_to_buffer(&p->policy, p->leaves, &nr_leaves); + if ( rc ) { - rc =3D x86_cpuid_copy_to_buffer(&p->policy, leaves, nr_leaves); - if ( rc ) - { - ERROR("Failed to serialize CPUID policy"); - errno =3D -rc; - return -1; - } + ERROR("Failed to serialize CPUID policy"); + errno =3D -rc; + return -1; } =20 - if ( msrs ) + p->nr_leaves =3D nr_leaves; + + rc =3D x86_msr_copy_to_buffer(&p->policy, p->msrs, &nr_msrs); + if ( rc ) { - rc =3D x86_msr_copy_to_buffer(&p->policy, msrs, nr_msrs); - if ( rc ) - { - ERROR("Failed to serialize MSR policy"); - errno =3D -rc; - return -1; - } + ERROR("Failed to serialize MSR policy"); + errno =3D -rc; + return -1; } =20 + p->nr_msrs =3D nr_msrs; + errno =3D 0; return 0; } @@ -1012,6 +1012,42 @@ int xc_cpu_policy_update_msrs(xc_interface *xch, xc_= cpu_policy_t *policy, return rc; } =20 +int xc_cpu_policy_get_leaves(xc_interface *xch, + const xc_cpu_policy_t *policy, + const xen_cpuid_leaf_t **leaves, + uint32_t *nr) +{ + if ( !policy ) + { + ERROR("Failed to fetch CPUID leaves from policy object"); + errno =3D -EINVAL; + return -1; + } + + *leaves =3D policy->leaves; + *nr =3D policy->nr_leaves; + + return 0; +} + +int xc_cpu_policy_get_msrs(xc_interface *xch, + const xc_cpu_policy_t *policy, + const xen_msr_entry_t **msrs, + uint32_t *nr) +{ + if ( !policy ) + { + ERROR("Failed to fetch MSRs from policy object"); + errno =3D -EINVAL; + return -1; + } + + *msrs =3D policy->msrs; + *nr =3D policy->nr_msrs; + + return 0; +} + bool xc_cpu_policy_is_compatible(xc_interface *xch, xc_cpu_policy_t *host, xc_cpu_policy_t *guest) { diff --git a/tools/libs/guest/xg_private.h b/tools/libs/guest/xg_private.h index d73947094f2e..a65dae818f3d 100644 --- a/tools/libs/guest/xg_private.h +++ b/tools/libs/guest/xg_private.h @@ -177,6 +177,8 @@ struct xc_cpu_policy { struct cpu_policy policy; xen_cpuid_leaf_t leaves[CPUID_MAX_SERIALISED_LEAVES]; xen_msr_entry_t msrs[MSR_MAX_SERIALISED_ENTRIES]; + uint32_t nr_leaves; + uint32_t nr_msrs; }; #endif /* x86 */ =20 diff --git a/tools/libs/guest/xg_sr_common_x86.c b/tools/libs/guest/xg_sr_c= ommon_x86.c index 563b4f016877..a0d67c3211c6 100644 --- a/tools/libs/guest/xg_sr_common_x86.c +++ b/tools/libs/guest/xg_sr_common_x86.c @@ -1,4 +1,5 @@ #include "xg_sr_common_x86.h" +#include "xg_sr_stream_format.h" =20 int write_x86_tsc_info(struct xc_sr_context *ctx) { @@ -45,54 +46,39 @@ int handle_x86_tsc_info(struct xc_sr_context *ctx, stru= ct xc_sr_record *rec) int write_x86_cpu_policy_records(struct xc_sr_context *ctx) { xc_interface *xch =3D ctx->xch; - struct xc_sr_record cpuid =3D { .type =3D REC_TYPE_X86_CPUID_POLICY, }; - struct xc_sr_record msrs =3D { .type =3D REC_TYPE_X86_MSR_POLICY, }; - uint32_t nr_leaves =3D 0, nr_msrs =3D 0; - xc_cpu_policy_t *policy =3D NULL; + xc_cpu_policy_t *policy =3D xc_cpu_policy_init(); int rc; =20 - if ( xc_cpu_policy_get_size(xch, &nr_leaves, &nr_msrs) < 0 ) - { - PERROR("Unable to get CPU Policy size"); - return -1; - } - - cpuid.data =3D malloc(nr_leaves * sizeof(xen_cpuid_leaf_t)); - msrs.data =3D malloc(nr_msrs * sizeof(xen_msr_entry_t)); - policy =3D xc_cpu_policy_init(); - if ( !cpuid.data || !msrs.data || !policy ) - { - ERROR("Cannot allocate memory for CPU Policy"); - rc =3D -1; - goto out; - } - - if ( xc_cpu_policy_get_domain(xch, ctx->domid, policy) ) + if ( !policy || xc_cpu_policy_get_domain(xch, ctx->domid, policy) ) { PERROR("Unable to get d%d CPU Policy", ctx->domid); rc =3D -1; goto out; } - if ( xc_cpu_policy_serialise(xch, policy, cpuid.data, &nr_leaves, - msrs.data, &nr_msrs) ) - { - PERROR("Unable to serialize d%d CPU Policy", ctx->domid); - rc =3D -1; - goto out; - } =20 - cpuid.length =3D nr_leaves * sizeof(xen_cpuid_leaf_t); - if ( cpuid.length ) + + if ( policy->nr_leaves ) { - rc =3D write_record(ctx, &cpuid); + struct xc_sr_record record =3D { + .type =3D REC_TYPE_X86_CPUID_POLICY, + .data =3D policy->leaves, + .length =3D policy->nr_leaves * sizeof(*policy->leaves), + }; + + rc =3D write_record(ctx, &record); if ( rc ) goto out; } =20 - msrs.length =3D nr_msrs * sizeof(xen_msr_entry_t); - if ( msrs.length ) + if ( policy->nr_msrs ) { - rc =3D write_record(ctx, &msrs); + struct xc_sr_record record =3D { + .type =3D REC_TYPE_X86_MSR_POLICY, + .data =3D policy->msrs, + .length =3D policy->nr_msrs * sizeof(*policy->msrs), + }; + + rc =3D write_record(ctx, &record); if ( rc ) goto out; } @@ -100,8 +86,6 @@ int write_x86_cpu_policy_records(struct xc_sr_context *c= tx) rc =3D 0; =20 out: - free(cpuid.data); - free(msrs.data); xc_cpu_policy_destroy(policy); =20 return rc; diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c index 4c4593528dfe..488f43378406 100644 --- a/tools/misc/xen-cpuid.c +++ b/tools/misc/xen-cpuid.c @@ -156,12 +156,18 @@ static void dump_info(xc_interface *xch, bool detail) =20 free(fs); } - -static void print_policy(const char *name, - xen_cpuid_leaf_t *leaves, uint32_t nr_leaves, - xen_msr_entry_t *msrs, uint32_t nr_msrs) +static void print_policy(xc_interface *xch, const char *name, + const xc_cpu_policy_t *policy) { unsigned int l; + const xen_cpuid_leaf_t *leaves; + const xen_msr_entry_t *msrs; + uint32_t nr_leaves, nr_msrs; + + if ( xc_cpu_policy_get_leaves(xch, policy, &leaves, &nr_leaves) ) + err(1, "xc_cpu_policy_get_leaves()"); + if ( xc_cpu_policy_get_msrs(xch, policy, &msrs, &nr_msrs) ) + err(1, "xc_cpu_policy_get_msrs()"); =20 printf("%s policy: %u leaves, %u MSRs\n", name, nr_leaves, nr_msrs); printf(" CPUID:\n"); @@ -287,8 +293,6 @@ int main(int argc, char **argv) [ XEN_SYSCTL_cpu_policy_pv_default ] =3D "PV Default", [ XEN_SYSCTL_cpu_policy_hvm_default ] =3D "HVM Default", }; - xen_cpuid_leaf_t *leaves; - xen_msr_entry_t *msrs; uint32_t i, max_leaves, max_msrs; =20 xc_interface *xch =3D xc_interface_open(0, 0, 0); @@ -305,36 +309,21 @@ int main(int argc, char **argv) printf("Xen reports there are maximum %u leaves and %u MSRs\n", max_leaves, max_msrs); =20 - leaves =3D calloc(max_leaves, sizeof(xen_cpuid_leaf_t)); - if ( !leaves ) - err(1, "calloc(max_leaves)"); - msrs =3D calloc(max_msrs, sizeof(xen_msr_entry_t)); - if ( !msrs ) - err(1, "calloc(max_msrs)"); - if ( domid !=3D -1 ) { char name[20]; - uint32_t nr_leaves =3D max_leaves; - uint32_t nr_msrs =3D max_msrs; =20 if ( xc_cpu_policy_get_domain(xch, domid, policy) ) err(1, "xc_cpu_policy_get_domain(, %d, )", domid); - if ( xc_cpu_policy_serialise(xch, policy, leaves, &nr_leaves, - msrs, &nr_msrs) ) - err(1, "xc_cpu_policy_serialise"); =20 snprintf(name, sizeof(name), "Domain %d", domid); - print_policy(name, leaves, nr_leaves, msrs, nr_msrs); + print_policy(xch, name, policy); } else { /* Get system policies */ for ( i =3D 0; i < ARRAY_SIZE(sys_policies); ++i ) { - uint32_t nr_leaves =3D max_leaves; - uint32_t nr_msrs =3D max_msrs; - if ( xc_cpu_policy_get_system(xch, i, policy) ) { if ( errno =3D=3D EOPNOTSUPP ) @@ -346,18 +335,12 @@ int main(int argc, char **argv) =20 err(1, "xc_cpu_policy_get_system(, %s, )", sys_policie= s[i]); } - if ( xc_cpu_policy_serialise(xch, policy, leaves, &nr_leav= es, - msrs, &nr_msrs) ) - err(1, "xc_cpu_policy_serialise"); =20 - print_policy(sys_policies[i], leaves, nr_leaves, - msrs, nr_msrs); + print_policy(xch, sys_policies[i], policy); } } =20 xc_cpu_policy_destroy(policy); - free(leaves); - free(msrs); xc_interface_close(xch); } else if ( mode =3D=3D MODE_INFO || mode =3D=3D MODE_DETAIL ) --=20 2.34.1