Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Mar 2001 20:02:43 -0500 (EST)
From:      bloom@acm.org
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/26188: Kernel page fault in mpu attach
Message-ID:  <200103290102.f2T12gT39746@jbloom.jbloom.org>

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

>Number:         26188
>Category:       kern
>Synopsis:       Kernel page fault in mpu attach
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 28 17:10:02 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jim Bloom
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD jbloom.jbloom.org 5.0-CURRENT FreeBSD 5.0-CURRENT #95: Mon Mar 26 21:21:35 EST 2001 bloom@jbloom.jbloom.org:/usr/src/sys/compile/JMB i386

THe critical piece of hardware is a SoundBlaster AWE 64 ISA with appropriate 
configuration entries in the kernel.
>Description:
There is a page fault in the kernel while booting my machine.  This occurs
while trying the attach the mpu on my sound card.  The back trace indicates
that the page fualt is in _mtx_lock_sleep.

This problem has been occuring since around Feb 25 most likely related to
adding the mutex locking.  A later fix initialized the mutex, but still too
late.

A bit of research shows that that mutex is never initialized before attempting
to lock the mutex.  Looking at the code, the mutex is initialized after it is
first used.  In addition, I added a mutex_destroy call when cleaning up after
errors.
>How-To-Repeat:
I just boot the machine.
>Fix:

Index: mpu.c
===================================================================
RCS file: /users/ncvs/src/sys/dev/sound/isa/mpu.c,v
retrieving revision 1.5
diff -u -r1.5 mpu.c
--- mpu.c	2001/03/14 07:29:46	1.5
+++ mpu.c	2001/03/27 02:20:29
@@ -358,6 +358,8 @@
 
 	DEB(printf("mpu: attaching.\n"));
 
+	mtx_init(&scp->mtx, "mpumid", MTX_DEF);
+
 	/* Allocate the resources, switch to uart mode. */
 	if (mpu_allocres(scp, dev) || mpu_uartmode(scp)) {
 		mpu_releaseres(scp, dev);
@@ -368,7 +370,6 @@
 
 	/* Fill the softc. */
 	scp->dev = dev;
-	mtx_init(&scp->mtx, "mpumid", MTX_DEF);
 	scp->devinfo = devinfo = create_mididev_info_unit(MDT_MIDI, &mpu_op_desc, &midisynth_op_desc);
 
 	/* Fill the midi info. */
@@ -751,6 +752,7 @@
 		bus_release_resource(dev, SYS_RES_IOPORT, scp->io_rid, scp->io);
 		scp->io = NULL;
 	}
+	mtx_destroy(&scp->mtx);
 }
 
 static device_method_t mpu_methods[] = {
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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