Re: [PATCH v12 2/4] x86/cpu: Check if feature string is non-zero
From: H. Peter Anvin
Date: Mon Mar 30 2026 - 22:32:48 EST
On 2026-03-30 16:42, H. Peter Anvin wrote:
> On 2026-03-30 15:59, Borislav Petkov wrote:
>> On Mon, Mar 30, 2026 at 02:44:56PM -0700, H. Peter Anvin wrote:
>>> The Right Thing™ would be to have a table in the kernel which includes *all*
>>> the feature bit names, not just the ones exported to /proc/cpuinfo, and use
>>> the unfiltered string table for kernel messages (/proc/cpuinfo being
>>> filtered via a bitmask, list, or a flag in the table.)
>>
>> Meh, not convinced. Not sure it is worth the effort and bloating if we can
>> simply look up the feature from word and bit number.
>>
>
> Bloating? Drop in the bucket compared to other kernel messages. Getting kernel
> messages in cleartext is a good thing.
>
> It's testing a flag... not exactly complicated, just didn't want Maciej to
> complicate this one patchset with it.
>
The main issue is that since we're not allowed to use *sane* scripting
languages in the kernel tree, we have to do everything in the POSIX subset of
awk -- or in C.
Anyway, here is a hacky and mostly untested port of mkcapflags.sh to awk which
also produces an export bitmask. Another alternative would be to simply put a
prefix character like + or - which can simply be skipped for kernel messages
but tested for /proc/cpuinfo generation. Definitely simpler in that there is
no need to haul two pointers around.
-hpa
Attachment:
mkcapflags.awk
Description: application/awk