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: <20200715121657.GE3165313@dell>
Date:   Wed, 15 Jul 2020 13:16:57 +0100
From:   Lee Jones <lee.jones@...aro.org>
To:     "Rafael J. Wysocki" <rafael@...nel.org>
Cc:     Viresh Kumar <viresh.kumar@...aro.org>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        Paul Diefenbaugh <paul.s.diefenbaugh@...el.com>,
        Dominik Brodowski <linux@...do.de>,
        Denis Sadykov <denis.m.sadykov@...el.com>
Subject: Re: [PATCH 09/13] cpufreq: acpi-cpufreq: Remove unused ID structs

On Wed, 15 Jul 2020, Rafael J. Wysocki wrote:

> On Wed, Jul 15, 2020 at 1:50 PM Lee Jones <lee.jones@...aro.org> wrote:
> >
> > On Wed, 15 Jul 2020, Rafael J. Wysocki wrote:
> >
> > > On Wed, Jul 15, 2020 at 1:34 PM Lee Jones <lee.jones@...aro.org> wrote:
> > > >
> > > > On Wed, 15 Jul 2020, Rafael J. Wysocki wrote:
> > > >
> > > > > On Wed, Jul 15, 2020 at 5:27 AM Viresh Kumar <viresh.kumar@...aro.org> wrote:
> > > > > >
> > > > > > On 15-07-20, 08:54, Viresh Kumar wrote:
> > > > > > > On 14-07-20, 22:03, Lee Jones wrote:
> > > > > > > > On Tue, 14 Jul 2020, Rafael J. Wysocki wrote:
> > > > > > > >
> > > > > > > > > On Tue, Jul 14, 2020 at 4:51 PM Lee Jones <lee.jones@...aro.org> wrote:
> > > > > > > > > >
> > > > > > > > > > Can't see them being used anywhere and the compiler doesn't complain
> > > > > > > > > > that they're missing, so ...
> > > > > > > > >
> > > > > > > > > Aren't they needed for automatic module loading in certain configurations?
> > > > > > > >
> > > > > > > > Any idea how that works, or where the code is for that?
> > > > > > >
> > > > > > > The MODULE_DEVICE_TABLE() thingy creates a map of vendor-id,
> > > > > > > product-id that the kernel keeps after boot (and so there is no static
> > > > > > > reference of it for the compiler), later when a device is hotplugged
> > > > > > > into the kernel it refers to the map to find the related driver for it
> > > > > > > and loads it if it isn't already loaded.
> > > > > > >
> > > > > > > This has some of it, search for MODULE_DEVICE_TABLE() in it.
> > > > > > > Documentation/driver-api/usb/hotplug.rst
> > > > > >
> > > > > > And you just need to add __maybe_unused to them to suppress the
> > > > > > warning.
> > > > >
> > > > > Wouldn't that cause the compiler to optimize them away if it doesn't
> > > > > see any users?
> > > >
> > > > It looks like they're only unused when !MODULE,
> > >
> > > OK
> > >
> > > > in which case optimising them away would be the correct thing to do, no?
> >
> > It would be good if someone with a little more knowledge could provide
> > a second opinion though.  I would think (hope) that the compiler would
> > be smart enough to see when its actually in use.  After all, it is the
> > compiler that places the information into the device table.
> >
> If that is not the case, then the MODULE_DEVICE_TABLE() magic is
> > broken and will need fixing.
> 
> I'm not sure why that would be the case?

Nor me.  In fact, take a look at my latest email.  I think I just
proved out that it's not broken.  The warning is valid and
MODULE_DEVICE_TABLE() appears to work just as it should.

> > Removing boiler-plate is good, but not at the expense of obfuscation.
> 
> I'm not following you here to be honest.

Never mind.  It's no longer important.

> BTW, I'm wondering if removing the "static" modifier from the
> definitions of the structures in question makes the warnings you want
> to get rid of go away.

I'm sure that it would.  But that just alludes to the fact that the
tables may be in use elsewhere, which in the case of !MODULE is
untrue.  That's probably more of a hack than using __maybe_unused.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ