Re: [xen-tip:linux-next 12/12] WARNING: modpost: vmlinux: section mismatch in reference: mc_debug_data+0x0 (section: .data) -> mc_debug_data_early (section: .init.data)

From: Borislav Petkov
Date: Thu Mar 27 2025 - 10:15:55 EST


On Wed, Jul 24, 2024 at 11:55:39AM +0200, Jürgen Groß wrote:
> I'd prefer a general way to handle this problem, like e.g. some kind of
> __refdata tagging for percpu variables.

Any reason for not doing the trivial thing?

diff --git a/arch/x86/xen/multicalls.c b/arch/x86/xen/multicalls.c
index 10c660fae8b3..100bfaba3f4d 100644
--- a/arch/x86/xen/multicalls.c
+++ b/arch/x86/xen/multicalls.c
@@ -53,7 +53,7 @@ struct mc_debug_data {
};

static DEFINE_PER_CPU(struct mc_buffer, mc_buffer);
-static struct mc_debug_data mc_debug_data_early __initdata;
+static struct mc_debug_data mc_debug_data_early;
static DEFINE_PER_CPU(struct mc_debug_data *, mc_debug_data) =
&mc_debug_data_early;
static struct mc_debug_data __percpu *mc_debug_data_ptr;

---

since this breaks randbuilds:

WARNING: modpost: vmlinux: section mismatch in reference: mc_debug_data+0x0 (section: .data) -> mc_debug_data_early (section: .init.data)
ERROR: modpost: Section mismatches detected.
Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.
make[2]: *** [scripts/Makefile.modpost:147: Module.symvers] Error 1
make[2]: *** Deleting file 'Module.symvers'
make[1]: *** [/mnt/kernel/kernel/linux/Makefile:1947: modpost] Error 2
make: *** [Makefile:251: __sub-make] Error 2

?

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette