From: Thomas Gleixner <tglx@linutronix.de>
To: Eric DeVolder <eric.devolder@oracle.com>,
Greg KH <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, david@redhat.com,
osalvador@suse.de, corbet@lwn.net, mingo@redhat.com,
bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org,
bhe@redhat.com, ebiederm@xmission.com, kexec@lists.infradead.org,
hpa@zytor.com, rafael@kernel.org, vgoyal@redhat.com,
dyoung@redhat.com, lf32.dev@gmail.com, akpm@linux-foundation.org,
naveen.n.rao@linux.vnet.ibm.com, zohar@linux.ibm.com,
bhelgaas@google.com, vbabka@suse.cz, tiwai@suse.de,
seanjc@google.com, linux@weissschuh.net, vschneid@redhat.com,
linux-mm@kvack.org, linux-doc@vger.kernel.org,
sourabhjain@linux.ibm.com, konrad.wilk@oracle.com,
boris.ostrovsky@oracle.com
Subject: Re: [PATCH v23 4/8] crash: memory and CPU hotplug sysfs attributes
Date: Tue, 13 Jun 2023 22:19:39 +0200 [thread overview]
Message-ID: <87h6rb6rok.ffs@tglx> (raw)
In-Reply-To: <40cacc6b-c3d1-c63b-e307-d95b2c53e399@oracle.com>
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
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
WARNING: multiple messages have this Message-ID (diff)
From: Thomas Gleixner <tglx@linutronix.de>
To: Eric DeVolder <eric.devolder@oracle.com>,
Greg KH <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, david@redhat.com,
osalvador@suse.de, corbet@lwn.net, mingo@redhat.com,
bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org,
bhe@redhat.com, ebiederm@xmission.com, kexec@lists.infradead.org,
hpa@zytor.com, rafael@kernel.org, vgoyal@redhat.com,
dyoung@redhat.com, lf32.dev@gmail.com, akpm@linux-foundation.org,
naveen.n.rao@linux.vnet.ibm.com, zohar@linux.ibm.com,
bhelgaas@google.com, vbabka@suse.cz, tiwai@suse.de,
seanjc@google.com, linux@weissschuh.net, vschneid@redhat.com,
linux-mm@kvack.org, linux-doc@vger.kernel.org,
sourabhjain@linux.ibm.com, konrad.wilk@oracle.com,
boris.ostrovsky@oracle.com
Subject: Re: [PATCH v23 4/8] crash: memory and CPU hotplug sysfs attributes
Date: Tue, 13 Jun 2023 22:19:39 +0200 [thread overview]
Message-ID: <87h6rb6rok.ffs@tglx> (raw)
In-Reply-To: <40cacc6b-c3d1-c63b-e307-d95b2c53e399@oracle.com>
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
next prev parent reply other threads:[~2023-06-13 20:19 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-12 21:07 [PATCH v23 0/8] crash: Kernel handling of CPU and memory hot un/plug Eric DeVolder
2023-06-12 21:07 ` Eric DeVolder
2023-06-12 21:07 ` [PATCH v23 1/8] crash: move a few code bits to setup support of crash hotplug Eric DeVolder
2023-06-12 21:07 ` Eric DeVolder
2023-06-12 21:07 ` [PATCH v23 2/8] crash: add generic infrastructure for crash hotplug support Eric DeVolder
2023-06-12 21:07 ` Eric DeVolder
2023-06-12 21:07 ` [PATCH v23 3/8] kexec: exclude elfcorehdr from the segment digest Eric DeVolder
2023-06-12 21:07 ` Eric DeVolder
2023-06-12 21:07 ` [PATCH v23 4/8] crash: memory and CPU hotplug sysfs attributes Eric DeVolder
2023-06-12 21:07 ` Eric DeVolder
2023-06-13 8:03 ` Greg KH
2023-06-13 8:03 ` Greg KH
2023-06-13 15:24 ` Eric DeVolder
2023-06-13 15:24 ` Eric DeVolder
2023-06-13 19:58 ` Eric DeVolder
2023-06-13 19:58 ` Eric DeVolder
2023-06-13 20:19 ` Thomas Gleixner [this message]
2023-06-13 20:19 ` Thomas Gleixner
2023-06-16 20:56 ` Eric DeVolder
2023-06-16 20:56 ` Eric DeVolder
2023-06-12 21:07 ` [PATCH v23 5/8] x86/crash: add x86 crash hotplug support Eric DeVolder
2023-06-12 21:07 ` Eric DeVolder
2023-06-12 21:07 ` [PATCH v23 6/8] crash: hotplug support for kexec_load() Eric DeVolder
2023-06-12 21:07 ` Eric DeVolder
2023-06-12 21:07 ` [PATCH v23 7/8] crash: change crash_prepare_elf64_headers() to for_each_possible_cpu() Eric DeVolder
2023-06-12 21:07 ` Eric DeVolder
2023-06-12 21:07 ` [PATCH v23 8/8] x86/crash: optimize CPU changes Eric DeVolder
2023-06-12 21:07 ` Eric DeVolder
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=87h6rb6rok.ffs@tglx \
--to=tglx@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=bhelgaas@google.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=david@redhat.com \
--cc=dyoung@redhat.com \
--cc=ebiederm@xmission.com \
--cc=eric.devolder@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=kexec@lists.infradead.org \
--cc=konrad.wilk@oracle.com \
--cc=lf32.dev@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@weissschuh.net \
--cc=mingo@redhat.com \
--cc=naveen.n.rao@linux.vnet.ibm.com \
--cc=osalvador@suse.de \
--cc=rafael@kernel.org \
--cc=seanjc@google.com \
--cc=sourabhjain@linux.ibm.com \
--cc=tiwai@suse.de \
--cc=vbabka@suse.cz \
--cc=vgoyal@redhat.com \
--cc=vschneid@redhat.com \
--cc=x86@kernel.org \
--cc=zohar@linux.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.