From owner-freebsd-current@FreeBSD.ORG Sun Apr 11 17:00:19 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 90BA916A4CE; Sun, 11 Apr 2004 17:00:19 -0700 (PDT) Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.157.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0655743D39; Sun, 11 Apr 2004 17:00:19 -0700 (PDT) (envelope-from mark@grondar.org) Received: from storm.FreeBSD.org.uk (Ugrondar@localhost [127.0.0.1]) i3C00IV4066909; Mon, 12 Apr 2004 01:00:18 +0100 (BST) (envelope-from mark@grondar.org) Received: (from Ugrondar@localhost)i3C00HAS066908; Mon, 12 Apr 2004 01:00:18 +0100 (BST) (envelope-from mark@grondar.org) X-Authentication-Warning: storm.FreeBSD.org.uk: Ugrondar set sender to mark@grondar.org using -f Received: from grondar.org (localhost [127.0.0.1])i3BNxNIn080714; Mon, 12 Apr 2004 00:59:23 +0100 (BST) (envelope-from mark@grondar.org) Message-Id: <200404112359.i3BNxNIn080714@grimreaper.grondar.org> To: "Simon L. Nielsen" From: Mark Murray In-Reply-To: Your message of "Sun, 11 Apr 2004 23:54:36 +0200." <20040411215436.GB881@zaphod.nitro.dk> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <80711.1081727938.0@grondar.org> Date: Mon, 12 Apr 2004 00:59:23 +0100 Sender: mark@grondar.org X-Spam-Score: 3 (***) MSGID_FROM_MTA_SHORT X-Scanned-By: MIMEDefang 2.39 cc: freebsd-current@FreeBSD.ORG Subject: Re: random(4) related panic: sleeping without a mutex X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Apr 2004 00:00:19 -0000 ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <80711.1081727938.1@grondar.org> "Simon L. Nielsen" writes: > I getting the following panic on my Soekris Net4801 box right after init > has been started: > > Mounting root from ufs:/dev/ad0s1a > start_init: trying /sbin/init > panic: sleeping without a mutex > at line 144 in file /data/nanobsd/src/sys/kern/kern_synch.c > Debugger("panic") > Stopped at Debugger+0x45: xchgl %ebx,in_Debugger.0 Could you please try the enclosed patch? M -- Mark Murray iumop ap!sdn w,I idlaH ------- =_aaaaaaaaaa0 Content-Type: text/plain; file="randomdev.c.diff"; charset="us-ascii" Content-ID: <80711.1081727938.2@grondar.org> Content-Description: randomdev.c.diff Index: randomdev.c =================================================================== RCS file: /home/ncvs/src/sys/dev/random/randomdev.c,v retrieving revision 1.49 diff -u -d -r1.49 randomdev.c --- randomdev.c 9 Apr 2004 15:47:09 -0000 1.49 +++ randomdev.c 11 Apr 2004 19:08:03 -0000 @@ -103,25 +103,28 @@ { int c, error = 0; + mtx_lock(&random_systat.lock); + /* Blocking logic */ while (!random_systat.seeded && !error) { if (flag & IO_NDELAY) error = EWOULDBLOCK; else - error = tsleep(&random_systat, + error = msleep(&random_systat, &random_systat.lock, PUSER | PCATCH, "block", 0); } /* The actual read */ if (!error) { - mtx_lock(&random_systat.lock); while (uio->uio_resid > 0 && !error) { c = MIN(uio->uio_resid, PAGE_SIZE); c = (*random_systat.read)(random_buf, c); error = uiomove(random_buf, c, uio); } - mtx_unlock(&random_systat.lock); } + + mtx_unlock(&random_systat.lock); + return (error); } ------- =_aaaaaaaaaa0--