lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 24 Jun 2024 00:29:27 -0700
From: Xin Li <xin@...or.com>
To: Brian Gerst <brgerst@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
        tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
        dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com,
        will@...nel.org, peterz@...radead.org, akpm@...ux-foundation.org,
        acme@...nel.org, namhyung@...nel.org
Subject: Re: [PATCH v3 4/4] x86/cpufeatures: Use AWK to generate
 {REQUIRED|DISABLED}_MASK_BIT_SET

On 6/23/2024 1:28 PM, Brian Gerst wrote:
> On Sat, Jun 22, 2024 at 1:14 PM Xin Li (Intel) <xin@...or.com> wrote:
>>
>> Generate macros {REQUIRED|DISABLED}_MASK_BIT_SET in the newly added AWK
>> script that generates the required and disabled feature mask header.
>>
>> Suggested-by: Brian Gerst <brgerst@...il.com>
>> Signed-off-by: Xin Li (Intel) <xin@...or.com>
>> ---
>>   arch/x86/include/asm/cpufeature.h | 69 -------------------------------
>>   arch/x86/tools/featuremasks.awk   | 12 +++++-
>>   2 files changed, 11 insertions(+), 70 deletions(-)
>>

>> -               printf "#define %s_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != %d)\n\n", s, ncapints;
>> +               printf "\n#define %s_FEATURE(x)\t\t\t\t\\\n", s;
>> +               printf "\t((\t\t\t\t\t";
>> +               for (i = 0; i < ncapints; i++) {
>> +                       if (masks[i])
>> +                               printf "\t\\\n\t\t((x) >> 5) == %2d ? %s_MASK%d :", i, s, i;
>> +               }
>> +               printf " 0\t\\\n";
>> +               printf "\t) & (1 << ((x) & 31)))\n";
> 
> The original macro had 1UL here.  I don't know if it is strictly
> necessary in this case since we're using 32-bit masks, but it would
> probably be safer.

I did notice it, but don't think UL is needed.

>> +
>> +               printf "\n#define %s_MASK_BIT_SET(x)\t\t\t\\\n", s;
>> +               printf "\t(%s_FEATURE(x) || BUILD_BUG_ON_ZERO(NCAPINTS != %d))\n\n", s, ncapints;
> 
> Checking NCAPINTS isn't necessary anymore.  It was needed when these
> macros had to be manually updated, but now if cpufeatures.h changes
> this header will be regenerated.

Right, it's no longer needed.  Let me update this patch.

Thanks!
     Xin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ