console: console_drivers not initialized
PATCH 1/1 console: console_drivers not initialized
I was doing -rt stuff on a PPC PowerBook G4. It would always reboot itself when it hit console_init() .
I noticed that the console code seems to want console_drivers = NULL, but it never actually sets it that way. Once I added this, the reboot issue was gone..
kernel/printk.c +1 -1
@@ -68,7 +68,7 @@ EXPORT_SYMBOL(oops_in_progress);*/ static DECLARE_MUTEX (console_sem);static DECLARE_MUTEX (secondary_console_sem); -struct console *console_drivers; +struct console *console_drivers =NULL ;/* * This is used for debugging the mess that is the VT code by * keeping track if we have the console semaphore held. It's
--
Quoted 6 lines · On Mon, Sep 25, 2006 at 02:07:10PM -0700, [email protected] wrote:
I was doing -rt stuff on a PPC PowerBook G4. It would always reboot itself when it hit
console_init().I noticed that the console code seems to want
console_drivers= NULL, but it never actually sets it that way. Once I added this, the reboot issue was gone..
It's a BSS variable, it _should_ be zeroed by the architecture's BSS initialisation. If not, it suggests there's something very _very_ wrong in the architecture's C runtime initialisation code.
As such, this patch is merely a band-aid, not a correct fix.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: 2.6 Serial core
Quoted 8 lines · Russell King
Quoted 6 lines · On Mon, Sep 25, 2006 at 02:07:10PM -0700, [email protected] wrote:
I was doing -rt stuff on a PPC PowerBook G4. It would always reboot itself when it hit
console_init().I noticed that the console code seems to want
console_drivers= NULL, but it never actually sets it that way. Once I added this, the reboot issue was gone..
Quoted 5 lines
It's a BSS variable, it _should_ be zeroed by the architecture's BSS initialisation. If not, it suggests there's something very _very_ wrong in the architecture's C runtime initialisation code.
As such, this patch is merely a band-aid, not a correct fix.
It happens on two different compilers gcc 4.1 and 3.3 .. I was using arch/powerpc/ which is fairly new .. However, If stuff was suppose to be zero'd and wasn't, I'd imagine this machine would be rebooting _a lot_ more often.
Daniel
Quoted 9 lines · Daniel Walker
Quoted 8 lines · Russell King
Quoted 6 lines · On Mon, Sep 25, 2006 at 02:07:10PM -0700, [email protected] wrote:
I was doing -rt stuff on a PPC PowerBook G4. It would always reboot itself when it hit
console_init().I noticed that the console code seems to want
console_drivers= NULL, but it never actually sets it that way. Once I added this, the reboot issue was gone..
Quoted 7 lines
Quoted 5 lines
It's a BSS variable, it _should_ be zeroed by the architecture's BSS initialisation. If not, it suggests there's something very _very_ wrong in the architecture's C runtime initialisation code.
As such, this patch is merely a band-aid, not a correct fix.
It happens on two different compilers gcc 4.1 and 3.3 ..
The zeroing of the BSS is not a function of the compiler, but the C startup code, which might be written in assembly or c.
Quoted 4 lines
I was using
arch/powerpc/which is fairly new .. However, If stuff was suppose to be zero'd and wasn't, I'd imagine this machine would be rebooting _alot_more often.
The alternative explaination is that explicitly changing a variable from the BSS to have an explicit initialisation moves it into the data segment, which results in quite a bit of data moving around. So it might not even be related to this - maybe a data structure alignment issue somewhere? Shrug - but it's for powerpc folk to investigate.
Suggest you report it to powerpc folk as a bug.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: 2.6 Serial core
Quoted 13 lines · On Mon, 25 Sep 2006 14:26:21 -0700 Daniel Walker <[email protected]> wrote:
Quoted 12 lines · Russell King
Quoted 6 lines · On Mon, Sep 25, 2006 at 02:07:10PM -0700, [email protected] wrote:
I was doing -rt stuff on a PPC PowerBook G4. It would always reboot itself when it hit
console_init().I noticed that the console code seems to want
console_drivers= NULL, but it never actually sets it that way. Once I added this, the reboot issue was gone..It's a BSS variable, it _should_ be zeroed by the architecture's BSS initialisation. If not, it suggests there's something very _very_ wrong in the architecture's C runtime initialisation code.
Quoted 7 lines
Quoted 1 line
As such, this patch is merely a band-aid, not a correct fix.
It happens on two different compilers gcc 4.1 and 3.3 .. I was using
arch/powerpc/which is fairly new .. However, If stuff was suppose to be zero'd and wasn't, I'd imagine this machine would be rebooting _alot_more often.
What Russell said. If the arch startup code isn't correctly zeroing bss then that's pretty badly busted.
The other possibility is that something is accidentally overwriting this variable. The explicit initialisation will cause the compiler to move this variable into a different linker section, so now some other variable will be getting corrupted.
Quoted 2 lines · Andrew Morton
What Russell said. If the arch startup code isn't correctly zeroing bss then that's pretty badly busted.
Indeed. We do actually zero the BSS on startup. :)
Paul.