Re: LOR with sound

From: Don Lewis <truckman_at_FreeBSD.org>
Date: Sun, 22 Feb 2004 15:47:35 -0800 (PST)
('BINARY' encoding is not supported, stored as-is)
On 16 Feb, Munehiro Matsuda wrote:
> Hi all,
> 
> I've gotten following LoR with sounde code, using kernel from Feb 15th
> with patch from Mathew Kanner:
>      http://docs.freebsd.org/cgi/mid.cgi?20031215185606.GA63202
> 
>> lock order reversal
>>  1st 0xc31ca140 pcm0:play:0 (pcm play channel) _at_ dev/sound/pcm/channel.c:1069
>>  2nd 0xc31b6ec0 pcm0:record:0 (pcm record channel) _at_ dev/sound/pcm/channel.c:1350
>> Stack backtrace:
>> backtrace(0,ffffffff,c0761120,c0761148,c07303fc) at backtrace+0x12
>> witness_checkorder(c31b6ec0,9,c06cfeaf,546) at witness_checkorder+0x593
>> _mtx_lock_flags(c31b6ec0,0,c06cfea6,546,d29f2a70) at _mtx_lock_flags+0x67
>> chn_lock(c32add80,c,c407b000,c405b000,102) at chn_lock+0x1a
>> sndbuf_remalloc(c31bab00,200,100,c32add80,100) at sndbuf_remalloc+0x8c
>> chn_setblocksize(c32add80,200,0,20000,c31cf718) at chn_setblocksize+0x306
>> chn_tryspeed(c32add80,1f40) at chn_tryspeed+0x149
>> chn_tryformat(c32add80,10,10,d29f2c60,d29f2c60) at chn_tryformat+0xaf
>> chn_setformat(c32add80,10,0,c1616a00,c32add80) at chn_setformat+0x15
>> dsp_ioctl(c075a6a0,c0045005,d29f2c60,3,c3733540) at dsp_ioctl+0x9f2
>> spec_ioctl(d29f2b88,d29f2c34,c0583df7,d29f2b88,c074fc40) at spec_ioctl+0x12d
>> spec_vnoperate(d29f2b88) at spec_vnoperate+0x13
>> vn_ioctl(c3778f24,c0045005,d29f2c60,c371f180,c3733540) at vn_ioctl+0x17f
>> ioctl(c3733540,d29f2d14,3,5,296) at ioctl+0x37c
>> syscall(c068002f,2f,2f,0,0) at syscall+0x217
>> Xint0x80_syscall() at Xint0x80_syscall+0x1d
>> --- syscall (54), eip = 0x284e7b1b, esp = 0xbfbf5dfc, ebp = 0xbfbf5e18 ---
> 
> 
> Also, I'm getting following warning with sound related code path.
> 
>> malloc() of "4096" with the following non-sleepable locks held:
>> exclusive sleep mutex pcm0:play:0 (pcm play channel) r = 0 (0xc31ca140) locked _at_ dev/sound/pcm/channel.c:1069
>> malloc() of "4096" with the following non-sleepable locks held:
>> exclusive sleep mutex pcm0 (sound cdev) r = 0 (0xc31ca2c0) locked _at_ dev/sound/pcm/dsp.c:213
>> malloc() of "4096" with the following non-sleepable locks held:
>> exclusive sleep mutex pcm0:record:0 (pcm record channel) r = 0 (0xc31b6ec0) locked _at_ dev/sound/pcm/dsp.c:479
> 
> FYI, I use following sound card build into my note book.
> 
> pcm0: <Yamaha DS-1E (YMF744)> port 0xfcac-0xfcaf,0xfc00-0xfc3f mem 0xfecf0000-0xfecf7fff irq 9 at device 9.0 on pci0
> pcm0: <Asahi Kasei AK4543 AC97 Codec>

Here's a different patch to dsp_ioctl() that optimizes out some unneeded
channel locking and unlocking, at the expense of bloating the source. It
needs some review and testing.  It should get rid of the complaints
about the channel mutex lock order reversals and malloc() calls while
the channel mutexes are held.  The malloc() call while the "sound cdev"
mutex held problem is not addresses by this patch.



Received on Sun Feb 22 2004 - 14:47:57 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:44 UTC