[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87h6rb6rok.ffs@tglx>
Date: Tue, 13 Jun 2023 22:19:39 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Eric DeVolder <eric.devolder@...cle.com>,
Greg KH <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, david@...hat.com, osalvador@...e.de,
corbet@....net, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, x86@...nel.org, bhe@...hat.com,
ebiederm@...ssion.com, kexec@...ts.infradead.org, hpa@...or.com,
rafael@...nel.org, vgoyal@...hat.com, dyoung@...hat.com,
lf32.dev@...il.com, akpm@...ux-foundation.org,
naveen.n.rao@...ux.vnet.ibm.com, zohar@...ux.ibm.com,
bhelgaas@...gle.com, vbabka@...e.cz, tiwai@...e.de,
seanjc@...gle.com, linux@...ssschuh.net, vschneid@...hat.com,
linux-mm@...ck.org, linux-doc@...r.kernel.org,
sourabhjain@...ux.ibm.com, konrad.wilk@...cle.com,
boris.ostrovsky@...cle.com
Subject: Re: [PATCH v23 4/8] crash: memory and CPU hotplug sysfs attributes
On Tue, Jun 13 2023 at 14:58, Eric DeVolder wrote:
> On 6/13/23 10:24, Eric DeVolder wrote:
>> On 6/13/23 03:03, Greg KH wrote:
>>> All of these #ifdefs should all be removed and instead use the
>>> is_visible() callback to determine if the attribute is shown or not,
>>> using the IS_ENABLED() test in the function.
>>
>> ok, I'll correct this.
>
> I've been examining drivers/base/cacheinfo.c as a template for how to remove the
> #ifdefs and use the is_visible() callback for the drivers/base/cpu|memory.c files.
>
> I'm attempting to apply this technique to drivers/base/cpu.c. In this file, there
> are features that are compiled in/out based on the CONFIG settings, for example
> CONFIG_ARCH_CPU_PROBE_RELEASE. My attempts at applying the technique thus far have
> resulted in link-time errors for missing symbols, ie. arch_cpu_probe() and
> arch_cpu_release().
>
> As I understand it, to use IS_ENABLED(XYZ) to guard-band conditional code, the contents
> of that code still needs to be compile-able (eg. no references to struct members with
> surrounding #ifdef CONFIG_XYZ) and link-able (eg. any called functions must also be
> compiled).
You can't obviously reference anything which is #ifdeffed out in a data
structure. But functions is a different story. All you needs is a
declaration.
void foo(void);
if (IS_ENABLED(FOO))
foo();
Builds correctly if FOO=n and foo() is not built in. The wonders of dead
code elimination.
Thanks,
tglx
Powered by blists - more mailing lists