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

Re: [PATCH 2/3] x86/amd: Drop vestigial PBE logic in init_amd()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 27 Nov 2025 18:21:35 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=XcEwWd3xzdC7eQUR6Drz9RkwNP3m1aUhUqCqI6AFl2Y=; b=LSzsaYKWgZ2iwXS5y97/59YVg1mCPkFciI32hiW4UUmbfsuGebRU4Go2c5NJ2VwcqhOJ3Q9P9ItMZt2H/JqTpxhrYljBt3kv1wsirn+3yX+fjVstxYV5ktX6mTrpa6qUYcKic+ciWoVtkLPehRR7FqVpilNWfPnwdW4V7DXe7PiJIjYsRV2jVwTRD405fUrBP7S0e4gYTgoj7uff5Rxa+ve6gyQPBuVkPurtBIWbA6PmAec1T3EjWFxkAl7kXcjtEuQea1YPHST19bkf36tKhQ6K6cAXUDFU8ZAEY0v06tqyO3t0zJqcTqvbBQ68yHn27Y1MzX9NVG8H8thuSZ1n/g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eHMhsj8oYjkQ83c9c1dD2QCwpU5qsfD/mCrshe6YSxPjkmBspQ5W5zC8U/8THqGtfXP3nXZAEt1A4qKs6/amgQbIhWsMfDjIskl9S+zgWm1lktiHu8JGcGC9PTwxYL9uvNawWj4zIfVDBj0/dSwNO923zPw+TmkM23eJMa0D0jUsr/SLpXWLT3r0SgAj2wzdpayQEeObi/O1dx589lW/hvSUz5xvV+lYb5LiWKtgV3u34NGXKQfqOoxOk4PyPvRjV+pX6x0nu3smPZTxM+kgael1I0GvOzYMbsYrvG0gVIyQ0dLerczrJVpQQEY+uIDHkmB1wNbUGTH0o3bYY7CTKA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: andrew.cooper3@xxxxxxxxxx, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 27 Nov 2025 18:22:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27/11/2025 8:44 am, Jan Beulich wrote:
> On 26.11.2025 18:15, Andrew Cooper wrote:
>> The comment was adjusted by myself in commit 51bd4bbdfdba ("x86: drop
>> X86_FEATURE_3DNOW_ALT"), on the presumption that the underlying logic existed
>> for a good reason.
>>
>> Having done further archaeology, it turns out to be vestigial technical debt
>> from the leadup to Linux 2.4 in November 2000.
>>
>> Prior to "Massive cleanup of CPU detection and bug handling",
>> c->x86_capability was a single uint32_t containing cpuid(1).edx,
>> cpuid(0x80000001).edx, or a synthesis thereof.  X86_FEATURE_AMD3D was defined
>> as the top bit this single uint32_t.
>>
>> After "Massive cleanup of CPU detection and bug handling",
>> c->x86_capability became an array with AMD's extended feature leaf split
>> away from Intel's basic feature leaf.
>>
>> AMD doc #20734-G states that 3DNow is only enumerated in the extended
>> feature leaf, and that other vendors where using this bit too.  i.e. AMD
>> never produced a CPU which set bit 31 in the basic leaf, meaning that
>> there's nothing to clear out in the first place.
>>
>> This logic looks like it was relevant in the pre-"Massive cleanup" world
>> but ought to have been dropped when c->x86_capability was properly split.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Acked-by: Jan Beulich <jbeulich@xxxxxxxx>

Thanks.

> albeit I think that, along the lines of a comment I made on Matrix, that ...
>
>> --- a/xen/arch/x86/cpu/amd.c
>> +++ b/xen/arch/x86/cpu/amd.c
>> @@ -1131,13 +1131,6 @@ static void cf_check init_amd(struct cpuinfo_x86 *c)
>>              wrmsrl(MSR_K8_HWCR, value);
>>      }
>>  
>> -    /*
>> -     * Some AMD CPUs duplicate the 3DNow bit in base and extended CPUID
>> -     * leaves.  Unfortunately, this aliases PBE on Intel CPUs. Clobber the
>> -     * alias, leaving 3DNow in the extended leaf.
>> -     */
>> -    __clear_bit(X86_FEATURE_PBE, c->x86_capability);
> ... while the justification applies to what the CPUs surface on their own,
> the basic leaf masking MSR could (likely) still have undue bits set, and
> hence may want pruning in exchange / addition.

As said, the ability to control CPUID in this way postdates by a decade
this logic in Linux, and this logic came about because of a logical
issue/shortcut taken by Linux, not because of a CPU which really
mis-reported this bit.

We do have logic which adjusts the override MSRs on AMD based on errata.

~Andrew



 


Rackspace

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