Branching CVS for 1.10 on wednesday

Matthew Dillon dillon at
Tue Jul 17 15:54:13 PDT 2007

:okay, then this is specific to hda:
:in any case, this panics the box on driver unload.
:  simon

    I think I recall saying that the design of the sound driver subsystem
    is a huge mess.

    This is the sound subsystem assuming that it a driver unload is
    serialized against the dispatch of a pending sound interrupt when it
    isn't because the interrupt may ALREADY be dispatched but stuck INSIDE
    the sound driver on a lock.  It doesn't matter what kind of lock it is.

    For that matter, any attempt to unload the driver while simultaniously
    doing some other sound operation would result in the same problem.

    If you want a hack to fix HDA then just add an unconditional tsleep
    for a few ticks in hdac_release_resources().  Try this patch.

    After the release we can come up with a more involved fix by
    forcing the interrupt teardown code to wait for any pending interrupts
    to clear before returning.

					Matthew Dillon 
					<dillon at>

Index: pci/hda/hdac.c
RCS file: /cvs/src/sys/dev/sound/pci/hda/hdac.c,v
retrieving revision 1.7
diff -u -p -r1.7 hdac.c
--- pci/hda/hdac.c	26 Jun 2007 14:56:50 -0000	1.7
+++ pci/hda/hdac.c	17 Jul 2007 22:50:05 -0000
@@ -5649,6 +5649,10 @@ 	hdac_unlock(sc);
+	/* give pending interrupts stuck on the lock a chance to clear */
+	/* bad hack */
+	tsleep(&sc->irq, 0, "hdaslp", hz / 10);
 	device_get_children(sc->dev, &devlist, &devcount);
 	for (i = 0; devlist != NULL && i < devcount; i++) {
 		devinfo = (struct hdac_devinfo *)device_get_ivars(devlist[i]);

More information about the Kernel mailing list