Skip to contentSkip to conversation

: Hard lockup from aplay with low buffersizes on Tascam us-122 (snd_usb_usx2y)

ALSA - driver 0002070 [email protected] 1 participant 1 message May 3, 2006

lore
Share & tools
lore
#0 lore raw

A NOTE has been added to this issue.
======================================================================
<https://bugtrack.alsa-project.org/alsa-bug/view.php?id=2070>
======================================================================

Reported By:                jaime
Assigned To:                karsten
======================================================================
Project:                    ALSA - driver
Issue ID:                   2070
Category:                   USB - usb-usx2y
Reproducibility:            always
Severity:                   crash
Priority:                   normal
Status:                     assigned
Distribution:               Gentoo ~x86
Kernel Version:             2.6.17-rc1
======================================================================
Date Submitted:             04-25-2006 23:07 CEST
Last Modified:              05-03-2006 02:31 CEST

======================================================================
Summary: Hard lockup from aplay with low buffersizes on
Tascam us-122 (snd_usb_usx2y)
Description:
Hi.

Here's the original I'm playing (440Hz sine wave):
www.carbon.eclipse.co.uk/origSine.wav

aplay --buffer-size=1024 origSine.wav sounds great:
www.carbon.eclipse.co.uk/aplay1024.wav

aplay --buffer-size=512 origSine.wav sounds bad:
www.carbon.eclipse.co.uk/aplay512.wav

aplay --buffer-size=256 origSine.wav sounds very bad:
www.carbon.eclipse.co.uk/aplay256.wav

aplay --buffer-size=128 origSine.wav gives only a very short click, and then locks up the machine completely:
www.carbon.eclipse.co.uk/aplay128.wav

I've tried this using different usb cards/controllers, and I get the same problem, so I think it is an alsa driver problem.

Thank you for any help you can offer.

======================================================================

----------------------------------------------------------------------
jaime - 05-02-06 21:14
----------------------------------------------------------------------
Hi Karsten.

I know that you said that it's not worth debugging this, but I'm still trying to get a stack trace, just to find out what's causing the lockup. I'm managed to get a serial console working on another machine, and using the nmi_watchdog, I get the following out 5 seconds after I start aplay:

BUG: NMI Watchdog detected LOCKUP on CPU0, eip c03393a4, registers:
Modules linked in: snd_usb_usx2y snd_usb_lib snd_rawmidi snd_seq_device

..]&#65533;.u&#65533;.}&#65533;&#65533;...0.

That's all I get, and that was after I'd set the console logging level to 8 (using /proc/sys/kernel/printk).

I've read a lot in the last few days, but I'm not sure what is the best tool to use, to get that elusive stack trace. What do you recommend?

Thanks

----------------------------------------------------------------------
karsten - 05-03-06 02:31
----------------------------------------------------------------------
"LOCKUP" sounds like you'll not get a stacktrace, 'cause the cpu just circles around in snd_usb_usx2y.ko somewhere.
this somewhere is about "eip c03393a4".

This bug might be by design:
With nrpacks=4 driver uses urbs with 4 iso packages; thats 4 ms. With a samplerate of 44100 we have 177 pcm frames in 4ms. On the other hand you've found out sound is bad for nrpacks=4 and buffersize<=512:
buffersize=512 most likely means periodsize=256 with 2 periods. so i think snd_usb_usx2y needs periodsize >= 2* (nrpacks in ms) * (pcm-frames/ms).

also if i remember correctly, it always made some clicks when i ran it (only a us428 here) with periodsize=128, 2 periods (and nrpacks=1). periodsize=64, 4 periods was ok.

also periodsize=128, 2 periods is ok with special rawusb jack mode.

here i'm currently running it (only 44100 sr works) with periodsize=64, 2 periods.
but this is only possible with a VIA uhci usb controller set to 10000 SOFs/s.
(SOF=Start of frame)
Thats a custom feature i don't know of any other usb1.1 controller. (They run with 1000 SOFs/s. That implies a 2 ms (or is it 3ms? measurements suggest this, not shure) latency penalty each direction. with 10000 SOFs/s thats only 0.2ms)
this also requires a hacked uhci_hcd.ko and a custom firmware ((dis)assembled & changed it). good thing is measured latency now is nearly as good as with the onboard soundcard.

Thanks, Karsten

Issue History
Date Modified Username Field Change
======================================================================

04-25-06 23:07 jaime          New Issue                                    
04-25-06 23:07 jaime          Distribution              => Gentoo ~x86     
04-25-06 23:07 jaime          Kernel Version            => 2.6.17-rc1      
04-26-06 16:23 jaime          Note Added: 0009514                          
04-26-06 23:19 karsten        Note Added: 0009526                          
04-26-06 23:29 karsten        Note Added: 0009527                          
04-26-06 23:31 karsten        Note Edited: 0009527                         
04-30-06 19:35 jaime          Note Added: 0009550                          
04-30-06 21:12 karsten        Note Added: 0009551                          
05-02-06 21:14 jaime          Note Added: 0009578                          
05-03-06 02:31 karsten        Note Added: 0009582                          

======================================================================

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642