From: Nathan Chancellor <nathan@kernel.org>
To: tsbogend@alpha.franken.de
Cc: ndesaulniers@google.com, trix@redhat.com,
jiaxun.yang@flygoat.com, linux-mips@vger.kernel.org,
llvm@lists.linux.dev, patches@lists.linux.dev,
Nathan Chancellor <nathan@kernel.org>
Subject: [PATCH] MIPS: Mark core_vpe_count() as __init
Date: Thu, 15 Jun 2023 09:21:18 -0700 [thread overview]
Message-ID: <20230615-mips-mark-core_vpe_count-as-init-v1-1-99c124367ea8@kernel.org> (raw)
After commit 96cb8ae28c65 ("MIPS: Rework smt cmdline parameters"),
modpost complains when building with clang:
WARNING: modpost: vmlinux.o: section mismatch in reference: core_vpe_count (section: .text) -> smp_max_threads (section: .init.data)
This warning occurs when core_vpe_count() is not inlined, as it appears
that a non-init function is referring to an init symbol. However, this
is not a problem in practice because core_vpe_count() is only called
from __init functions, cps_smp_setup() and cps_prepare_cpus().
Resolve the warning by marking core_vpe_count() as __init, as it is only
called in an init context so it can refer to init functions and symbols
and have its memory freed on boot.
Fixes: 96cb8ae28c65 ("MIPS: Rework smt cmdline parameters")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
arch/mips/kernel/smp-cps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
index bea6a13ea464..92575222713b 100644
--- a/arch/mips/kernel/smp-cps.c
+++ b/arch/mips/kernel/smp-cps.c
@@ -29,7 +29,7 @@ static DECLARE_BITMAP(core_power, NR_CPUS);
struct core_boot_config *mips_cps_core_bootcfg;
-static unsigned core_vpe_count(unsigned int cluster, unsigned core)
+static unsigned __init core_vpe_count(unsigned int cluster, unsigned core)
{
return min(smp_max_threads, mips_cps_numvps(cluster, core));
}
---
base-commit: 5cad8323040bb8d47e130c10ea4dcb7175c7602a
change-id: 20230615-mips-mark-core_vpe_count-as-init-600dc73e367d
Best regards,
--
Nathan Chancellor <nathan@kernel.org>
next reply other threads:[~2023-06-15 16:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-15 16:21 Nathan Chancellor [this message]
2023-06-15 19:42 ` [PATCH] MIPS: Mark core_vpe_count() as __init Nick Desaulniers
2023-06-20 12:50 ` Thomas Bogendoerfer
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=20230615-mips-mark-core_vpe_count-as-init-v1-1-99c124367ea8@kernel.org \
--to=nathan@kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-mips@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=ndesaulniers@google.com \
--cc=patches@lists.linux.dev \
--cc=trix@redhat.com \
--cc=tsbogend@alpha.franken.de \
/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).