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

Re: [PATCH 3/3] x86: short-circuit certain cpu_has_* when x86-64-v{2,3} are in effect


  • To: Jason Andryuk <jandryuk@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 17 Jul 2023 15:38:29 +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=bh+DerWxjcV2fBc4UQ5cv/e7uwkaIgO/C3ikGXVp2yQ=; b=SrQGkFs+yiky0gkOjEixSB/vZ21B1DjGQYCnpIEy8GynhXyKAFhtHg9wm18mj+ENoKMANAY2ponYK4lGjAr6wGQ5YdIVqcJAXgNawhu0+QXdX9I3peBTI9Ulcjd3c/Zwt/5G9nNd21IbSfCWxrHnVtRcijV5srT6otS/yRVxPsIPQQb8AZlN2PSQA+pjHn9aw52Po7rc5lmMrcu8olwyrr1oP3oF5fbU6B9kHKHIcwDZQFuwruDYEWMJzhiA0U4Ei4Ploh3/7JHD3JrziJByK4l6MFZJh4XOKPqzWnhs8X/NYDi6IbinpNO0zViuMJgrl1Q9fhfjACxCWUxDi1BT7Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=inmJ/KS55mcf/coa2FEp8Fy170v+ZOaHaMhYKDUmnT6QvDfmmUMpeBGj0RHden9vj46tBUIH3yA2CpaEsoHL2YtrQUl012IP8q7SCHH6qK9fJDPx6SbN8fm9yFpHI6YTCi+3M40D9NYoi/UCcoGWAi9jtqL3BP+GGnjYvBU1prsw6GOmvvIhji+rDt/QyWeSUoG091JFF3rCXwkPIxxo+VxM88FQzzS88TulrXF1cRGmsYPlg56Di1kBhl3tvq6KbTGyWUwOBiFtHXldJSLTitLd94xTjsTuzzwu+3AcHisP4+h4YAXl/QMKN4IIqTl5fVHzzZWZzb91ciDdAz/1kQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 17 Jul 2023 13:38:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 17.07.2023 14:35, Jason Andryuk wrote:
> On Wed, Jul 12, 2023 at 8:36 AM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>
>> Certain fallback code can be made subject to DCE this way. Note that
>> CX16 has no compiler provided manifest constant, so CONFIG_* are used
>> there instead. Note also that we don't have cpu_has_movbe nor
>> cpu_has_lzcnt (aka cpu_has_abm).
>>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> Reviewed-by: Jason Andryuk <jandryuk@xxxxxxxxx>

Thanks.

>> --- a/xen/arch/x86/include/asm/cpufeature.h
>> +++ b/xen/arch/x86/include/asm/cpufeature.h
>> @@ -76,13 +76,19 @@ static inline bool boot_cpu_has(unsigned
>>  #define cpu_has_eist            boot_cpu_has(X86_FEATURE_EIST)
>>  #define cpu_has_ssse3           boot_cpu_has(X86_FEATURE_SSSE3)
>>  #define cpu_has_fma             boot_cpu_has(X86_FEATURE_FMA)
>> -#define cpu_has_cx16            boot_cpu_has(X86_FEATURE_CX16)
>> +#define cpu_has_cx16            (IS_ENABLED(CONFIG_X86_64_V2) || \
>> +                                 IS_ENABLED(CONFIG_X86_64_V3) || \
>> +                                 boot_cpu_has(X86_FEATURE_CX16))
> 
> If you think there may be more ABI selections in the future, it might
> be better to express the "V$N" numerically and check >= 2.  Or you can
> add a Kconfig CONFIG_X86_64_CX16 and select that as appropriate.  But
> if there aren't going to be more of these, then this is fine.

I was thinking this same way: If more appear (which aren't SIMD-only,
like v4 is), we can use a numeric CONFIG_*, but for now it's good
enough (and slightly simpler) this way.

Jan



 


Rackspace

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