2007-06-02 12:42:01

by Sam Ravnborg

[permalink] [raw]
Subject: Section mismatches in drivers/video/console/promcon

Building a kernel for sparc64 defconfig gave me following warnings:
WARNING: drivers/built-in.o(.text+0xb788): Section mismatch: reference to .init.data:promfont_unitable (between 'promcon_init_unimap' and 'promcon_init')
WARNING: drivers/built-in.o(.text+0xb790): Section mismatch: reference to .init.data:promfont_unitable (between 'promcon_init_unimap' and 'promcon_init')
WARNING: drivers/built-in.o(.text+0xb794): Section mismatch: reference to .init.data:promfont_unicount (between 'promcon_init_unimap' and 'promcon_init')
WARNING: drivers/built-in.o(.text+0xb798): Section mismatch: reference to .init.data:promfont_unicount (between 'promcon_init_unimap' and 'promcon_init')

The warnings happens because the function: promcon_init_unimap()
references promfont_unitable and promfont_unicount which are marked
__initdata by the conmakehash command in the drivers/video/console/Makefile

The function promcon_init_unimap() are referenced in two places:
1) In prom_con_init() which is marked __init => no problem.
2) In promcon_init() which is not marked __init => warning.
The actual code is here:
if (!promcon_uni_pagedir[0] && p) {
promcon_init_unimap(conp);
}

I could not from the code judge if promcon_init_unimap is really
only used during early init or this is a bug.
If promcon_init_unimap() is only used during early init it
should be marked __init_refok (with a proper comment)
to silence the warning.

A few people in to: that I hope can help out (thanks to git blame)...

Sam


2007-06-02 13:00:38

by Jan Engelhardt

[permalink] [raw]
Subject: Re: Section mismatches in drivers/video/console/promcon


On Jun 2 2007 14:42, Sam Ravnborg wrote:
>
>A few people in to: that I hope can help out (thanks to git blame)...

git needs a "praise" command, like svn. :>


Jan
--

2007-06-02 13:25:01

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: Section mismatches in drivers/video/console/promcon

On Sat, 2007-06-02 at 14:42 +0200, Sam Ravnborg wrote:
> Building a kernel for sparc64 defconfig gave me following warnings:
> WARNING: drivers/built-in.o(.text+0xb788): Section mismatch: reference to .init.data:promfont_unitable (between 'promcon_init_unimap' and 'promcon_init')
> WARNING: drivers/built-in.o(.text+0xb790): Section mismatch: reference to .init.data:promfont_unitable (between 'promcon_init_unimap' and 'promcon_init')
> WARNING: drivers/built-in.o(.text+0xb794): Section mismatch: reference to .init.data:promfont_unicount (between 'promcon_init_unimap' and 'promcon_init')
> WARNING: drivers/built-in.o(.text+0xb798): Section mismatch: reference to .init.data:promfont_unicount (between 'promcon_init_unimap' and 'promcon_init')
>
> The warnings happens because the function: promcon_init_unimap()
> references promfont_unitable and promfont_unicount which are marked
> __initdata by the conmakehash command in the drivers/video/console/Makefile
>
> The function promcon_init_unimap() are referenced in two places:
> 1) In prom_con_init() which is marked __init => no problem.
> 2) In promcon_init() which is not marked __init => warning.
> The actual code is here:
> if (!promcon_uni_pagedir[0] && p) {
> promcon_init_unimap(conp);
> }
>

> could not from the code judge if promcon_init_unimap is really
> only used during early init or this is a bug.

promcon_init() can be called again from visual_init() during
vc_allocate(). So anything referenced by promcon_init() should not be
marked __init.

Although, if you want to keep promfont_unitable and promfont_unicount
__init, you can probably use con_copy_unimap() using the default vc as
the source instead of doing a promcon_init_unimap() again.

Tony


2007-06-02 19:15:52

by Sam Ravnborg

[permalink] [raw]
Subject: Re: Section mismatches in drivers/video/console/promcon

>
> promcon_init() can be called again from visual_init() during
> vc_allocate(). So anything referenced by promcon_init() should not be
> marked __init.
>
> Although, if you want to keep promfont_unitable and promfont_unicount
> __init, you can probably use con_copy_unimap() using the default vc as
> the source instead of doing a promcon_init_unimap() again.

Too involved for me to look into.
I cooked up following very minimal patch - if you agree can you then please
forward/take care of it.

Sam

Subject: video: fix section mismatch warning in promcon

Fix the following warnings in promcon:
WARNING: o-sparc64/drivers/video/console/built-in.o(.text+0x480): Section mismatch: reference to .init.data:promfont_unitable (between 'promcon_init_unimap' and 'promcon_init')
WARNING: o-sparc64/drivers/video/console/built-in.o(.text+0x488): Section mismatch: reference to .init.data:promfont_unitable (between 'promcon_init_unimap' and 'promcon_init')
WARNING: o-sparc64/drivers/video/console/built-in.o(.text+0x48c): Section mismatch: reference to .init.data:promfont_unicount (between 'promcon_init_unimap' and 'promcon_init')
WARNING: o-sparc64/drivers/video/console/built-in.o(.text+0x490): Section mismatch: reference to .init.data:promfont_unicount (between 'promcon_init_unimap' and 'promcon_init')

The warnings happens because the function: promcon_init_unimap()
references promfont_unitable and promfont_unicount which are marked
__initdata by the conmakehash command in the drivers/video/console/Makefile

Fix the warning by removing the __initdata marker on the two variables.
Signed-off-by: Sam Ravnborg <[email protected]>
---
diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile
index 9b26dda..ac46cc3 100644
--- a/drivers/video/console/Makefile
+++ b/drivers/video/console/Makefile
@@ -47,7 +47,7 @@ targets := promcon_tbl.c
quiet_cmd_conmakehash = CNMKHSH $@
cmd_conmakehash = scripts/conmakehash $< | \
sed -e '/\#include <[^>]*>/p' -e 's/types/init/' \
- -e 's/dfont\(_uni.*\]\)/promfont\1 __initdata/' > $@
+ -e 's/dfont\(_uni.*\]\)/promfont\1 /' > $@

$(obj)/promcon_tbl.c: $(src)/prom.uni
$(call cmd,conmakehash)

2007-06-05 06:53:14

by David Miller

[permalink] [raw]
Subject: Re: Section mismatches in drivers/video/console/promcon

From: Sam Ravnborg <[email protected]>
Date: Sat, 2 Jun 2007 21:16:46 +0200

> >
> > promcon_init() can be called again from visual_init() during
> > vc_allocate(). So anything referenced by promcon_init() should not be
> > marked __init.
> >
> > Although, if you want to keep promfont_unitable and promfont_unicount
> > __init, you can probably use con_copy_unimap() using the default vc as
> > the source instead of doing a promcon_init_unimap() again.
>
> Too involved for me to look into.
> I cooked up following very minimal patch - if you agree can you then please
> forward/take care of it.
>
> Sam
>
> Subject: video: fix section mismatch warning in promcon

I'll merge this fix in via the Sparc tree since this is a sparc
console driver.

Thanks Sam.

2007-06-05 08:04:52

by Sam Ravnborg

[permalink] [raw]
Subject: Re: Section mismatches in drivers/video/console/promcon

On Mon, Jun 04, 2007 at 11:53:13PM -0700, David Miller wrote:
> From: Sam Ravnborg <[email protected]>
> Date: Sat, 2 Jun 2007 21:16:46 +0200
>
> > >
> > > promcon_init() can be called again from visual_init() during
> > > vc_allocate(). So anything referenced by promcon_init() should not be
> > > marked __init.
> > >
> > > Although, if you want to keep promfont_unitable and promfont_unicount
> > > __init, you can probably use con_copy_unimap() using the default vc as
> > > the source instead of doing a promcon_init_unimap() again.
> >
> > Too involved for me to look into.
> > I cooked up following very minimal patch - if you agree can you then please
> > forward/take care of it.
> >
> > Sam
> >
> > Subject: video: fix section mismatch warning in promcon
>
> I'll merge this fix in via the Sparc tree since this is a sparc
> console driver.
Thanks. I didn't notice it was sparc only otherwise I would have cc'ed you
and sparclinux.

Sam

2007-06-05 11:26:49

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: Section mismatches in drivers/video/console/promcon

On Mon, 2007-06-04 at 23:53 -0700, David Miller wrote:
> From: Sam Ravnborg <[email protected]>
> Date: Sat, 2 Jun 2007 21:16:46 +0200
>
> > >
> > > promcon_init() can be called again from visual_init() during
> > > vc_allocate(). So anything referenced by promcon_init() should not be
> > > marked __init.
> > >
> > > Although, if you want to keep promfont_unitable and promfont_unicount
> > > __init, you can probably use con_copy_unimap() using the default vc as
> > > the source instead of doing a promcon_init_unimap() again.
> >
> > Too involved for me to look into.
> > I cooked up following very minimal patch - if you agree can you then please
> > forward/take care of it.
> >
> > Sam
> >
> > Subject: video: fix section mismatch warning in promcon
>
> I'll merge this fix in via the Sparc tree since this is a sparc
> console driver.
>

I was about to send this patch to akpm, I'll leave this to you then.

Tony