Bug 53241 (Soundcard)

Summary: After updating kernel to 3.7.3, an error appears when starting jack server using TASCAM US-122L sound card.
Product: Drivers Reporter: Antanas (antanas.com)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: RESOLVED CODE_FIX    
Severity: normal CC: drikkbart, gary010971, smimram, spamcyman, superquad.vortex2, tiwai, trulanm
Priority: P1    
Hardware: All   
OS: Linux   
URL: https://bugs.archlinux.org/task/33499
Kernel Version: 3.9.4 Subsystem:
Regression: No Bisected commit-id:
Attachments: asoundrc file which was used for the sound card to work before

Description Antanas 2013-01-30 18:41:03 UTC
Created attachment 92301 [details]
asoundrc file which was used for the sound card to work before

After updating kernel to 3.7.3, an error appears when starting jack server using TASCAM US-122L sound card. Updating to 3.7.4 does not solve the issue.

package versions:
linux kernel 3.7.3 and 3.7.4
alsa-utils 1.0.26
alsa-lib 1.0.26

cat /proc/asound/cards
0 [Intel ]: HDA-Intel - HDA Intel
HDA Intel at 0xfebfc000 irq 45
1 [US122L ]: USB US-122L - TASCAM US-122L
TASCAM US-122L (644:800e if 0 at 001/002)


First trying usb_stream it says that there is no such file:

jackd -v -R -d alsa -d usb_stream:US122L -r44100 -p512
jackdmp 1.9.8
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2011 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
no message buffer overruns
no message buffer overruns
no message buffer overruns
JACK server starting in realtime mode with priority 10
Jack: Create non RT thread
Jack: ThreadHandler: start
Jack: playback device usb_stream:US122L
Jack: capture device usb_stream:US122L
Jack: apparent rate = 44100
Jack: frames per period = 512
Jack: JackDriver::Open capture_driver_name = usb_stream:US122L
Jack: JackDriver::Open playback_driver_name = usb_stream:US122L
Jack: Check protocol client = 8 server = 8
Jack: JackEngine::ClientInternalOpen: name = system
Jack: JackEngine::AllocateRefNum ref = 0
Jack: JackPosixSemaphore::Allocate name = jack_sem.1000_default_system val = 0
Jack: JackEngine::NotifyAddClient: name = system
Jack: JackGraphManager::SetBufferSize size = 512
Jack: JackConnectionManager::DirectConnect first: ref1 = 0 ref2 = 0
Jack: JackGraphManager::ConnectRefNum cur_index = 0 ref1 = 0 ref2 = 0
Jack: JackDriver::SetupDriverSync driver sem in flush mode
ALSA lib control.c:953:(snd_ctl_open_noupdate) Invalid CTL usb_stream:US122L
control open "usb_stream:US122L" (No such file or directory)
ALSA lib control.c:953:(snd_ctl_open_noupdate) Invalid CTL usb_stream:US122L
control open "usb_stream:US122L" (No such file or directory)
audio_reservation_init
Acquire audio card Audio-1
creating alsa driver ... usb_stream:US122L|usb_stream:US122L|512|2|44100|0|0|nomon|swmeter|-|32bit
ALSA lib control.c:953:(snd_ctl_open_noupdate) Invalid CTL usb_stream:US122L
control open "usb_stream:US122L" (No such file or directory)
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM usb_stream:US122L
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM usb_stream:US122L
ALSA: Cannot open PCM device alsa_pcm for playback. Falling back to capture-only mode
Jack: JackDriver::Close
Jack: JackConnectionManager::DirectDisconnect last: ref1 = 0 ref2 = 0
Jack: JackGraphManager::DisconnectRefNum cur_index = 0 ref1 = 0 ref2 = 0
Jack: JackEngine::ClientCloseAux ref = 0
Jack: JackGraphManager::RemoveAllPorts ref = 0
Jack: JackPosixSemaphore::Destroy name = jack_sem.1000_default_system
Jack: ~JackDriver
Cannot initialize driver
Jack: no message buffer overruns
Jack: JackPosixThread::Stop
Jack: ThreadHandler: exit
JackServer::Open() failed with -1
Jack: Succeeded in unlocking 82241434 byte memory area
Jack: JackShmMem::delete size = 0 index = 0
Jack: ~JackDriver
Jack: Succeeded in unlocking 994 byte memory area
Jack: JackShmMem::delete size = 0 index = 1
Jack: cleaning up shared memory
Jack: cleaning up files
Jack: unregistering server `default'
Failed to open server


After checking that hw:1 is titled as tascam in qjackctl:

jackd -v -d alsa -d hw:1 -r44100 -p512
jackdmp 1.9.8
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2011 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
no message buffer overruns
no message buffer overruns
no message buffer overruns
JACK server starting in realtime mode with priority 10
Jack: Create non RT thread
Jack: ThreadHandler: start
Jack: playback device hw:1
Jack: capture device hw:1
Jack: apparent rate = 44100
Jack: frames per period = 512
Jack: JackDriver::Open capture_driver_name = hw:1
Jack: JackDriver::Open playback_driver_name = hw:1
Jack: Check protocol client = 8 server = 8
Jack: JackEngine::ClientInternalOpen: name = system
Jack: JackEngine::AllocateRefNum ref = 0
Jack: JackPosixSemaphore::Allocate name = jack_sem.1000_default_system val = 0
Jack: JackEngine::NotifyAddClient: name = system
Jack: JackGraphManager::SetBufferSize size = 512
Jack: JackConnectionManager::DirectConnect first: ref1 = 0 ref2 = 0
Jack: JackGraphManager::ConnectRefNum cur_index = 0 ref1 = 0 ref2 = 0
Jack: JackDriver::SetupDriverSync driver sem in flush mode
control device hw:1
control device hw:1
audio_reservation_init
Acquire audio card Audio1
creating alsa driver ... hw:1|hw:1|512|2|44100|0|0|nomon|swmeter|-|32bit
control device hw:1
ALSA: Cannot open PCM device alsa_pcm for playback. Falling back to capture-only mode
Jack: JackDriver::Close
Jack: JackConnectionManager::DirectDisconnect last: ref1 = 0 ref2 = 0
Jack: JackGraphManager::DisconnectRefNum cur_index = 0 ref1 = 0 ref2 = 0
Jack: JackEngine::ClientCloseAux ref = 0
Jack: JackGraphManager::RemoveAllPorts ref = 0
Jack: JackPosixSemaphore::Destroy name = jack_sem.1000_default_system
Jack: ~JackDriver
Cannot initialize driver
Jack: no message buffer overruns
Jack: JackPosixThread::Stop
Jack: ThreadHandler: exit
JackServer::Open() failed with -1
Jack: Succeeded in unlocking 82241434 byte memory area
Jack: JackShmMem::delete size = 0 index = 0
Jack: ~JackDriver
Jack: Succeeded in unlocking 994 byte memory area
Jack: JackShmMem::delete size = 0 index = 1
Jack: cleaning up shared memory
Jack: cleaning up files
Jack: unregistering server `default'
Failed to open server


Now using jack1 instead of jack2:

jackd -v -d alsa -d usb_stream:US122L -r44100 -p512
jackd 0.121.3
Copyright 2001-2009 Paul Davis, Stephane Letz, Jack O'Quinn, Torben Hohn and others.
jackd comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details

getting driver descriptor from /usr/lib/jack/jack_oss.so
getting driver descriptor from /usr/lib/jack/jack_firewire.so
getting driver descriptor from /usr/lib/jack/jack_alsa_midi.so
getting driver descriptor from /usr/lib/jack/jack_alsa.so
getting driver descriptor from /usr/lib/jack/jack_dummy.so
getting driver descriptor from /usr/lib/jack/jack_net.so
JACK compiled with System V SHM support.
server `default' registered
registered builtin port type 32 bit float mono audio
registered builtin port type 8 bit raw midi
clock source = system clock via clock_gettime
loading driver ..
start poll on 3 fd's
apparent rate = 44100
creating alsa driver ... usb_stream:US122L|usb_stream:US122L|512|2|44100|0|0|nomon|swmeter|-|32bit
new client: alsa_pcm, id = 1 type 1 @ 0x18a4f60 fd = -1
ALSA lib control.c:953:(snd_ctl_open_noupdate) Invalid CTL usb_stream:US122L
control open "usb_stream:US122L" (No such file or directory)
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM usb_stream:US122L
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM usb_stream:US122L
ALSA: Cannot open PCM device alsa_pcm for playback. Falling back to capture-only mode
cannot load driver module alsa
starting server engine shutdown
freeing shared port segments
stopping server thread
last xrun delay: 0.000 usecs
max delay reported by backend: 0.000 usecs
freeing engine shared memory
max usecs: 0.000, engine deleted
cleaning up shared memory
cleaning up files
unregistering server `default'
no message buffer overruns


and:

jackd -v -d alsa -d hw:1 -r44100 -p512
jackd 0.121.3
Copyright 2001-2009 Paul Davis, Stephane Letz, Jack O'Quinn, Torben Hohn and others.
jackd comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details

getting driver descriptor from /usr/lib/jack/jack_oss.so
getting driver descriptor from /usr/lib/jack/jack_firewire.so
getting driver descriptor from /usr/lib/jack/jack_alsa_midi.so
getting driver descriptor from /usr/lib/jack/jack_alsa.so
getting driver descriptor from /usr/lib/jack/jack_dummy.so
getting driver descriptor from /usr/lib/jack/jack_net.so
JACK compiled with System V SHM support.
server `default' registered
loading driver ..
apparent rate = 44100
creating alsa driver ... hw:1|hw:1|512|2|44100|0|0|nomon|swmeter|-|32bit
control device hw:1
ALSA: Cannot open PCM device alsa_pcm for playback. Falling back to capture-only mode
cannot load driver module alsa
registered builtin port type 32 bit float mono audio
registered builtin port type 8 bit raw midi
clock source = system clock via clock_gettime
new client: alsa_pcm, id = 1 type 1 @ 0x1ddef60 fd = -1
starting server engine shutdown
freeing shared port segments
start poll on 3 fd's
server thread back from poll
stopping server thread
last xrun delay: 0.000 usecs
max delay reported by backend: 0.000 usecs
freeing engine shared memory
max usecs: 0.000, engine deleted
cleaning up shared memory
cleaning up files
unregistering server `default'
no message buffer overruns


Using .asoundrc file:

jackd -v -d alsa -d usb_stream:US122L -r44100 -p512
jackd 0.121.3
Copyright 2001-2009 Paul Davis, Stephane Letz, Jack O'Quinn, Torben Hohn and others.
jackd comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details

getting driver descriptor from /usr/lib/jack/jack_oss.so
getting driver descriptor from /usr/lib/jack/jack_firewire.so
getting driver descriptor from /usr/lib/jack/jack_alsa_midi.so
getting driver descriptor from /usr/lib/jack/jack_alsa.so
getting driver descriptor from /usr/lib/jack/jack_dummy.so
getting driver descriptor from /usr/lib/jack/jack_net.so
JACK compiled with System V SHM support.
server `default' registered
loading driver ..
apparent rate = 44100
creating alsa driver ... usb_stream:US122L|usb_stream:US122L|512|2|44100|0|0|nomon|swmeter|-|32bit
configuring for 44100Hz, period = 512 frames (11.6 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 24bit little-endian
ALSA: use 2 periods for capture
ALSA/USX2Y: mmap: Bad address
ALSA: cannot set hardware parameters for capture
ALSA: cannot configure capture channel
Segmentation fault (core dumped)


jackd -v -d alsa -d hw:1 -r44100 -p512
jackd 0.121.3
Copyright 2001-2009 Paul Davis, Stephane Letz, Jack O'Quinn, Torben Hohn and others.
jackd comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details

getting driver descriptor from /usr/lib/jack/jack_oss.so
getting driver descriptor from /usr/lib/jack/jack_firewire.so
getting driver descriptor from /usr/lib/jack/jack_alsa_midi.so
getting driver descriptor from /usr/lib/jack/jack_alsa.so
getting driver descriptor from /usr/lib/jack/jack_dummy.so
getting driver descriptor from /usr/lib/jack/jack_net.so
JACK compiled with System V SHM support.
server `default' registered
loading driver ..
apparent rate = 44100
creating alsa driver ... hw:1|hw:1|512|2|44100|0|0|nomon|swmeter|-|32bit
control device hw:1
ALSA: Cannot open PCM device alsa_pcm for playback. Falling back to capture-only mode
cannot load driver module alsa
registered builtin port type 32 bit float mono audio
registered builtin port type 8 bit raw midi
clock source = system clock via clock_gettime
new client: alsa_pcm, id = 1 type 1 @ 0xd53f60 fd = -1
starting server engine shutdown
freeing shared port segments
stopping server thread
start poll on 3 fd's
last xrun delay: 0.000 usecs
max delay reported by backend: 0.000 usecs
freeing engine shared memory
max usecs: 0.000, engine deleted
cleaning up shared memory
cleaning up files
unregistering server `default'
no message buffer overruns


The same errors occur using different buffer sizes in with jack. Using 3.6.11-rt25 kernel the sound card works. It was working with 3.6 mainline kernels too.
Comment 1 Raymond 2013-02-03 07:47:46 UTC
ALSA/USX2Y: mmap: Bad address
Comment 2 Antanas 2013-02-15 20:48:09 UTC
snd-usb-usx2y module is for Tascam US-122, but newer Tascam US-122L used to be using snd-usb-us122l, so maybe this has something to do here?
Comment 3 gary 2013-03-18 13:09:25 UTC
any progress made on this?
Comment 4 Antanas 2013-03-18 13:23:54 UTC
I have just tried it today with 3.8.3 kernel and it still doesn't work for me.
Comment 5 drikkbart 2013-03-20 00:27:25 UTC
Used the sound card US-122L many years. Tried several kernels after 3.6 with the same result. Compiled kernel 3.9-RC2 yesterday. ALSA/USX2Y: map: Bad address. Is it possible to get something done about this? A patch or something, or do we have to continue to use old kernels?
Comment 6 drikkbart 2013-03-25 00:54:38 UTC
Compiled kernel 3.9-rc4. Still the same problem. ALSA/USX2Y: mmap: Bad address
Comment 7 drikkbart 2013-04-01 22:56:06 UTC
Compiled kernel 3.9-rc5. Still the same problem. ALSA/USX2Y: mmap: Bad address
Comment 8 Takashi Iwai 2013-04-02 08:55:51 UTC
Possibly broken by the recent VM stuff update.  Could you bisect?
Comment 9 drikkbart 2013-04-03 12:58:42 UTC
I will have to find out what bisect is first. Hope someone is able to do it. I think it happened from kernel 3.6 to 3.7
Comment 10 Antanas 2013-04-03 13:06:58 UTC
yep 3.6 was ok and 3.7+ was a disappointment, and in a sense of creativity it was a disaster. Excuse me if I'm getting too emotional saying that.
Comment 11 drikkbart 2013-04-08 23:13:59 UTC
Narrowed it down. Compiled kernel v3.6, and it worked. Compiled kernel v3.7-rc1, and it didn't work, so that's where it started. I don't know very much about bisect yet, unfortunately.
Comment 12 Trulan Martin 2013-04-30 23:11:17 UTC
OK, we bisected this to this commit:

[v3,10/10] mm: kill vma flag VM_RESERVED and mm->reserved_vm counter
https://patchwork.kernel.org/patch/1258951/

I'm building a 3.7.0 kernel with this patch reverted to further test this, but I'm sure a revert is not the correct long term solution.
Comment 13 Trulan Martin 2013-05-01 01:14:31 UTC
(In reply to comment #12)
> OK, we bisected this to this commit:
> 
> [v3,10/10] mm: kill vma flag VM_RESERVED and mm->reserved_vm counter
> https://patchwork.kernel.org/patch/1258951/
> 
> I'm building a 3.7.0 kernel with this patch reverted to further test this,
> but
> I'm sure a revert is not the correct long term solution.

As I suspected, the US-122L works with JACK on 3.7.0 with this commit reverted.

I should also add that in our testing, we found that though the older US-122 still works on 3.7, it subsequently breaks in 3.8-rc1.  I do not know if the two problems are related.
Comment 14 Antanas 2013-05-21 04:27:07 UTC
3.9.3 kernel:
ALSA/USX2Y: mmap: Bad address
Comment 15 Antanas 2013-05-29 08:41:46 UTC
Still doesn't work with 3.9.4
Comment 16 Simon S 2013-06-20 19:26:58 UTC
Got my Tascam US122l working again with this tiny 1-line patch on the snd-usb-us122l module of kernel 3.8.0-25:

[code]
--- sound/usb/usx2y/us122l.c.bak	2013-06-19 21:58:20.854702978 +0200
+++ sound/usb/usx2y/us122l.c	2013-06-19 21:59:00.814703468 +0200
@@ -262,7 +262,7 @@
 	}
 
 	area->vm_ops = &usb_stream_hwdep_vm_ops;
-	area->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
+	area->vm_flags |= VM_IO;
 	area->vm_private_data = us122l;
 	atomic_inc(&us122l->mmap_count);
 out:
[/code]

Seems like the wrong choice was made with replacing VM_RESERVED in this case. Not sure if this actually solves the whole problem though, as I don't know much about the kernel's memory management..
Comment 17 Samuel Mimram 2013-08-13 08:03:53 UTC
I can confirm that the above patch makes the US122L work in 3.9.8-1 too.
Comment 18 Takashi Iwai 2013-11-13 17:23:04 UTC
The proper fixes have been merged to the upstream.  They'll be backported to stable kernel soon.