Re: [PATCH x86] [15/16] Force __cpuinit on for CONFIG_PM without HOTPLUG_CPU
From: Sam Ravnborg
Date: Mon Jan 14 2008 - 14:59:58 EST
On Mon, Jan 14, 2008 at 04:01:03PM +0100, Ingo Molnar wrote:
>
> * Ingo Molnar <mingo@xxxxxxx> wrote:
>
> > > Would be great to have them automated - just dunno how to do it. Do
> > > you see a feasible way to do it?
> >
> > a good starting point would be to make the warnings a lot more
> > self-explanatory. Right now it's often non-obvious trying to figure
> > out how the dependencies are structured and which one should be
> > changed to get rid of the bug.
>
> for example, in current -git, could you tell me why this triggers:
>
> WARNING: vmlinux.o(.text+0x87e2a): Section mismatch: reference to
> .init.text: (between 'process_zones' and 'setup_per_cpu_pageset')
>
> and how to resolve it? I had a quick look and it was not obvious to me.
I was confused by your error message - it looked all wrong.
process_zones is .text but setup_per_cpu_pageset is __init. I expect you
had some local changes.
So I tried myself and got this warning:
WARNING: mm/built-in.o(.text+0x6864): Section mismatch: reference to .init.text: (between 'process_zones' and 'pageset_cpuup_callback')
This made much more sense.
So I looked closely at process_zones() and the first
thing I always do is to check all the local functions.
I noticed that we use the function zone_batchsize() which is marked __devinit.
A function marked __cpuinit may use other functions marked __cpuinit, data marked
__cpuinitdata and .text/.data. But references to __devinit is not ok.
I furthermore noticed that zone_batchsize() were used in anohter
function marked __meminit.
So the simple fix for this warning is to remove the annotation of zone_batchsize.
It looks like a real opps candidate to me..
Why modpost did not pick up the zone_batchsize symbol is anohter matter.
It is present in the file:
$ objdump --syms vmlinux.o | grep zone_batchsize
0000000000016929 l F .init.text 0000000000000053 zone_batchsize
Debugging modpost I could see that we had an addend value of 695,
but the addr of the symbol is 699. So somehow we point 4 bytes wrong.
Strange...
Anyway - here follows the patch.
Sam
[PATCH] mm: fix section mismatch warning in page_alloc.c
With CONFIG_HOTPLUG=n and CONFIG_HOTPLUG_CPU=y we saw
following warning:
WARNING: mm/built-in.o(.text+0x6864): Section mismatch: reference to .init.text: (between 'process_zones' and 'pageset_cpuup_callback')
The culprint was zone_batchsize() which were annotated
__devinit but used from process_zones() which is annotated __cpuinit.
zone_batchsize() are used from another function annotated __meminit
so the only valid option is to drop the annotation of
zone_batchsize() so we know it is always valid to use it.
Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
---
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e1028fa..b2838c2 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2566,7 +2566,7 @@ static void __meminit zone_init_free_lists(struct pglist_data *pgdat,
memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY)
#endif
-static int __devinit zone_batchsize(struct zone *zone)
+static int zone_batchsize(struct zone *zone)
{
int batch;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/