[alsa-devel] Card driver: device or resource busy

torsten.schenk torsten.schenk at zoho.com
Sat Jan 15 19:11:47 CET 2011


I'm currently developing a driver for a card. PCM playback works so far, I just encountered some playback issues when firefox (flash) and another alsa client wanted to play back at the same time. I figured out that the difference between my driver and existing ones is, that my driver only allows one client and others multiple. I get a "Device or resource busy" when I play back two times the same file (also different ones of course) with mplayer f.ex.

I was able to track this down to the fact, that (only) the O_APPEND Flag is missing in file->f_flags (snd_pcm_attach_substream), but was completely unable to find out where this flag comes from in other drivers.
Another point (perhaps not unrelated to this) is, that I get a bug (see below) that seems to tell me, that prepare cannot schedule. Contrary to the documentation that says that prepare is now non-atomic. It is useful to wait in the prepare function since I need to set the sample rate and wait for a reply (USB device). Before I rewrite it, i wanted to ask about atomicity in prepare on this ML.


[ 3662.318321] usb 1-2: unlink qh0-00ff/f69a5300 start 0 [2/0 us]
[ 3662.318434] BUG: scheduling while atomic: aplay/17902/0x00000002
[ 3662.318435] Modules linked in: snd_usb_6fire snd_rawmidi snd_seq_device snd_pcm snd_timer snd soundcore snd_page_alloc nvidia(P) [last unloaded: soundcore]
[ 3662.318443] Pid: 17902, comm: aplay Tainted: P            2.6.36-gentoo-r5 #3
[ 3662.318445] Call Trace:
[ 3662.318448]  [<c1025fa0>] __schedule_bug+0x48/0x4d
[ 3662.318451]  [<c136f438>] schedule+0x9d/0x6b6
[ 3662.318454]  [<c10383f6>] ? __mod_timer+0xf5/0x100
[ 3662.318457]  [<c136fc83>] schedule_timeout+0x73/0x90
[ 3662.318460]  [<c1037ffe>] ? process_timeout+0x0/0xa
[ 3662.318463]  [<fa335622>] pcm_alsa_prepare+0x353/0x3a5 [snd_usb_6fire]
[ 3662.318467]  [<c1043121>] ? autoremove_wake_function+0x0/0x2f
[ 3662.318472]  [<fa2fb700>] snd_pcm_do_prepare+0xc/0x1c [snd_pcm]
[ 3662.318476]  [<fa2fb4d3>] snd_pcm_action_single+0x25/0x4b [snd_pcm]
[ 3662.318481]  [<fa2fc4cc>] snd_pcm_action_nonatomic+0x42/0x55 [snd_pcm]
[ 3662.318486]  [<fa2fe0c9>] snd_pcm_common_ioctl1+0x379/0xa19 [snd_pcm]
[ 3662.318489]  [<c1086437>] ? find_get_page+0x6b/0x74
[ 3662.318492]  [<c10259f4>] ? get_parent_ip+0xb/0x31
[ 3662.318497]  [<fa2fed24>] snd_pcm_playback_ioctl1+0x2d4/0x2eb [snd_pcm]
[ 3662.318500]  [<c1168866>] ? file_has_perm+0x7c/0x85
[ 3662.318505]  [<fa2fed5b>] snd_pcm_playback_ioctl+0x20/0x2d [snd_pcm]
[ 3662.318513]  [<fa2fed3b>] ? snd_pcm_playback_ioctl+0x0/0x2d [snd_pcm]
[ 3662.318515]  [<c10b9e1a>] do_vfs_ioctl+0x43c/0x481
[ 3662.318519]  [<c1168a26>] ? selinux_file_ioctl+0x3e/0x41
[ 3662.318522]  [<c10b9ea0>] sys_ioctl+0x41/0x61
[ 3662.318525]  [<c100278c>] sysenter_do_call+0x12/0x22

More information about the Alsa-devel mailing list