From: "Arnd Bergmann" <arnd@arndb.de>
To: "Borislav Petkov" <bp@alien8.de>, "Ingo Molnar" <mingo@kernel.org>
Cc: "Arnd Bergmann" <arnd@kernel.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
x86@kernel.org,
"Kuppuswamy Sathyanarayanan"
<sathyanarayanan.kuppuswamy@linux.intel.com>,
"Rick Edgecombe" <rick.p.edgecombe@intel.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
"Tom Lendacky" <thomas.lendacky@amd.com>,
"H. Peter Anvin" <hpa@zytor.com>,
"Jason A . Donenfeld" <Jason@zx2c4.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: coco: mark cc_mask as __maybe_unused
Date: Wed, 05 Mar 2025 23:45:11 +0100 [thread overview]
Message-ID: <a6145d2a-e1a9-41b4-8017-5bbf37ec2d65@app.fastmail.com> (raw)
In-Reply-To: <20250305222052.GAZ8jORCVmKQhEkrw6@fat_crate.local>
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
next prev parent reply other threads:[~2025-03-05 22:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-04 14:33 [PATCH] x86: coco: mark cc_mask as __maybe_unused Arnd Bergmann
2025-03-04 19:55 ` Sathyanarayanan Kuppuswamy
2025-03-05 9:02 ` Kirill A. Shutemov
2025-03-05 10:44 ` Ingo Molnar
2025-03-05 22:17 ` Borislav Petkov
2025-03-05 22:20 ` Borislav Petkov
2025-03-05 22:45 ` Arnd Bergmann [this message]
2025-03-05 22:50 ` Borislav Petkov
2025-03-06 5:38 ` Huang, Kai
2025-03-10 13:10 ` Arnd Bergmann
2025-03-10 13:50 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a6145d2a-e1a9-41b4-8017-5bbf37ec2d65@app.fastmail.com \
--to=arnd@arndb.de \
--cc=Jason@zx2c4.com \
--cc=arnd@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox