[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <a6145d2a-e1a9-41b4-8017-5bbf37ec2d65@app.fastmail.com>
Date: Wed, 05 Mar 2025 23:45:11 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Borislav Petkov" <bp@...en8.de>, "Ingo Molnar" <mingo@...nel.org>
Cc: "Arnd Bergmann" <arnd@...nel.org>, "Thomas Gleixner" <tglx@...utronix.de>,
"Ingo Molnar" <mingo@...hat.com>,
"Dave Hansen" <dave.hansen@...ux.intel.com>, x86@...nel.org,
"Kuppuswamy Sathyanarayanan" <sathyanarayanan.kuppuswamy@...ux.intel.com>,
"Rick Edgecombe" <rick.p.edgecombe@...el.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
"Tom Lendacky" <thomas.lendacky@....com>, "H. Peter Anvin" <hpa@...or.com>,
"Jason A . Donenfeld" <Jason@...c4.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86: coco: mark cc_mask as __maybe_unused
On Wed, Mar 5, 2025, at 23:20, Borislav Petkov wrote:
> On Wed, Mar 05, 2025 at 11:17:00PM +0100, Borislav Petkov wrote:
>>
>> Touch ~17 spots:
>>
>> $ git grep -w cc_mask arch/x86 | wc -l
>> 17
>>
>> just because of some stupid gcc extra warning switch?
It's only one outside of CONFIG_ARCH_HAS_CC_PLATFORM, the
other ones always see the 'extern' declaration.
> This warning has been kicked out into W1 once already for too many false
> positives:
>
> c9c6837d3931 ("kbuild: move -Wunused-const-variable to W=1 warning level")
Yes, that was me. We have now come to the point where only about
a dozen instances are left and I resubmitted the remaining patches
for most of them.
There is a twist here: clang by default warns about unused const
variables in .c files but not in headers, while gcc doesn't
warn about them at all unless it's explictly enabled, and then
it warns about both of them. Newer gcc versions have a distinct
-Wunused-const-variable=1 for the clang behavior and
-Wunused-const-variable=2 that warns for both, so we could
reasonably decide to enable the =1 version by default and
leave the =2 version for W=2.
On the other hand, most of the users of 'static const' variables
in headers are rather dumb and should just be moved into the
file that uses them, or they can be replaced with a #define
or an enum.
In this case, the only user is a macro:
#define _PAGE_CC (_AT(pteval_t, cc_mask))
so maybe '#define cc_mask 0' would be appropriate.
Arnd
Powered by blists - more mailing lists