From nobody Fri Apr 19 21:34:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1578488732; cv=none; d=zohomail.com; s=zohoarc; b=Wfhf4qTyymPcZK/BKKsBqAhxYTZpp74Jr1PmN8amvSGffst5KCUpEEV0+lLmsb2utXU5h0+oNoX/dZ3xMl5tYU3KtjwDpuRIo6b/dMaBuAT1Xku4Fbg6jFS4teBPu6JzUfiueY5Fr2/qI1/1H5BvD5CcLA3cx4XLZ23AYb1GO7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578488732; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=PQbSzlWDDJDWdamBC5wbngDcr47BFwp8DXL5Tk8EMz4=; b=QmRyXlvPLT6QPQkV/btVxBj4WWClpqm5CYDQPWCAHYsb5xUj/4Ontsu/wdcq5A+1CoJkxbY08wLNEWYajadZqa7FkLpifhUwR5jz2MEj2MjvMo9CDDO9u4S0a7Q2tqRKHzqgBdsaFduMKMUbRlxjjZGi5ToyYJarHS/ZwbDigfs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1578488732231773.7295540803922; Wed, 8 Jan 2020 05:05:32 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ipB0y-0006cJ-0K; Wed, 08 Jan 2020 13:04:48 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ipB0w-0006cE-Vc for xen-devel@lists.xenproject.org; Wed, 08 Jan 2020 13:04:47 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 6c7e849c-3217-11ea-b263-bc764e2007e4; Wed, 08 Jan 2020 13:04:38 +0000 (UTC) X-Inumbo-ID: 6c7e849c-3217-11ea-b263-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578488677; h=from:to:cc:subject:date:message-id:mime-version; bh=bJNwF1pXNTl3IzneV+/hJWXIYFqW4vdSr9cjTpTNdyY=; b=ITCB8BaeHBdx6ff4A9U9Qur4n1Lbd030bdI9jkOUyv8cff9l7C0ilth3 M9V5XubvCE3fn76MztddpIf7heivF/Z+kybap2BJLiI2x3FQ9mc6CZrJ6 O1rlFuqQcOiwSaqvw0xQly9Arr4Toqg+vLOp5LXbPpT3762KewcicDQM4 g=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: phtkZoZ6GmT4boc73RcDowctShpqe1rY3yrFCgzU1zY0nVTcg+z4YajsL/CXCRLdKjpltArsSH 5Fb9R8y2LrVQHKoYP997oxMR1SUhDYuhYfDV5lSni/OrE9ntr3yd4I6HeNEUN6hcLSNTI2xELx kV3YHu7yVv2WrTIN3GS/Pgxed+QYFvVQv3JiDMapGMHfRGZvaVotO1OBnfqZeroLFHRTwf13Z1 GBk3SC4d1+SO+mzZxXHBHK3yuCb6a8MOfyALX3oCEZjEuBGmCchGyi3oK09ArAlqP2BJJiIq4N 2Zw= X-SBRS: 2.7 X-MesageID: 11207738 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,410,1571716800"; d="scan'208";a="11207738" From: Andrew Cooper To: Xen-devel Date: Wed, 8 Jan 2020 13:04:33 +0000 Message-ID: <20200108130433.7102-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH RFC] tools/libxl: Remove libxl_cpuid_{set, apply_policy}() from the API X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Andrew Cooper , Wei Liu , Ian Jackson Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) These functions should never have been exposed. They don't have exernal users, and can't usefully be used for several reasons. Move libxl_cpuid_{set,apply_policy}() to being internal functions, and leave an equivelent of the nop stubs in the API for caller compatibility. Signed-off-by: Andrew Cooper --- CC: Ian Jackson CC: Wei Liu CC: Anthony PERARD RFC for obvious reasons. An alternative would be to #if 0 them, which would result in a compile failure rather than silent stubbing. I'm not sure which is least bad, but I don't think either are going to cause a problem in practice. --- tools/libxl/libxl.h | 26 ++++++++++++++++++++++---- tools/libxl/libxl_cpuid.c | 6 +++--- tools/libxl/libxl_dom.c | 4 ++-- tools/libxl/libxl_internal.h | 4 ++++ tools/libxl/libxl_nocpuid.c | 6 +++--- 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 54abb9db1f..a02548f595 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -665,7 +665,7 @@ typedef struct libxl__ctx libxl_ctx; #if LIBXL_API_VERSION !=3D 0x040200 && LIBXL_API_VERSION !=3D 0x040300 && \ LIBXL_API_VERSION !=3D 0x040400 && LIBXL_API_VERSION !=3D 0x040500 && \ LIBXL_API_VERSION !=3D 0x040700 && LIBXL_API_VERSION !=3D 0x040800 && \ - LIBXL_API_VERSION !=3D 0x041300 + LIBXL_API_VERSION !=3D 0x041300 && LIBXL_API_VERSION !=3D 0x041400 #error Unknown LIBXL_API_VERSION #endif #endif @@ -2323,9 +2323,27 @@ libxl_device_pci *libxl_device_pci_assignable_list(l= ibxl_ctx *ctx, int *num); int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* s= tr); int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid, const char* str); -void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid); -void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid, - libxl_cpuid_policy_list cpuid); +#if LIBXL_API_VERSION < 0x041400 +/* + * Dropped from the API in Xen 4.14. At the time of writing, these functi= ons + * don't appear to ever have had external callers. + * + * These have always been used internally during domain construction, and + * can't easily be used externally because of their implicit parameters in + * other pieces of global state. + * + * Furthermore, an API user can't usefully determine whether they get + * libxl_cpuid (the real implementation) or libxl_nocpuid (no-op stubs). + * + * The internal behaviour of these functions also needs to change. Theref= ore + * for simplicitly, provide the no-op stubs. Yes technically this is an A= PI + * change in some cases for existing software, but there is 0 of that in + * practice. + */ +static inline void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid= ) {} +static inline void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid, + libxl_cpuid_policy_list cpuid) {} +#endif =20 /* * Functions for allowing users of libxl to store private data diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c index 5c52cbe0f9..505ec1b048 100644 --- a/tools/libxl/libxl_cpuid.c +++ b/tools/libxl/libxl_cpuid.c @@ -410,13 +410,13 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_= list *cpuid, return 0; } =20 -void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid) +void libxl__cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid) { xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0); } =20 -void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid, - libxl_cpuid_policy_list cpuid) +void libxl__cpuid_set(libxl_ctx *ctx, uint32_t domid, + libxl_cpuid_policy_list cpuid) { int i; char *cpuid_res[4]; diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index cdb294ab8d..e2926cf190 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -625,9 +625,9 @@ int libxl__build_post(libxl__gc *gc, uint32_t domid, if (rc) return rc; =20 - libxl_cpuid_apply_policy(ctx, domid); + libxl__cpuid_apply_policy(ctx, domid); if (info->cpuid !=3D NULL) - libxl_cpuid_set(ctx, domid, info->cpuid); + libxl__cpuid_set(ctx, domid, info->cpuid); =20 if (info->type =3D=3D LIBXL_DOMAIN_TYPE_HVM && !libxl_ms_vm_genid_is_zero(&info->u.hvm.ms_vm_genid)) { diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index ba8c9b41ab..3194702284 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -2042,6 +2042,10 @@ struct libxl__cpuid_policy { char *policy[4]; }; =20 +_hidden void libxl__cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid); +_hidden void libxl__cpuid_set(libxl_ctx *ctx, uint32_t domid, + libxl_cpuid_policy_list cpuid); + /* Calls poll() again - useful to check whether a signaled condition * is still true. Cannot fail. Returns currently-true revents. */ _hidden short libxl__fd_poll_recheck(libxl__egc *egc, int fd, short events= ); diff --git a/tools/libxl/libxl_nocpuid.c b/tools/libxl/libxl_nocpuid.c index ef1161c434..a39babe754 100644 --- a/tools/libxl/libxl_nocpuid.c +++ b/tools/libxl/libxl_nocpuid.c @@ -34,12 +34,12 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_li= st *cpuid, return 0; } =20 -void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid) +void libxl__cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid) { } =20 -void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid, - libxl_cpuid_policy_list cpuid) +void libxl__cpuid_set(libxl_ctx *ctx, uint32_t domid, + libxl_cpuid_policy_list cpuid) { } =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel