Re: panic upon kldunload snd_ich (lor # 159)

From: Pyun YongHyeon <pyunyh_at_gmail.com>
Date: Thu, 15 Sep 2005 10:45:09 +0900
On Thu, Sep 15, 2005 at 03:38:48AM +0800, Ariff Abdullah wrote:
 > 
 > On Wed, 14 Sep 2005 10:48:30 +0900
 > Pyun YongHyeon <pyunyh_at_gmail.com> wrote:
 > > 
 > > Thanks for testing. Fix committed to HEAD(sndstat.c rev. 1.21)
 > > 
 > > [ .. ]
 > > 
 > > AFAIK, the LOR is well known to sound developers. Though it's not real
 > > LOR(grabbing sx lock while holding mutex) it's difficult to fix.
 > > 
 > 
 > This is supposed to fix that LOR, I pressume. Please try that.
 > 

[...]

 > --- sys/dev/sound/pcm/sound.c.orig	Tue Sep 13 02:58:27 2005
 > +++ sys/dev/sound/pcm/sound.c	Thu Sep 15 03:29:06 2005
 > _at__at_ -807,9 +807,9 _at__at_
 >  	chn_kill(d->fakechan);
 >  	fkchan_kill(d->fakechan);
 >  
 > -	sndstat_unregister(dev);
 >  	snd_mtxunlock(d->lock);
 >  	snd_mtxfree(d->lock);
 > +	sndstat_unregister(dev);
 >  	return 0;
 >  }
 >  

That would be supposed to fix the LOR message. But I'd like to keep
lock ordering between snd_mutex and sndstat_lock. Since sndstat_read()
could be called at any time there is an implicit lock order.
I think switching to sx lock from mutex in sndstat code was to allow
uiomove with lock held. IMO, it would be even better to rewrite
sndstat_read() without using uiomove such that it can also use
standard mutex rather than sx lock.

-- 
Regards,
Pyun YongHyeon
Received on Wed Sep 14 2005 - 23:44:38 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:43 UTC