[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH v3 13/13] x86: replace open-coded occurrences of sizeof_field()...


  • To: Paul Durrant <paul@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Mon, 30 Nov 2020 02:48:19 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.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=x3sqJ4zOMuW/7klBLWT2EcsUv5E5sUH3HBV6NHvBMI4=; b=WP2csqRx0kvlyURRn0dA6qxEn2OMyxL8p8363UAiyVjIy0kMIsEdfVmyPjYqSAWYg2bNG18QKdUtqHkRGKKEK0tZZUCaZsrfKgY8KnXUngFm2hwGUDyXV1oK980wk9h6oyUL9rD4AcB5gb7fy4Q9jifZdwwQPXwstmJAYy2cyj/B2guGWs1flBBL1JpeFJ3h1HOJzyfz4rvr4ECjWgR+0W+C9SChmWZKCyrHMGbSQiSdyMDGcIgwSrU2TCgeBXTOet/bMXgFxcKgCKia2xzxztw2twhppG6RaOWPHQaAZqWaGT66h8IQBo1CGTUMCj+14XuSki0P9hdaAscaksOBqg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ai+4F7U8mio+/ht1sGh1ZKVHqFRm01YGT7bQoxKg0Zq9tcGXgwW/iGnW6wYjyaw/rGlplc6YsI5QnR2mTnKtao45PUnZtK9YaTSQWkgR1cDWTjNzbgOJXVaB33cngYH/byXfMOIZrd+HXdWmfkvx4Y1P/Wd/ZFI4mZsV13VrCO//F59aiLR8wwJAvt5YQfeBdExR4LQEU6kVtgG1qAT8Ww6gC95dtWBS9aeccqUvjMcz6MOeO+Xk8Okql/GRir3Xp7upiK3HjdfkWQyABKMtGtM/SjSC4jMjK1H3VAX+tVSUEP0k7ftdR6mg35Va3dJvetucqaoYUx1vdvOsHyQA+Q==
  • Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=intel.com;
  • Cc: Paul Durrant <pdurrant@xxxxxxxxxx>, "Nakajima, Jun" <jun.nakajima@xxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, "Cooper, Andrew" <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 30 Nov 2020 02:48:39 +0000
  • Dlp-product: dlpe-windows
  • Dlp-reaction: no-action
  • Dlp-version: 11.5.1.3
  • Ironport-sdr: Ul+B/BCCOIltWytTIzMplUYu/sAT8jGd1QGlyltEkEj8RD5EPCxXHpQGD64QOqrWNS11FxkEZx thnRbACRoumw==
  • Ironport-sdr: 9XTw6KOFLyjkmdYJ9SJRy4Zh/ztqsfp193sHe345yWgPJWLmGc7DDl/PRSe19BBYFOAUQ5yy4L eQtwIYyhfVHA==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHWwphVvkgPQ2EqeUezHV5G5mGBFKngASIQ
  • Thread-topic: [PATCH v3 13/13] x86: replace open-coded occurrences of sizeof_field()...

> From: Paul Durrant <paul@xxxxxxx>
> Sent: Wednesday, November 25, 2020 3:08 AM
> 
> From: Paul Durrant <pdurrant@xxxxxxxxxx>
> 
> ... with macro evaluations, now that it is available.
> 
> A recent patch imported the sizeof_field() macro from Linux. This patch
> makes
> use of it in places where the construct is currently open-coded.
> 
> Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>

> ---
> Cc: Jun Nakajima <jun.nakajima@xxxxxxxxx>
> Cc: Kevin Tian <kevin.tian@xxxxxxxxx>
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Cc: "Roger Pau Monné" <roger.pau@xxxxxxxxxx>
> Cc: Wei Liu <wl@xxxxxxx>
> ---
>  xen/arch/x86/cpu/vpmu_intel.c |  4 ++--
>  xen/arch/x86/setup.c          | 16 ++++++++--------
>  2 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/xen/arch/x86/cpu/vpmu_intel.c
> b/xen/arch/x86/cpu/vpmu_intel.c
> index 75aa11c6adec..6e97ce790037 100644
> --- a/xen/arch/x86/cpu/vpmu_intel.c
> +++ b/xen/arch/x86/cpu/vpmu_intel.c
> @@ -90,8 +90,8 @@ static uint64_t __read_mostly global_ovf_ctrl_mask,
> global_ctrl_mask;
>  static unsigned int __read_mostly regs_sz;
>  /* Offset into context of the beginning of PMU register block */
>  static const unsigned int regs_off =
> -        sizeof(((struct xen_pmu_intel_ctxt *)0)->fixed_counters) +
> -        sizeof(((struct xen_pmu_intel_ctxt *)0)->arch_counters);
> +    sizeof_field(struct xen_pmu_intel_ctxt, fixed_counters) +
> +    sizeof_field(struct xen_pmu_intel_ctxt, arch_counters);
> 
>  /*
>   * QUIRK to workaround an issue on various family 6 cpus.
> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
> index 44c04e273537..30d6f375a3af 100644
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -1617,19 +1617,19 @@ void __init noreturn __start_xen(unsigned long
> mbi_p)
>      total_pages = nr_pages;
> 
>      /* Sanity check for unwanted bloat of certain hypercall structures. */
> -    BUILD_BUG_ON(sizeof(((struct xen_platform_op *)0)->u) !=
> -                 sizeof(((struct xen_platform_op *)0)->u.pad));
> -    BUILD_BUG_ON(sizeof(((struct xen_domctl *)0)->u) !=
> -                 sizeof(((struct xen_domctl *)0)->u.pad));
> -    BUILD_BUG_ON(sizeof(((struct xen_sysctl *)0)->u) !=
> -                 sizeof(((struct xen_sysctl *)0)->u.pad));
> +    BUILD_BUG_ON(sizeof_field(struct xen_platform_op, u) !=
> +                 sizeof_field(struct xen_platform_op, u.pad));
> +    BUILD_BUG_ON(sizeof_field(struct xen_domctl, u) !=
> +                 sizeof_field(struct xen_domctl, u.pad));
> +    BUILD_BUG_ON(sizeof_field(struct xen_sysctl, u) !=
> +                 sizeof_field(struct xen_sysctl, u.pad));
> 
>      BUILD_BUG_ON(sizeof(start_info_t) > PAGE_SIZE);
>      BUILD_BUG_ON(sizeof(shared_info_t) > PAGE_SIZE);
>      BUILD_BUG_ON(sizeof(struct vcpu_info) != 64);
> 
> -    BUILD_BUG_ON(sizeof(((struct compat_platform_op *)0)->u) !=
> -                 sizeof(((struct compat_platform_op *)0)->u.pad));
> +    BUILD_BUG_ON(sizeof_field(struct compat_platform_op, u) !=
> +                 sizeof_field(struct compat_platform_op, u.pad));
>      BUILD_BUG_ON(sizeof(start_info_compat_t) > PAGE_SIZE);
>      BUILD_BUG_ON(sizeof(struct compat_vcpu_info) != 64);
> 
> --
> 2.20.1


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.