[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8F9E89A4-B05B-493C-8BED-52AC6777D915@zytor.com>
Date: Mon, 17 Jun 2024 06:46:28 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Xin Li <xin@...or.com>, linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org
CC: tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, x86@...nel.org, will@...nel.org,
peterz@...radead.org, akpm@...ux-foundation.org, acme@...nel.org,
namhyung@...nel.org
Subject: Re: [RESEND v1 2/3] x86/cpufeatures: Generate a feature mask header based on build config
On June 16, 2024 12:26:48 AM PDT, Xin Li <xin@...or.com> wrote:
>On 5/9/2024 1:53 PM, Xin Li (Intel) wrote:
>> From: "H. Peter Anvin (Intel)" <hpa@...or.com>
>>
>> Introduce an AWK script to auto-generate a header with required and
>> disabled feature masks based on <asm/cpufeatures.h> and current build
>> config. Thus for any CPU feature with a build config, e.g., X86_FRED,
>> simply add
>
>...
>
>> +
>> + printf "\n#define %s_MASKS ", s;
>> + pfx = "{";
>> + for (i = 0; i < ncapints; i++) {
>> + printf "%s \\\n\t%s_MASK_%d", pfx, s, i;
>> + pfx = ",";
>> + }
>> + printf " \\\n}\n\n";
>> +
>> + printf "#define %s_FEATURE(x) \\\n", s;
>> + printf "\t((( ";
>> + for (i = 0; i < ncapints; i++) {
>> + if (masks[i]) {
>> + printf "\\\n\t\t((x) >> 5) == %2d ? %s_MASK%-3d : ", i, s, i;
>> + }
>> + }
>> + printf "0 \\\n";
>> + printf "\t) >> ((x) & 31)) & 1)\n\n";
>
>This code generates macros {REQUIRED,DISABLED}_FEATURE(x) to tell if a
>CPU feature, e.g., X86_FEATURE_FRED, is a required or disabled feature
>for this particular compile-time configuration.
>
>But they are NOT currently used, so I prefer to remove them for now.
>
>Thanks!
> Xin
The goal with these is that it can eliminate the handwritten code that tests a long list of masks. Again, automation.
Powered by blists - more mailing lists