NetBSD Problem Report #46791

From gson@gson.org  Sat Aug 11 14:27:28 2012
Return-Path: <gson@gson.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 0FFB963B882
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 11 Aug 2012 14:27:28 +0000 (UTC)
Message-Id: <20120811142725.02A1175F34@guava.gson.org>
Date: Sat, 11 Aug 2012 17:27:24 +0300 (EEST)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@gnats.NetBSD.org
Subject: eso(4) kernel panic while booting -current
X-Send-Pr-Version: 3.95

>Number:         46791
>Category:       kern
>Synopsis:       eso(4) kernel panic while booting -current
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    mrg
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 11 14:30:00 +0000 2012
>Closed-Date:    Mon Aug 13 22:04:28 +0000 2012
>Last-Modified:  Mon Aug 13 22:04:28 +0000 2012
>Originator:     Andreas Gustafsson
>Release:        NetBSD-current, source date 2012.08.10.05.22.22
>Organization:

>Environment:
System: NetBSD guava.gson.org 5.0.1 NetBSD 5.0.1 (GENERIC) #0: Thu Jul 30 01:39:11 UTC 2009 builds@b8.netbsd.org:/home/builds/ab/netbsd-5-0-1-RELEASE/i386/200907292356Z-obj/home/builds/ab/netbsd-5-0-1-RELEASE/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:

I tried booting a -current kernel on a NEC Versa Daylite, and it
paniced during boot with the following message (manually transcribed,
omitting some verbosity):

  eso0 at pci0 dev 4 function 0: ESS Solo-1 PCI AudioDrive ES1496 Revision E
  panic: kernel diagnostic assertion "mutex_owned(&sc->sc_intr_lock)" failed: file "/bracket/prod/2012.08.10.05.22.22/src/sys/dev/pci/eso.c", line 580
  fatal breakpoint trap in supervisor mode
  ...
  db{0}> bt
  ...
  eso_write_mixreg(...)
  eso_attach(...)

This looks related to PR kern/46451.

>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org, gson@gson.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: re: kern/46791: eso(4) kernel panic while booting -current
Date: Sun, 12 Aug 2012 05:20:45 +1000

 can you try this untested patch?  thanks.

 .mrg.


 Index: sys/dev/pci/eso.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/eso.c,v
 retrieving revision 1.60
 diff -p -r1.60 eso.c
 *** sys/dev/pci/eso.c	15 May 2012 18:11:28 -0000	1.60
 --- sys/dev/pci/eso.c	11 Aug 2012 19:19:53 -0000
 *************** eso_attach(device_t parent, device_t sel
 *** 267,272 ****
 --- 267,275 ----
   	pa = aux;
   	aprint_naive(": Audio controller\n");

 + 	mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
 + 	mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_AUDIO);
 + 
   	sc->sc_revision = PCI_REVISION(pa->pa_class);
   	aprint_normal(": ESS Solo-1 PCI AudioDrive ");
   	if (sc->sc_revision <
 *************** eso_attach(device_t parent, device_t sel
 *** 329,334 ****
 --- 332,339 ----
   	    ESO_IO_IRQCTL_A1IRQ | ESO_IO_IRQCTL_A2IRQ | ESO_IO_IRQCTL_HVIRQ |
   	    ESO_IO_IRQCTL_MPUIRQ);

 + 	mutex_spin_enter(&sc->sc_intr_lock);
 + 
   	/* Set up A1's sample rate generator for new-style parameters. */
   	a2mode = eso_read_mixreg(sc, ESO_MIXREG_A2MODE);
   	a2mode |= ESO_MIXREG_A2MODE_NEWA1 | ESO_MIXREG_A2MODE_ASYNC;
 *************** eso_attach(device_t parent, device_t sel
 *** 340,345 ****
 --- 345,352 ----
   	mvctl |= ESO_MIXREG_MVCTL_HVIRQM;
   	eso_write_mixreg(sc, ESO_MIXREG_MVCTL, mvctl);

 + 	mutex_spin_exit(&sc->sc_intr_lock);
 + 
   	/* Set mixer regs to something reasonable, needs work. */
   	sc->sc_recmon = sc->sc_spatializer = sc->sc_mvmute = 0;
   	eso_set_monooutsrc(sc, ESO_MIXREG_MPM_MOMUTE);
 *************** eso_attach(device_t parent, device_t sel
 *** 381,389 ****
   		return;
   	}

 - 	mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
 - 	mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_AUDIO);
 - 
   	intrstring = pci_intr_string(pa->pa_pc, ih);
   	sc->sc_ih  = pci_intr_establish(pa->pa_pc, ih, IPL_AUDIO, eso_intr, sc);
   	if (sc->sc_ih == NULL) {
 --- 388,393 ----

Responsible-Changed-From-To: kern-bug-people->mrg
Responsible-Changed-By: mrg@NetBSD.org
Responsible-Changed-When: Sun, 12 Aug 2012 07:28:57 +0000
Responsible-Changed-Why:
i'll take care of this.


State-Changed-From-To: open->feedback
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Sun, 12 Aug 2012 07:28:57 +0000
State-Changed-Why:
test patch has been supplied.


From: Andreas Gustafsson <gson@gson.org>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@netbsd.org,
    gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org,
    gson@gson.org (Andreas Gustafsson)
Subject: re: kern/46791: eso(4) kernel panic while booting -current
Date: Sun, 12 Aug 2012 16:32:05 +0300

 matthew green wrote:
 >  can you try this untested patch?  thanks.

 I tried the patch, but it still panics in the same place. 
 I think the actual call path causing the panic is

   eso_attach() -> eso_reset() (inlined) -> eso_write_mixreg()

 but in addition to that, it looks like eso_attach() also calls several
 other functions that assert that intr_lock is held without actually
 holding it: eso_set_monooutsrc(), eso_set_mopnoinbypass(),
 eso_set_preamp(), and eso_set_recsrc().
 -- 
 Andreas Gustafsson, gson@gson.org

From: "Andreas Gustafsson" <gson@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46791 CVS commit: src/sys/dev/pci
Date: Sun, 12 Aug 2012 18:39:32 +0000

 Module Name:	src
 Committed By:	gson
 Date:		Sun Aug 12 18:39:32 UTC 2012

 Modified Files:
 	src/sys/dev/pci: eso.c

 Log Message:
 Add missing locking calls to eso_attach() to avoid panic on boot.
 Partly based on a patch from mrg.  Fixes PR kern/46791.


 To generate a diff of this commit:
 cvs rdiff -u -r1.60 -r1.61 src/sys/dev/pci/eso.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 13 Aug 2012 19:51:31 +0000
State-Changed-Why:
Fixed (this doesn't need to be pulled up, right?)


State-Changed-From-To: closed->pending-pullups
State-Changed-By: gson@NetBSD.org
State-Changed-When: Mon, 13 Aug 2012 20:01:44 +0000
State-Changed-Why:
This does need to be pulled up and is waiting for [pullup-6 #494].


From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46791 CVS commit: [netbsd-6] src/sys/dev/pci
Date: Mon, 13 Aug 2012 20:27:12 +0000

 Module Name:	src
 Committed By:	riz
 Date:		Mon Aug 13 20:27:12 UTC 2012

 Modified Files:
 	src/sys/dev/pci [netbsd-6]: eso.c

 Log Message:
 Pull up following revision(s) (requested by gson in ticket #494):
 	sys/dev/pci/eso.c: revision 1.61
 Add missing locking calls to eso_attach() to avoid panic on boot.
 Partly based on a patch from mrg.  Fixes PR kern/46791.


 To generate a diff of this commit:
 cvs rdiff -u -r1.59.4.1 -r1.59.4.2 src/sys/dev/pci/eso.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 13 Aug 2012 22:04:28 +0000
State-Changed-Why:
ok, it's in -6 now, sorry about that.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.