From owner-freebsd-bugs Wed Mar 28 17:10:17 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id CC8D237B718 for ; Wed, 28 Mar 2001 17:10:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2T1A3M01158; Wed, 28 Mar 2001 17:10:03 -0800 (PST) (envelope-from gnats) Received: from jbloom.jbloom.org (reyim.ne.mediaone.net [24.218.251.241]) by hub.freebsd.org (Postfix) with ESMTP id 9ED5937B71E for ; Wed, 28 Mar 2001 17:03:59 -0800 (PST) (envelope-from bloom@jbloom.jbloom.org) Received: (from bloom@localhost) by jbloom.jbloom.org (8.11.2/8.11.2) id f2T12gT39746; Wed, 28 Mar 2001 20:02:43 -0500 (EST) (envelope-from bloom) Message-Id: <200103290102.f2T12gT39746@jbloom.jbloom.org> Date: Wed, 28 Mar 2001 20:02:43 -0500 (EST) From: bloom@acm.org Reply-To: bloom@acm.org To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: kern/26188: Kernel page fault in mpu attach Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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