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

Re: [PATCH 8/9] x86/amd: Introduce is_zen{1,2}_uarch() predicates


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 18 Sep 2023 16:04:50 +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=iqs/8aBOJK1uVJy9b1CHkFsfApTouh8hfkPeFn+LrMI=; b=UFuP+iyjbgWfvV7TgcILh8W7Bgdfty5NX9cJj6sJ/neaLpE9URAQGAOBn5aP/Smm8xsirwlpWGe2+m8hBR1+7FI+ORgIH/lDYN4Fyj6LmCX4MrpV08WLUo6XLRBqPmvssJA2bGzIhCJDY7P6rbad/6b9ZIICCY+fHfsQTvEvhTLmn/CsMDSTrtPXy1ZPz5cHxvGL4fqweg2mRL+EdOht5iUSZHuPdfpSW97kyUh5Fbm4cTc34t2VFXKgC9QQ7kMEvJOKqMkNVTKy7G01Mp2mo5cXzPUgiUFqNTO8Jdr8+Dbr7Mk4328odjfgsYQIRVOHB4LFqMZC7Eykr1ASlIER3Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bxuu+r6qV/gwgqEpu3p01uv1jKh9srH1zr5CtWAP5cKx8sW7QFjrhmdPYGPoa+ZHtLiX+75VNDCQcSAz97Chi9fWi4sC7pnXT+ZgJ1PrLWI4A8ncuJ59CATmywIK9cninWj1Sq0GZ5vEbg5whxZMo3xBHXY10T6dOnM2HJQoIZ3vtmfaSrWdauxvE8rKUCxh9TM41f4bJLzmNT/oERo3KayEoezckeNLEJUY5hr/mE69IU9ZKr1kdWL9sqWKS5NL+Kz5fzCzYpEu6gCrpgwwFn0EQTn3U3k4TIhVL4+WyN45qqFRaio/hl5uTNUHLOI1qe0q1ZtJ0kSM1jebatJRNw==
  • 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: Mon, 18 Sep 2023 14:05:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18.09.2023 16:02, Andrew Cooper wrote:
> On 18/09/2023 12:07 pm, Jan Beulich wrote:
>> On 15.09.2023 17:00, Andrew Cooper wrote:
>>> --- a/xen/arch/x86/include/asm/amd.h
>>> +++ b/xen/arch/x86/include/asm/amd.h
>>> @@ -140,6 +140,17 @@
>>>                         AMD_MODEL_RANGE(0x11, 0x0, 0x0, 0xff, 0xf), \
>>>                         AMD_MODEL_RANGE(0x12, 0x0, 0x0, 0xff, 0xf))
>>>  
>>> +/*
>>> + * The Zen1 and Zen2 microarchitectures are implemented by AMD (Fam17h) and
>>> + * Hygon (Fam18h) but without simple model number rules.  Instead, use 
>>> STIBP
>>> + * as a heuristic that distinguishes the two.
>>> + *
>>> + * The caller is required to perform the appropriate vendor/family checks
>>> + * first.
>>> + */
>>> +#define is_zen1_uarch() (!boot_cpu_has(X86_FEATURE_AMD_STIBP))
>>> +#define is_zen2_uarch()   boot_cpu_has(X86_FEATURE_AMD_STIBP)
>>> +
>>>  struct cpuinfo_x86;
>>>  int cpu_has_amd_erratum(const struct cpuinfo_x86 *, int, ...);
>> With one simply the opposite of the other, and with the requirement of a
>> family check up front, do we really need both? Personally I'd prefer if
>> we had just the latter. Yet in any event
>> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> We specifically do want both, because they're use is not symmetric at
> callsites.
> 
> In particular, having only one would make the following patch illogical
> to read.

I don't think it would, but that's perhaps one more of the many areas where
we take different perspectives.

Jan



 


Rackspace

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