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

Re: [PATCH 7/9] x86: Merge xc_cpu_policy's cpuid and msr objects


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 30 Mar 2023 12:04:44 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FJxnHILv8YrC+nRl0RWcJEJl3oIOaH/Q1FGBUlFzHiE=; b=Tt+Tqc8YSSBCOn6Fcewox+hRo43WMy9Ch8jnvC42ewoZjnIu0i/BqHd5O3wjQ/lKYh0wE81TG/6iuucIXXW2iUx+zZ7Wpu4ise2ZorWtO9tOggeWIF1hW+oJ82EwzCgm2wlAT1yes9h7+YjRioZGajDTRXD5srdGqn7AGAzRn/Yj0yIQdRTaBUq+R3HRDK5qWIYTYzClvo8y7uWr3hsYeWHpUX8gi2iaMrbdl0jv++oeZLgnbfjurzEYi4n0mUFOi1AgzqDLQICjZFbfjWzOp9NTGY1pX+JEYUWeMGzXReR+TCoirj6F1q4wysczUBrjIv7oRYxmIrf5uHbFrS2klA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mk4/Mzse5TTJ2PHRhDafkmdhBZMvkpBXyeqPsF1P0Ko6U3lyn6efV7PXmPnvk945EEIQyoT74JQDJBwFx+j2Wjpjy6UAi+cSL4GtLfnOx4+hWhhKMf+e4wsSqCq2F4sYy0axVFVas9ahiZwiGczYoCY4HKVtDwgJ/GtF8jw4euBtTTwFWe2iZRWTS6AjTgnhrWAUK/u+AD50/YCF2kiDtm5FAWZ9dFFTqtcbyMe548+t+jOdOfyYEHLJ5ONHUZlWQuxOxn3jnvyPr1xTD0aDqmaXjq+WrFax05LHZ3UWHVvkUu/MBPEKNtQuWk6nOM3n/S1/Gl639chN2NgBPnhgRw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 30 Mar 2023 10:04:57 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 29.03.2023 22:51, Andrew Cooper wrote:
>  /* Sanity test various invariants we expect in the default/max policies. */
>  static void test_guest_policies(const struct xc_cpu_policy *max,
>                                  const struct xc_cpu_policy *def)
>  {
> -    const struct cpuid_policy *cm = &max->cpuid;
> -    const struct cpuid_policy *cd = &def->cpuid;
> -    const struct msr_policy *mm = &max->msr;
> -    const struct msr_policy *md = &def->msr;
> +    const struct cpu_policy *m = &max->policy;
> +    const struct cpu_policy *d = &def->policy;

Looks like you could reduce code churn by keeping "cm" and "cd" as the
names, which would also be consistent with you continuing to use "cp"
in hypervisor code.

Jan

>      dump_tsx_details(max, "Max:");
>      dump_tsx_details(def, "Def:");
>  
> -    if ( ((cm->feat.raw[0].d | cd->feat.raw[0].d) &
> +    if ( ((m->feat.raw[0].d | d->feat.raw[0].d) &
>            (bitmaskof(X86_FEATURE_TSX_FORCE_ABORT) |
>             bitmaskof(X86_FEATURE_RTM_ALWAYS_ABORT) |
>             bitmaskof(X86_FEATURE_SRBDS_CTRL))) ||
> -         ((mm->arch_caps.raw | md->arch_caps.raw) & ARCH_CAPS_TSX_CTRL) )
> +         ((m->arch_caps.raw | d->arch_caps.raw) & ARCH_CAPS_TSX_CTRL) )
>          fail("  Xen-only TSX controls offered to guest\n");
>  
>      switch ( rtm_behaviour )
>      {
>      case RTM_UD:
> -        if ( (cm->feat.raw[0].b | cd->feat.raw[0].b) &
> +        if ( (m->feat.raw[0].b | d->feat.raw[0].b) &
>               (bitmaskof(X86_FEATURE_HLE) | bitmaskof(X86_FEATURE_RTM)) )
>               fail("  HLE/RTM offered to guests despite not being 
> available\n");
>          break;
>  
>      case RTM_ABORT:
> -        if ( cd->feat.raw[0].b &
> +        if ( d->feat.raw[0].b &
>               (bitmaskof(X86_FEATURE_HLE) | bitmaskof(X86_FEATURE_RTM)) )
>               fail("  HLE/RTM offered to guests by default despite not being 
> usable\n");
>          break;
>  
>      case RTM_OK:
> -        if ( !cm->feat.rtm || !cd->feat.rtm )
> +        if ( !m->feat.rtm || !d->feat.rtm )
>               fail("  RTM not offered to guests despite being available\n");
>          break;
>      }
>  
> -    if ( cd->feat.hle )
> +    if ( d->feat.hle )
>          fail("  Fail: HLE offered in default policy\n");
>  }
>  




 


Rackspace

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