Re: [PATCH] x86/cpufeatures: Free up unused feature bits

From: H. Peter Anvin
Date: Fri Nov 08 2024 - 10:31:53 EST


On November 8, 2024 3:17:24 AM GMT+01:00, Sohil Mehta <sohil.mehta@xxxxxxxxx> wrote:
>On 11/7/2024 5:12 PM, Dave Hansen wrote:
>> Sohil, go look at:
>>
>> # cat /sys/devices/system/cpu/modalias
>> cpu:type:x86,ven0000fam0006mod008C:feature:,0000,0001,0002,0003,0004,0005,0006,...
>>
>
>Thanks for the explanation. Peter's comment makes sense to me now.
>
>>
>> I sure hope we haven't been using too many of these synthetic features
>> in MODULE_DEVICE_TABLE()s, because we tend to move them around, but I
>> guess it's possible.
>
>I found at least one recent usage that matches this pattern.
>Look at commit cbcddaa33d7e ("perf/x86/rapl: Use CPUID bit on AMD and
>Hygon parts"). It defines a synthetic feature bit X86_FEATURE_RAPL and
>adds it to the rapl_model_match[] table.
>
> MODULE_DEVICE_TABLE(x86cpu, rapl_model_match);
>
>It almost seems like some of these bits are now ABI. We probably need to
>mark them and keep these mappings pinned to avoid future issues.
>Recycling these bits seems to be very common.

It was a really unfortunate choice of ABI design, especially since there already were name strings available...