Hi, Testing ohci recently, I came across a problem where our audio stack doesn't handle removing an audio device whilst it's open. I connected a uaudio device (dmesg below), ran mplayer:
:; mplayer -ao oss:device=/dev/audio1 track.ogg and removed the uaudio device in the middle of the track. This resulted in an endless stream (roughly once every 5 seconds) of: audio1: audio_unlink: cv_timedwait_sig failed 35 and no USB device was recognised on that (phtsical) port. Also, when I connected the uaudio device to another port, it kept incrementing the device number - uaudio1/audio2, uaudio2/audio1, etc. Finally, when rebooting, I saw: panic: kernel diagnostic assertion "(target->prt_class == class)" failed: file "/usr/src/sys/kern/subr_psref.c", line 519 mismatched psref target class: 0x0 (ref) != 0x106eba700 (expected) with a backtrace: db{0}> bt kern_assert(1adcb08, 1a370f0, 1adcae8, 1adc9d0, 207, 0) at netbsd:kern_assert+0x34 psref_target_destroy(109591e88, 106eba700, 1092688c0, 1a37100, 109591e70, e0048000) at netbsd:psref_target_destroy+0xf8 audiodetach(109591640, 4, ff070000000001, 109591e70, 0, 109591cc0) at netbsd:audiodetach+0xb8 config_detach(109591640, 4, 1c7b400, 1a37100, 1c70240, 1c3c220) at netbsd:config_detach+0x90 ... The devices that I tested with were: ohci0 at pci0 dev 5 function 3: Sun Microsystems USB Controller (rev. 0x01) ohci0: interrupting at ivec 21f ohci0: OHCI version 1.0, legacy support usb0 at ohci0: USB revision 1.0 ohci1 at pci0 dev 2 function 0: Acer Labs M5237 USB 1.1 Host Controller (rev. 0x03) ohci1: interrupting at ivec 211 ohci1: OHCI version 1.0, legacy support usb1 at ohci1: USB revision 1.0 ohci2 at pci0 dev 2 function 1: Acer Labs M5237 USB 1.1 Host Controller (rev. 0x03) ohci2: interrupting at ivec 211 ohci2: OHCI version 1.0, legacy support usb2 at ohci2: USB revision 1.0 ehci0 at pci0 dev 2 function 3: Acer Labs M5239 USB 2.0 Host Controller (rev. 0x01) ehci0: interrupting at ivec 210 ehci0: 2 companion controllers, 2 ports each: ohci1 ohci2 usb3 at ehci0: USB revision 2.0 uaudio0 at uhub0 port 4 configuration 1 interface 0 uaudio0: Logitech (0x046d) Logitech USB Headset (0x0a01), rev 1.10/10.13, addr 2 uaudio0: ignored input endpoint of type adaptive uaudio0: audio rev 1.00 audio1 at uaudio0: playback audio1: slinear_be:16 -> slinear_le:16 2ch 48000Hz, blk 11520 bytes (60ms) for playback spkr1 at audio1: PC Speaker (synthesized) wsbell at spkr1 not configured Regards, Julian