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..
Signed-Off-By: Daniel Walker <[email protected]>
Index: linux-2.6.18/kernel/printk.c
===================================================================
--- linux-2.6.18.orig/kernel/printk.c
+++ linux-2.6.18/kernel/printk.c
@@ -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
--
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.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
On Mon, 2006-09-25 at 22:11 +0100, Russell King wrote:
> 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.
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
On Mon, Sep 25, 2006 at 02:26:21PM -0700, Daniel Walker wrote:
> On Mon, 2006-09-25 at 22:11 +0100, Russell King wrote:
> > 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.
>
> 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.
> 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.
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.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
On Mon, 25 Sep 2006 14:26:21 -0700
Daniel Walker <[email protected]> wrote:
> On Mon, 2006-09-25 at 22:11 +0100, Russell King wrote:
> > 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.
>
> 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.
>
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.
Andrew Morton writes:
> 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.