From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: linux-kernel@vger.kernel.org, Peter Zijlstra <peterz@infradead.org>
Subject: Question about CONFIG_DEBUG_SECTION_MISMATCH
Date: Wed, 20 Jan 2021 12:04:10 -0600 [thread overview]
Message-ID: <20210120180410.taayippxf2wdrvpx@treble> (raw)
Hi Sam,
I have a question about CONFIG_DEBUG_SECTION_MISMATCH's use of
-fno-inline-functions-called-once.
- Add the option -fno-inline-functions-called-once to gcc commands.
When inlining a function annotated with __init in a non-init
function, we would lose the section information and thus
the analysis would not catch the illegal reference.
This option tells gcc to inline less (but it does result in
a larger kernel).
Is -fno-inline-functions-called-once really needed?
From what I can tell, a .text function inlining an .init.text function
should be harmless unless the inlined function either referenced another
.init.text function, or referenced .init.data. In either case, that
would be detected by modpost.
Or am I missing another scenario where this flag would be needed?
I verified this with the following patch, it detected a mismatch even
without CONFIG_DEBUG_SECTION_MISMATCH.
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 6bd20c0de8bc..c3e41a3abc7e 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -153,6 +153,18 @@ static inline void imcr_apic_to_pic(void)
*/
static int force_enable_local_apic __initdata;
+static int __init foo(void)
+{
+ if (force_enable_local_apic)
+ return 1;
+ return 0;
+}
+
+int bar(void)
+{
+ return foo();
+}
+
/*
* APIC command line parameters
*/
--
Josh
reply other threads:[~2021-01-20 18:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210120180410.taayippxf2wdrvpx@treble \
--to=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=sam@ravnborg.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