Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 May 2011 16:11:22 -0600
From:      "Kenneth D. Merry" <ken@FreeBSD.org>
To:        mdf@FreeBSD.org
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r222537 - in head/sys: kern sys
Message-ID:  <20110531221122.GA58836@nargothrond.kdm.org>
In-Reply-To: <BANLkTinThaAeP9cAVpoGxpSNq2zn%2Ba-P6Q@mail.gmail.com>
References:  <201105311729.p4VHTwrZ033296@svn.freebsd.org> <BANLkTim1AQQj1BfqHtYfPWrvaQBp41qDNw@mail.gmail.com> <20110531214618.GA57498@nargothrond.kdm.org> <BANLkTinThaAeP9cAVpoGxpSNq2zn%2Ba-P6Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--17pEHd4RhPHOinZp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, May 31, 2011 at 15:02:37 -0700, mdf@FreeBSD.org wrote:
> On Tue, May 31, 2011 at 2:46 PM, Kenneth D. Merry <ken@freebsd.org> wrote:
> > On Tue, May 31, 2011 at 14:00:18 -0700, mdf@FreeBSD.org wrote:
> >> On Tue, May 31, 2011 at 10:29 AM, Kenneth D. Merry <ken@freebsd.org> wrote:
> >> > Author: ken
> >> > Date: Tue May 31 17:29:58 2011
> >> > New Revision: 222537
> >> > URL: http://svn.freebsd.org/changeset/base/222537
> >> >
> >> > Log:
> >> > ?Fix apparent garbage in the message buffer.
> >> >
> >> > ?While we have had a fix in place (options PRINTF_BUFR_SIZE=128) to fix
> >> > ?scrambled console output, the message buffer and syslog were still getting
> >> > ?log messages one character at a time. ?While all of the characters still
> >> > ?made it into the log (courtesy of atomic operations), they were often
> >> > ?interleaved when there were multiple threads writing to the buffer at the
> >> > ?same time.
> >>
> >> This seems to panic my box with "lock "msgbuf" 0xfffffe0127ffffe0
> >> already initialized".
> >>
> >> Unfortunately, though I booted with a fresh CURRENT this morning
> >> successfully, both /boot/kernel and /boot/kernel.old give this panic.
> >> To add insult to injury, when the kernel drops into the debugger, my
> >> keyboard input no longer works so I can't get a stack, etc.
> >
> > Uh-oh!
> >
> >> So:
> >>
> >> 1) Is there anything else I can do to help debug this?
> >> 2) how can I resurrect this box without a reinstall?
> >>
> >> I will try to repro on a virtual machine so I have a snapshot to come back to.
> >
> > My guess is that this is an issue with the message buffer reinitialization
> > path. ?lock_init() (called by mtx_init()) has an assert to make sure that
> > the lock is initialized, and that is just a flag check.
> >
> > Since the spin lock is part of the message buffer structure, if it is held
> > over from a previous boot, the LO_INITIALIZED flag may still be set.
> >
> > Try power cycling the machine. ?If it is an issue with re-initialization,
> > that should clear the memory and allow you to boot.
> 
> Hmm, apparently my previous presses of the power button weren't long
> enough.  I let it sit off for 20 seconds and it boots okay now.

Okay, so it probably is the re-initialization code.  Can you try this patch
and see if it survives a warm boot?  I also changed the initialization
path, so we don't get tripped up by garbage left in memory.

Also, does the debugger work now that it has booted successfully?

Thanks,

Ken
-- 
Kenneth Merry
ken@FreeBSD.ORG

--17pEHd4RhPHOinZp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="subr_msgbuf.c.20110531.txt"

Index: subr_msgbuf.c
===================================================================
--- subr_msgbuf.c	(revision 222537)
+++ subr_msgbuf.c	(working copy)
@@ -61,6 +61,7 @@
 	mbp->msg_magic = MSG_MAGIC;
 	mbp->msg_lastpri = -1;
 	mbp->msg_needsnl = 0;
+	bzero(&mbp->msg_lock, sizeof(mbp->msg_lock));
 	mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN);
 }
 
@@ -95,6 +96,7 @@
 	mbp->msg_lastpri = -1;
 	/* Assume that the old message buffer didn't end in a newline. */
 	mbp->msg_needsnl = 1;
+	bzero(&mbp->msg_lock, sizeof(mbp->msg_lock));
 	mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN);
 }
 

--17pEHd4RhPHOinZp--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110531221122.GA58836>