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]
Message-ID: <jhjblizdofu.mognet@arm.com>
Date:   Tue, 25 Aug 2020 11:12:21 +0100
From:   Valentin Schneider <valentin.schneider@....com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        linux-kernel@...r.kernel.org,
        Dietmar Eggemann <dietmar.eggemann@....com>
Subject: Re: [PATCH v1] sched/topology: Make compiler happy about unused constant definitions


On 25/08/20 10:03, Valentin Schneider wrote:
> On 25/08/20 09:26, Andy Shevchenko wrote:
>> On Mon, Aug 24, 2020 at 06:09:41PM +0100, Valentin Schneider wrote:
>>> On 24/08/20 16:39, Andy Shevchenko wrote:
>>> > Compilation of almost each file ends up with
>>> >
>>> >  In file included from .../include/linux/energy_model.h:10,
>>> >                 from .../include/linux/device.h:16,
>>> >                 from .../drivers/spi/spi.c:8:
>>> >  .../include/linux/sched/topology.h:30:27: warning: ‘SD_DEGENERATE_GROUPS_MASK’ defined but not used [-Wunused-const-variable=]
>>> >     30 | static const unsigned int SD_DEGENERATE_GROUPS_MASK =
>>> >        |                           ^~~~~~~~~~~~~~~~~~~~~~~~~
>>> >  ...
>>> >
>>> > Make compiler happy by annotating the static constants with __maybwe_unused.

> Sorry, that's what I get for trying to be too succinct; what I tried to say
> was that SD_DEGENERATE_GROUPS_MASK should very much be used for SMP. If the
> build is !SMP, it shouldn't even be defined, IOW I'm perplexed as to where
> this is coming from.

So I see how having this as a constvar rather than a constexpr is somewhat
daft (we get an instance per compilation unit), but none of my compilers
seem to complain (even with W=1). AFAIA the kernelbot didn't catch any of
it either.

Out of curiosity, what's your compiler & compiler version?

Alternatively we can make this a "proper" constant expression with the
below.
---

diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
index 2d59ca77103e..b1331c4c48e9 100644
--- a/include/linux/sched/topology.h
+++ b/include/linux/sched/topology.h
@@ -27,9 +27,11 @@ enum {

 /* Generate a mask of SD flags with the SDF_NEEDS_GROUPS metaflag */
 #define SD_FLAG(name, mflags) (name * !!((mflags) & SDF_NEEDS_GROUPS)) |
-static const unsigned int SD_DEGENERATE_GROUPS_MASK =
+enum {
+	SD_DEGENERATE_GROUPS_MASK =
 #include <linux/sched/sd_flags.h>
-0;
+0
+};
 #undef SD_FLAG

 #ifdef CONFIG_SCHED_DEBUG

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ