Complaints about the sound system with regard to USB

Hans Petter Selasky hselasky at c2i.net
Mon Jun 19 11:46:46 UTC 2006


Hi,

I have some complaints about the sound system with regard to USB.

1) If you are playing sound, and unplug the sound device, the system is going 
to come down with a panic, hence "pcm_unregister()" returns EBUSY, and that 
is not allowed when a USB device is detached.

2) The locking system is not right. Why must the sound device driver unlock 
its private lock before calling "chn_intr()" ? I see why, because else you 
get a dead lock:

   if (ch->run) {
    ICH_UNLOCK(sc);
    chn_intr(ch->channel);
    ICH_LOCK(sc);
   }

Solution:

1) It is not impossible to kill opened devices at detach.

2) Please use only one lock per "sound-controller". All "child" structures 
should be protected by this lock, PCM, MIDI, whatever. And when you call up, 
lock this lock before doing the call, ala CHN_LOCK(). And when you call down, 
this lock should already be locked.

/*---------------------------------------------------------------------------*
 *      pcm_controller_allocate
 *
 * NOTE: all sub-controllers are under the same lock!
 *---------------------------------------------------------------------------*/
struct pcm_controller *
pcm_controller_allocate(u_int8_t portable, u_int8_t sub_controllers)

Any comments?

--HPS


More information about the freebsd-multimedia mailing list