Skip to contentSkip to conversation

Kirkwood issues with 3.8-rc1 - Ooops and hang on reboot

DISCUSSION Andrew Lunn 3 participants 9 messages Dec 28, 2012 – Jan 4, 2013

lore
Share & tools
lore
#0 lore raw

Hi Josh

What compiler version are you using to get the opps?

I don't see this problem, when building with:

arm-linux-gnueabi-gcc -v
Using built-in specs.
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.5-8' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/arm-linux-gnueabi/include/c++/4.4.5 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-sjlj-exceptions --enable-checking=release --program-prefix=arm-linux-gnueabi- --includedir=/usr/arm-linux-gnueabi/include --build=i486-linux-gnu --host=i486-linux-gnu --target=arm-linux-gnueabi --with-headers=/usr/arm-linux-gnueabi/include --with-libs=/usr/arm-linux-gnueabi/lib Thread model: posix
gcc version 4.4.5 (Debian 4.4.5-8)

The disassembly i get looks similar, but not identical.

BTW:

make drivers/clk/mvebu/clk-gating-ctrl.lst

is useful in situations like this.

Andrew

#1 lore raw
Quoted 3 lines · Andrew Lunn

Hi Josh

What compiler version are you using to get the opps?

It's a section mismatch warning. Just look at the code line and compare it with the disassembly. Oh, the code line indicates that the code is no longer present. Why would that be?

static struct clk __init *mvebu_clk_gating_get_src(
^^^^^^
struct of_phandle_args *clkspec, void *data)

{
        struct mvebu_gating_ctrl *ctrl = (struct mvebu_gating_ctrl *)data;

maybe?

#2 lore raw

Bah, didn't send to everyone last time...

Building with CONFIG_DEBUG_SECTION_MISMATCH enabled, the only warning I get is for drivers/w1/masters/w1-gpio.o.

WARNING: drivers/w1/masters/w1-gpio.o(.data+0x0): Section mismatch in reference from the variable w1_gpio_driver to the function .init.text:w1_gpio_probe()
The variable w1_gpio_driver references
the function __init w1_gpio_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

Shouldn't I be seeing a warning for drivers/clk/mvebu/clk-gating-ctrl.o at this point as well?

Josh C

Quoted 16 lines · Russell King - ARM Linux
Quoted 3 lines · Andrew Lunn

Hi Josh

What compiler version are you using to get the opps?

It's a section mismatch warning. Just look at the code line and compare it with the disassembly. Oh, the code line indicates that the code is no longer present. Why would that be?

static struct clk __init *mvebu_clk_gating_get_src(
^^^^^^
struct of_phandle_args *clkspec, void *data)

{
        struct mvebu_gating_ctrl *ctrl = (struct mvebu_gating_ctrl *)data;

maybe?

#3 lore raw
Quoted 14 lines · Josh Coombs

Bah, didn't send to everyone last time...

Building with CONFIG_DEBUG_SECTION_MISMATCH enabled, the only warning I get is for drivers/w1/masters/w1-gpio.o.

WARNING: drivers/w1/masters/w1-gpio.o(.data+0x0): Section mismatch in reference from the variable w1_gpio_driver to the function .init.text:w1_gpio_probe()
The variable w1_gpio_driver references
the function __init w1_gpio_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

Quoted 2 lines

Shouldn't I be seeing a warning for drivers/clk/mvebu/clk-gating-ctrl.o at this point as well?

Unfortunately not. mvebu_clk_gating_get_src() is referenced by another __init function, which is registering the pointer to mvebu_clk_gating_get_src() into other code. That reference (obviously from the oops dump) persists past the point where the __init sections are freed.

Hence why no section mismatch warning issued from the static tools; they're not infallible.

Quoted 20 lines

Josh C

Quoted 16 lines · Russell King - ARM Linux
Quoted 3 lines · Andrew Lunn

Hi Josh

What compiler version are you using to get the opps?

It's a section mismatch warning. Just look at the code line and compare it with the disassembly. Oh, the code line indicates that the code is no longer present. Why would that be?

static struct clk __init *mvebu_clk_gating_get_src(
^^^^^^
struct of_phandle_args *clkspec, void *data)

{
        struct mvebu_gating_ctrl *ctrl = (struct mvebu_gating_ctrl *)data;

maybe?

#4 lore raw
Quoted 18 lines · Russell King - ARM Linux
Quoted 14 lines · Josh Coombs

Bah, didn't send to everyone last time...

Building with CONFIG_DEBUG_SECTION_MISMATCH enabled, the only warning I get is for drivers/w1/masters/w1-gpio.o.

WARNING: drivers/w1/masters/w1-gpio.o(.data+0x0): Section mismatch in reference from the variable w1_gpio_driver to the function .init.text:w1_gpio_probe()
The variable w1_gpio_driver references
the function __init w1_gpio_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

Quoted 2 lines

Shouldn't I be seeing a warning for drivers/clk/mvebu/clk-gating-ctrl.o at this point as well?

Quoted 8 lines

Unfortunately not. mvebu_clk_gating_get_src() is referenced by another __init function, which is registering the pointer to mvebu_clk_gating_get_src() into other code. That reference (obviously from the oops dump) persists past the point where the __init sections are freed.

Hence why no section mismatch warning issued from the static tools; they're not infallible.

Ok, so a workaround would be to remove the __init tag so persists properly, but it sounds like what I really should do is to find out where that other reference is and why it's persisting to make sure that's the right behavior in the first place?

Josh C

#5 lore raw
Quoted 26 lines · Josh Coombs
Quoted 24 lines · Russell King - ARM Linux
Quoted 14 lines · Josh Coombs

Bah, didn't send to everyone last time...

Building with CONFIG_DEBUG_SECTION_MISMATCH enabled, the only warning I get is for drivers/w1/masters/w1-gpio.o.

WARNING: drivers/w1/masters/w1-gpio.o(.data+0x0): Section mismatch in reference from the variable w1_gpio_driver to the function .init.text:w1_gpio_probe()
The variable w1_gpio_driver references
the function __init w1_gpio_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

Quoted 2 lines

Shouldn't I be seeing a warning for drivers/clk/mvebu/clk-gating-ctrl.o at this point as well?

Unfortunately not. mvebu_clk_gating_get_src() is referenced by another __init function, which is registering the pointer to mvebu_clk_gating_get_src() into other code. That reference (obviously from the oops dump) persists past the point where the __init sections are freed.

Quoted 7 lines
Quoted 2 lines

Hence why no section mismatch warning issued from the static tools; they're not infallible.

Ok, so a workaround would be to remove the __init tag so persists properly, but it sounds like what I really should do is to find out where that other reference is and why it's persisting to make sure that's the right behavior in the first place?

Hi Josh

If you look in drivers/clk/mvebu/clk-gating-ctrl.c, mvebu_clk_gating_get_src() is passed as a parameter to of_clk_add_provider(). of_clk_add_provider() allocates a structure with kzalloc() and then assigns the function pointer to a member of the structure.

Because mvebu_clk_gateing_src() is passed as a parameter, the section missmatch checks cannot detect a problem. As far as i understand, its the linker which is checking for section miss matches. However, the linker is not involved here, its not a function calling a function, its a function passed to a function, and later a function called via a function pointer.

As far as i can see, the only error here is the wrong __init tag.

Andrew

#6 lore raw

I did a test build with the __init tag removed (which is not the correct answer) and everything works. GPIO is functional (I didn't catch the power LED wasn't working prior), I don't get a panic, and I can now reboot cleanly as well. So that confirms the basic diagnosis.

I've been trying to wrap my head around include/linux/init.h to see what the correct tagging should be but I'll admit, I'm in over my head so far. If anyone has suggested reading on the topic I'd be very appreciative.

Josh C

Quoted 59 lines · Andrew Lunn
Quoted 31 lines · Josh Coombs
Quoted 28 lines · Russell King - ARM Linux
Quoted 16 lines · Josh Coombs

Bah, didn't send to everyone last time...

Building with CONFIG_DEBUG_SECTION_MISMATCH enabled, the only warning I get is for drivers/w1/masters/w1-gpio.o.

WARNING: drivers/w1/masters/w1-gpio.o(.data+0x0): Section mismatch in reference from the variable w1_gpio_driver to the function .init.text:w1_gpio_probe()
The variable w1_gpio_driver references
the function __init w1_gpio_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

Quoted 2 lines

Shouldn't I be seeing a warning for drivers/clk/mvebu/clk-gating-ctrl.o at this point as well?

Unfortunately not. mvebu_clk_gating_get_src() is referenced by another __init function, which is registering the pointer to mvebu_clk_gating_get_src() into other code. That reference (obviously from the oops dump) persists past the point where the __init sections are freed.

Quoted 8 lines
Quoted 2 lines

Hence why no section mismatch warning issued from the static tools; they're not infallible.

Ok, so a workaround would be to remove the __init tag so persists properly, but it sounds like what I really should do is to find out where that other reference is and why it's persisting to make sure that's the right behavior in the first place?

Hi Josh

If you look in drivers/clk/mvebu/clk-gating-ctrl.c, mvebu_clk_gating_get_src() is passed as a parameter to of_clk_add_provider(). of_clk_add_provider() allocates a structure with kzalloc() and then assigns the function pointer to a member of the structure.

Because mvebu_clk_gateing_src() is passed as a parameter, the section missmatch checks cannot detect a problem. As far as i understand, its the linker which is checking for section miss matches. However, the linker is not involved here, its not a function calling a function, its a function passed to a function, and later a function called via a function pointer.

As far as i can see, the only error here is the wrong __init tag.

Andrew

#7 lore raw
Quoted 9 lines · Josh Coombs

I did a test build with the __init tag removed (which is not the correct answer) and everything works. GPIO is functional (I didn't catch the power LED wasn't working prior), I don't get a panic, and I can now reboot cleanly as well. So that confirms the basic diagnosis.

I've been trying to wrap my head around include/linux/init.h to see what the correct tagging should be but I'll admit, I'm in over my head so far. If anyone has suggested reading on the topic I'd be very appreciative.

Hi Josh

The question is, when can this function be used? Only during boot time? Or at any time? For functions which are only used during boot, __init is O.K. However, since modules can also want to use clks, we need to be able to look up clocks at any time. So this function needs to be around all the time, which is the default behavior of no tag.

Andrew

#8 lore raw
In reply to Andrew Lunn

I'm using 4.7.2 as packaged by Arch Linux ARM:

[jcoombs at alarm ~]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/armv5tel-unknown-linux-gnueabi/4.7.2/lto-wrapper
Target: armv5tel-unknown-linux-gnueabi
Configured with: /build/src/gcc-4.7.2/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,fortran,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --enable-libstdcxx-time --enable-gnu-unique-object --enable-linker-build-id --with-ppl --enable-cloog-backend=isl --disable-ppl-version-check --disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu --disable-multilib --disable-libssp --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-checking=release --host=armv5tel-unknown-linux-gnueabi --build=armv5tel-unknown-linux-gnueabi
Thread model: posix
gcc version 4.7.2 (GCC)

Quoted 22 lines · Andrew Lunn

Hi Josh

What compiler version are you using to get the opps?

I don't see this problem, when building with:

arm-linux-gnueabi-gcc -v
Using built-in specs.
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.5-8' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/arm-linux-gnueabi/include/c++/4.4.5 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-sjlj-exceptions --enable-checking=release --program-prefix=arm-linux-gnueabi- --includedir=/usr/arm-linux-gnueabi/include --build=i486-linux-gnu --host=i486-linux-gnu --target=arm-linux-gnueabi --with-headers=/usr/arm-linux-gnueabi/include --with-libs=/usr/arm-linux-gnueabi/lib Thread model: posix
gcc version 4.4.5 (Debian 4.4.5-8)

The disassembly i get looks similar, but not identical.

BTW:

make drivers/clk/mvebu/clk-gating-ctrl.lst

is useful in situations like this.

Andrew