From: Arnd Bergmann <arnd@arndb.de>
To: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>, "H. Peter Anvin" <hpa@zytor.com>,
Juergen Gross <jgross@suse.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] x86: vsmp: avoid link error with gcc -Og
Date: Fri, 2 Nov 2018 16:49:22 +0100 [thread overview]
Message-ID: <20181102154935.2073592-1-arnd@arndb.de> (raw)
When the compiler skips optimizations for ease of debugging,
teh vsmp_cap_cpus() function is not eliminated from the build
with CONFIG_PCI=n:
arch/x86/kernel/vsmp_64.o: In function `vsmp_cap_cpus':
vsmp_64.c:(.init.text+0x23): undefined reference to `read_pci_config'
Change the caller in a way that will always optimize this
as required.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/x86/kernel/vsmp_64.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c
index 1eae5af491c2..6a2ae6964ce5 100644
--- a/arch/x86/kernel/vsmp_64.c
+++ b/arch/x86/kernel/vsmp_64.c
@@ -146,8 +146,10 @@ static void __init detect_vsmp_box(void)
is_vsmp = 1;
}
-static int is_vsmp_box(void)
+static int __init is_vsmp_box(void)
{
+ detect_vsmp_box();
+
if (is_vsmp != -1)
return is_vsmp;
else {
@@ -157,10 +159,7 @@ static int is_vsmp_box(void)
}
#else
-static void __init detect_vsmp_box(void)
-{
-}
-static int is_vsmp_box(void)
+static __always_inline int is_vsmp_box(void)
{
return 0;
}
@@ -213,7 +212,6 @@ static void vsmp_apic_post_init(void)
void __init vsmp_init(void)
{
- detect_vsmp_box();
if (!is_vsmp_box())
return;
--
2.18.0
next reply other threads:[~2018-11-02 15:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-02 15:49 Arnd Bergmann [this message]
2018-11-05 11:27 ` [PATCH] x86: vsmp: avoid link error with gcc -Og Thomas Gleixner
2018-11-05 14:53 ` Arnd Bergmann
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=20181102154935.2073592-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).