Bug 46011
Summary: | Capture of sound from USB connected audio card (UGM96) doesn't work in 3.5.1 - kernel bug generated: scheduling while atomic | ||
---|---|---|---|
Product: | Drivers | Reporter: | WZab (wzab) |
Component: | Sound(ALSA) | Assignee: | Jaroslav Kysela (perex) |
Status: | RESOLVED CODE_FIX | ||
Severity: | normal | CC: | alan, florian, tiwai, zonque |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 3.5.1, 3.5.2 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: |
Test fix patch
Fix URB cancellation at stream start Fix URB cancellation at stream start |
Description
WZab
2012-08-15 09:36:26 UTC
Looks like a left-over EP deactivation code in snd_usb_endpoint_start() causing the problem. The deactivation should be called manually in the prepare callback, and let the start without sleeping. Could you try the patch below? Created attachment 77771 [details]
Test fix patch
I've patched my kernel and recompiled it. Now I get no kernel bug, but simply information: [ 201.644625] cannot submit urb 0, error -28: not enough bandwidth [ 218.941094] cannot submit urb 0, error -28: not enough bandwidth [ 250.218323] cannot submit urb 0, error -28: not enough bandwidth [ 355.373665] cannot submit urb 0, error -28: not enough bandwidth Now I'm trying recompilation of the fresh 3.5.1 sources, patched right after unpacking. Even after fresh recompilation of patched sources I get the same problem: In kernel logs: [ 129.679542] cannot submit urb 0, error -28: not enough bandwidth In qjackctl logs: ALSA: prepare error for playback on "hw:1" (Broken pipe) JackAudioDriver::ProcessAsync: read error, stopping... So the patch prevents kernel bug, but also blocks proper initialization of the USB sound capture... Which kernel did you use before and did does the same hardware work with that older version? IOW: Is this a regression? Before I used 3.4.5, and it didn't cause any problems. I can try 3.4.9 and 3.5.2 and let you know about results. I have one more detail which may be important: With the 3.5.1 kernel patched with the Takashi's patch the UGM96 works correctly, if connected directly to the USB connector of my machine. The problem with: [7949.470578] cannot submit urb 0, error -28: not enough bandwidth occurs only when the UGM96 is connected via the Hi-speed USB hub. I've checked two hubs: Bus 004 Device 011: ID 0a05:0001 Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 9 Hub bDeviceSubClass 0 Unused bDeviceProtocol 1 Single TT bMaxPacketSize0 64 idVendor 0x0a05 idProduct 0x0001 bcdDevice 1.00 iManufacturer 0 iProduct 1 USB2.0 Hub iSerial 0 Bus 004 Device 013: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 9 Hub bDeviceSubClass 0 Unused bDeviceProtocol 1 Single TT bMaxPacketSize0 64 idVendor 0x05e3 Genesys Logic, Inc. idProduct 0x0608 USB-2.0 4-Port HUB bcdDevice 9.01 iManufacturer 0 iProduct 1 USB2.0 Hub iSerial 0 and with both hubs the same problem occurred. With the older 3.4.5 kernel UGM96 works correctly in all three cases (connected directly and via both hubs). Ok, the other bug might in fact be unrelated. We should definitely take Takashi's patch, and then ponder on the other one separately. The strangest thing, is that in the original 3.5.2 kernel both with UGM96 connected via hub and without hub, I was able to obtain sound capture (however finally the kernel generated bug: Aug 15 23:08:16 WZLap kernel: [ 323.270624] input: EGOSYS, Inc. UGM96 as /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.3/4-1.3.2/4-1.3.2:1.0/input/input19 Aug 15 23:08:16 WZLap kernel: [ 323.271074] hid-generic 0003:0A92:2041.0004: input,hidraw0: USB HID v1.00 Device [EGOSYS, Inc. UGM96] on usb-0000:00:1d.0-1.3.2/input0 Aug 15 23:12:20 WZLap kernel: [ 566.841606] BUG: scheduling while atomic: jackd/6419/0x00000005 Aug 15 23:12:20 WZLap kernel: [ 566.841615] Modules linked in: snd_seq_dummy snd_hrtimer tun cpufreq_conservative cpufreq_userspace cpufreq_stats cpufreq_powersave ebtable_nat ebtables ipx p8023 p8022 psnap llc parport_pc ppdev lp parport hidp rfcomm bnep binfmt_misc uinput fuse nfsd nfs nfs_acl auth_rpcgss fscache lockd sunrpc ip6table_filter ip6_tables nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack xt_tcpudp xt_owner iptable_filter ip_tables x_tables loop ecryptfs sha256_generic dm_crypt uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_core videodev media hid_generic snd_hda_codec_realtek joydev option usb_wwan usbserial usb_storage usbhid hid snd_usb_audio snd_usbmidi_lib cdc_ether usbnet uas snd_hda_intel snd_hda_codec snd_hwdep snd_pcm_oss nouveau mxm_wmi ttm snd_mixer_oss i915 drm_kms_helper snd_pcm snd_page_alloc snd_seq_midi snd_seq_midi_event arc4 snd_rawmidi snd_seq snd_seq_device iwlwifi coretemp drm intel_agp intel_gtt acpi_cpufreq mperf psmouse(O) btusb pcspkr dell_wmi snd_timer agpga Aug 15 23:12:20 WZLap kernel: rt bluetooth snd evdev serio_raw sparse_keymap i2c_algo_bit i2c_i801 i2c_core lpc_ich mfd_core dell_laptop dcdbas soundcore wmi processor kvm_intel video ac button battery mac80211 cfg80211 rfkill kvm microcode ext4 crc16 jbd2 mbcache dm_mod sr_mod sd_mod cdrom crc_t10dif crc32c_intel ghash_clmulni_intel aesni_intel ahci aes_x86_64 libahci aes_generic libata cryptd scsi_mod r8169 mii xhci_hcd thermal thermal_sys ehci_hcd usbcore usb_common [last unloaded: scsi_wait_scan] Aug 15 23:12:20 WZLap kernel: [ 566.841897] Pid: 6419, comm: jackd Tainted: G O 3.5.2 #1 Aug 15 23:12:20 WZLap kernel: [ 566.841900] Call Trace: Aug 15 23:12:20 WZLap kernel: [ 566.841919] [<ffffffff813415df>] ? __schedule_bug+0x43/0x50 Aug 15 23:12:20 WZLap kernel: [ 566.841930] [<ffffffff81345901>] ? __schedule+0x90/0x507 Aug 15 23:12:20 WZLap kernel: [ 566.841938] [<ffffffff81346a6b>] ? _raw_spin_unlock_irqrestore+0x2b/0x37 Aug 15 23:12:20 WZLap kernel: [ 566.841946] [<ffffffff81344ce8>] ? schedule_timeout+0xa9/0xe1 Aug 15 23:12:20 WZLap kernel: [ 566.841957] [<ffffffff810455fb>] ? ftrace_raw_event_timer_class+0x8e/0x8e Aug 15 23:12:20 WZLap kernel: [ 566.841977] [<ffffffffa05c1313>] ? wait_clear_urbs+0x4b/0x71 [snd_usb_audio] Aug 15 23:12:20 WZLap kernel: [ 566.841995] [<ffffffffa05c1d5b>] ? snd_usb_endpoint_start+0x3e/0x1e9 [snd_usb_audio] Aug 15 23:12:20 WZLap kernel: [ 566.842013] [<ffffffffa05c761e>] ? start_endpoints+0x24/0x69 [snd_usb_audio] Aug 15 23:12:20 WZLap kernel: [ 566.842027] [<ffffffffa05c7693>] ? snd_usb_substream_capture_trigger+0x30/0x71 [snd_usb_audio] Aug 15 23:12:20 WZLap kernel: [ 566.842044] [<ffffffffa04191ee>] ? snd_pcm_action_group+0x92/0x1bb [snd_pcm] Aug 15 23:12:20 WZLap kernel: [ 566.842059] [<ffffffffa041928c>] ? snd_pcm_action_group+0x130/0x1bb [snd_pcm] Aug 15 23:12:20 WZLap kernel: [ 566.842078] [<ffffffffa041a068>] ? snd_pcm_action_lock_irq+0x53/0x9d [snd_pcm] Aug 15 23:12:20 WZLap kernel: [ 566.842095] [<ffffffffa041bcaf>] ? snd_pcm_common_ioctl1+0x3c5/0xa47 [snd_pcm] Aug 15 23:12:20 WZLap kernel: [ 566.842112] [<ffffffffa041c70f>] ? snd_pcm_playback_ioctl1+0x1ce/0x1e4 [snd_pcm] Aug 15 23:12:20 WZLap kernel: [ 566.842129] [<ffffffffa041c74c>] ? snd_pcm_playback_ioctl+0x27/0x2b [snd_pcm] Aug 15 23:12:20 WZLap kernel: [ 566.842140] [<ffffffff8110e162>] ? vfs_ioctl+0x1e/0x31 Aug 15 23:12:20 WZLap kernel: [ 566.842148] [<ffffffff8110e947>] ? do_vfs_ioctl+0x3b8/0x3fa Aug 15 23:12:20 WZLap kernel: [ 566.842158] [<ffffffff8101390a>] ? read_tsc+0x5/0x14 Aug 15 23:12:20 WZLap kernel: [ 566.842166] [<ffffffff8106ffa4>] ? timekeeping_get_ns+0xd/0x2a Aug 15 23:12:20 WZLap kernel: [ 566.842175] [<ffffffff8110e9d4>] ? sys_ioctl+0x4b/0x6f Aug 15 23:12:20 WZLap kernel: [ 566.842183] [<ffffffff8134b079>] ? system_call_fastpath+0x16/0x1b Aug 15 23:14:23 WZLap kernel: [ 689.813689] BUG: scheduling while atomic: jackd/6419/0x00000005 Aug 15 23:14:23 WZLap kernel: [ 689.813698] Modules linked in: snd_seq_dummy snd_hrtimer tun cpufreq_conservative cpufreq_userspace cpufreq_stats cpufreq_powersave ebtable_nat ebtables ipx p8023 p8022 psnap llc parport_pc ppdev lp parport hidp rfcomm bnep binfmt_misc uinput fuse nfsd nfs nfs_acl auth_rpcgss fscache lockd sunrpc ip6table_filter ip6_tables nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack xt_tcpudp xt_owner iptable_filter ip_tables x_tables loop ecryptfs sha256_generic dm_crypt uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_core videodev media hid_generic snd_hda_codec_realtek joydev option usb_wwan usbserial usb_storage usbhid hid snd_usb_audio snd_usbmidi_lib cdc_ether usbnet uas snd_hda_intel snd_hda_codec snd_hwdep snd_pcm_oss nouveau mxm_wmi ttm snd_mixer_oss i915 drm_kms_helper snd_pcm snd_page_alloc snd_seq_midi snd_seq_midi_event arc4 snd_rawmidi snd_seq snd_seq_device iwlwifi coretemp drm intel_agp intel_gtt acpi_cpufreq mperf psmouse(O) btusb pcspkr dell_wmi snd_timer agpga Aug 15 23:14:23 WZLap kernel: rt bluetooth snd evdev serio_raw sparse_keymap i2c_algo_bit i2c_i801 i2c_core lpc_ich mfd_core dell_laptop dcdbas soundcore wmi processor kvm_intel video ac button battery mac80211 cfg80211 rfkill kvm microcode ext4 crc16 jbd2 mbcache dm_mod sr_mod sd_mod cdrom crc_t10dif crc32c_intel ghash_clmulni_intel aesni_intel ahci aes_x86_64 libahci aes_generic libata cryptd scsi_mod r8169 mii xhci_hcd thermal thermal_sys ehci_hcd usbcore usb_common [last unloaded: scsi_wait_scan] Aug 15 23:14:23 WZLap kernel: [ 689.813978] Pid: 6419, comm: jackd Tainted: G W O 3.5.2 #1 Aug 15 23:14:23 WZLap kernel: [ 689.813981] Call Trace: Aug 15 23:14:23 WZLap kernel: [ 689.814000] [<ffffffff813415df>] ? __schedule_bug+0x43/0x50 Aug 15 23:14:23 WZLap kernel: [ 689.814010] [<ffffffff81345901>] ? __schedule+0x90/0x507 Aug 15 23:14:23 WZLap kernel: [ 689.814018] [<ffffffff81346a6b>] ? _raw_spin_unlock_irqrestore+0x2b/0x37 Aug 15 23:14:23 WZLap kernel: [ 689.814026] [<ffffffff81344ce8>] ? schedule_timeout+0xa9/0xe1 Aug 15 23:14:23 WZLap kernel: [ 689.814038] [<ffffffff810455fb>] ? ftrace_raw_event_timer_class+0x8e/0x8e Aug 15 23:14:23 WZLap kernel: [ 689.814057] [<ffffffffa05c1313>] ? wait_clear_urbs+0x4b/0x71 [snd_usb_audio] Aug 15 23:14:23 WZLap kernel: [ 689.814075] [<ffffffffa05c1d5b>] ? snd_usb_endpoint_start+0x3e/0x1e9 [snd_usb_audio] Aug 15 23:14:23 WZLap kernel: [ 689.814093] [<ffffffffa05c761e>] ? start_endpoints+0x24/0x69 [snd_usb_audio] Aug 15 23:14:23 WZLap kernel: [ 689.814107] [<ffffffffa05c7693>] ? snd_usb_substream_capture_trigger+0x30/0x71 [snd_usb_audio] Aug 15 23:14:23 WZLap kernel: [ 689.814123] [<ffffffffa04191ee>] ? snd_pcm_action_group+0x92/0x1bb [snd_pcm] Aug 15 23:14:23 WZLap kernel: [ 689.814139] [<ffffffffa041928c>] ? snd_pcm_action_group+0x130/0x1bb [snd_pcm] Aug 15 23:14:23 WZLap kernel: [ 689.814157] [<ffffffffa041a068>] ? snd_pcm_action_lock_irq+0x53/0x9d [snd_pcm] Aug 15 23:14:23 WZLap kernel: [ 689.814174] [<ffffffffa041bcaf>] ? snd_pcm_common_ioctl1+0x3c5/0xa47 [snd_pcm] Aug 15 23:14:23 WZLap kernel: [ 689.814191] [<ffffffffa041c70f>] ? snd_pcm_playback_ioctl1+0x1ce/0x1e4 [snd_pcm] Aug 15 23:14:23 WZLap kernel: [ 689.814208] [<ffffffffa041c74c>] ? snd_pcm_playback_ioctl+0x27/0x2b [snd_pcm] Aug 15 23:14:23 WZLap kernel: [ 689.814218] [<ffffffff8110e162>] ? vfs_ioctl+0x1e/0x31 Aug 15 23:14:23 WZLap kernel: [ 689.814226] [<ffffffff8110e947>] ? do_vfs_ioctl+0x3b8/0x3fa Aug 15 23:14:23 WZLap kernel: [ 689.814236] [<ffffffff8101390a>] ? read_tsc+0x5/0x14 Aug 15 23:14:23 WZLap kernel: [ 689.814243] [<ffffffff8106ffa4>] ? timekeeping_get_ns+0xd/0x2a Aug 15 23:14:23 WZLap kernel: [ 689.814252] [<ffffffff8110e9d4>] ? sys_ioctl+0x4b/0x6f Aug 15 23:14:23 WZLap kernel: [ 689.814260] [<ffffffff8134b079>] ? system_call_fastpath+0x16/0x1b After applying the patch to 3.5.2, again capture works with UGM96 connected directly, and generates: [ 129.423617] cannot submit urb 0, error -28: not enough bandwidth when UGM96 is connected via hub. Kernel 3.4.9 works with the same hardware - UGM96, both connected directly and via hub, without any problems. A patch referencing this bug report has been merged in Linux v3.6-rc3: commit e9ba389c5ffc4dd29dfe17e00e48877302111135 Author: Takashi Iwai <tiwai@suse.de> Date: Wed Aug 15 12:32:00 2012 +0200 ALSA: usb-audio: Fix scheduling-while-atomic bug in PCM capture stream Thanks for fixing the main bug, however the second problem, reported in comments #4 and #10 still exists. Should I re-report it as another bug (as the subject is not valid any more, it should be rather: "error -28: not enough bandwidth when USB audio capturee device is connected via USB hub")? Please open a second bug.. it's easier to manage that way The patch that was discussed earlier and which made it to mainline already does not do the right thing, I believe. Could you try this one on top of 3.6-rcX please? Created attachment 78711 [details]
Fix URB cancellation at stream start
Created attachment 78751 [details]
Fix URB cancellation at stream start
The attached patch (id=78751) doesn't work with kernel 3.5.3 patch -p1 < ../0001-ALSA-snd-usb-Fix-URB-cancellation-at-stream-start.patch patching file sound/usb/endpoint.c Hunk #3 succeeded at 827 with fuzz 2 (offset 4 lines). patching file sound/usb/endpoint.h patching file sound/usb/pcm.c Hunk #4 FAILED at 544. Hunk #5 succeeded at 1172 (offset -3 lines). 1 out of 5 hunks FAILED -- saving rejects to file sound/usb/pcm.c.rej The patch has already been merged as other people signalled success in testing it. Please go ahead and try Linus' current master branch. The patch has been marked for stable@ and should be picked up soon. OK. I can see, that it should be aplied AFTER the previous patch! #patch -p1 < ../0001-ALSA-usb-audio-Fix-scheduling-while-atomic-bug-in-PC.patch patching file sound/usb/endpoint.c patching file sound/usb/pcm.c # patch -p1 < ../0001-ALSA-snd-usb-Fix-URB-cancellation-at-stream-start.patch patching file sound/usb/endpoint.c patching file sound/usb/endpoint.h patching file sound/usb/pcm.c With kernel 3.5.3 compiled with both above patches applied: When tried to start UGM96 connected via hub - system froze immediately. I had to switch the power off. When tried to start UGM96 connected directly, I got the following error: [ 113.313284] retire_capture_urb: 3720 callbacks suppressed [ 159.005496] cannot submit urb 0, error -28: not enough bandwidth Please try Linus' master branch. There were some other patches for this drivers as well. I've checked 3.6-rc4. There are still problems: with hub - [ 137.929189] cannot submit urb 0, error -28: not enough bandwidth without hub - [ 188.164687] retire_capture_urb: 4419 callbacks suppressed [ 188.188062] cannot submit urb 0, error -28: not enough bandwidth (but these may be different problems - related rather to bug https://bugzilla.kernel.org/show_bug.cgi?id=47201 ? The bandwidth issue is not about the sound driver but rather a problem with usb host controller. If this still happens with 3.12 kernel, please open another bug report. In that case, it'd be also helpful to test sound.git tree (for-linus branch) as well, since some usb-audio fixes are there for 3.13-rc1. |