You are not logged in.

#1 2014-04-20 13:03:57

InspiredOne
Member
Registered: 2014-04-20
Posts: 7

[Solved] ALSA Locking-up/Unresponsive after frequent adjustments

Every now and then ALSA seems to stop responding resulting in all sounds on the system to glitch out (looping and then eventually stopping all together). Eventually, the sound system stops glitching and comes back to normal functionality without me having to do anything. I can reliably recreate the issue by attempting to change the volume or other settings too quickly, (spamming volume up or down, or repetitively muting and unmuting a channel from within alsamixer or with hotkeys).

I do not have any sound servers installed.

My top during one of these outages doesn't indicate any heavy resource consumption. In addition to the information I've put here, I generated a debugging file using the alsa-info.sh script I found from the alsa-project page. You can look at it here. Dmesg has some interesting output that I know is related but not sure how to interpret or what to do with it.

dmesg

[10922.323960] INFO: task amixer:6936 blocked for more than 120 seconds.
[10922.323966]       Tainted: G         C   3.14.1-1-ARCH #1
[10922.323970] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[10922.323975] amixer          D ffff8800be178e68     0  6936      1 0x00000000
[10922.323983]  ffff8801706f7db0 0000000000000086 ffff88016d2089d0 ffff8801706f7fd8
[10922.323993]  00000000000142c0 00000000000142c0 ffff88016d2089d0 00007fff75bdac20
[10922.324002]  0000000000000000 00000000c1105511 00007fff75bdac20 ffff8801706f7e40
[10922.324011] Call Trace:
[10922.324029]  [<ffffffffa04af3a1>] ? snd_ctl_elem_info_user+0xa1/0x100 [snd]
[10922.324039]  [<ffffffff814d7eb9>] schedule+0x29/0x70
[10922.324048]  [<ffffffff814d82c6>] schedule_preempt_disabled+0x16/0x20
[10922.324057]  [<ffffffff814d9904>] __mutex_lock_slowpath+0x124/0x1f0
[10922.324067]  [<ffffffff814d99e7>] mutex_lock+0x17/0x27
[10922.324083]  [<ffffffffa04b075b>] snd_ctl_ioctl+0x48b/0x7a0 [snd]
[10922.324093]  [<ffffffff811b62a0>] do_vfs_ioctl+0x2e0/0x4c0
[10922.324102]  [<ffffffff811c083e>] ? __fd_install+0x4e/0x60
[10922.324112]  [<ffffffff811b6501>] SyS_ioctl+0x81/0xa0
[10922.324122]  [<ffffffff814e30a9>] system_call_fastpath+0x16/0x1b

I've compiled some information that I thought might be relevant. Top during an outage.

top

top - 07:27:14 up  2:57,  3 users,  load average: 10.13, 4.45, 4.46
Tasks: 167 total,   1 running, 166 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.5 us,  1.3 sy,  0.8 ni, 95.6 id,  0.7 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   5479836 total,  2305020 used,  3174816 free,    94800 buffers
KiB Swap:  8388604 total,        0 used,  8388604 free.   544172 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                   
  485 jedidiah  20   0  882940 166948  53100 S   2.7  3.0  26:21.72 chromium                  
 6630 jedidiah  20   0   16652   1284   1048 D   2.7  0.0   0:00.08 amixer                    
  466 root      20   0  298328  50048  22512 S   1.7  0.9   9:27.85 X                         
  921 jedidiah  20   0 1262768  69052  15060 S   1.7  1.3   8:20.35 chromium                  
 2481 jedidiah  25   5 1360060 306252  27480 S   1.7  5.6   4:00.42 chromium                  
  649 jedidiah  20   0 1228244  89824  21404 S   1.0  1.6   1:00.80 chromium                  
 1658 jedidiah  20   0  422800  31140  22220 S   1.0  0.6   0:40.90 konsole                   
 4653 jedidiah  25   5 1186192 142800  29400 S   1.0  2.6   2:55.11 chromium                  
  579 jedidiah  20   0 1184748 113612  26944 S   0.7  2.1   1:08.61 chromium                  
  187 root      20   0       0      0      0 S   0.3  0.0   0:11.49 rts5139-polling           
  554 jedidiah  20   0 1054836  42292  20052 S   0.3  0.8   0:04.59 chromium                  
  945 jedidiah  20   0  986300  27552  18768 S   0.3  0.5   0:15.23 chromium                  
 4090 root      20   0       0      0      0 S   0.3  0.0   0:05.37 kworker/3:0               
 4345 root      20   0       0      0      0 S   0.3  0.0   0:04.50 kworker/2:0               
 4584 jedidiah  25   5 1086472  68412  24188 S   0.3  1.2   0:03.13 chromium                  
 5900 root      20   0       0      0      0 S   0.3  0.0   0:00.19 kworker/0:0               
 6476 root      20   0       0      0      0 S   0.3  0.0   0:00.38 kworker/1:2               
 6617 jedidiah  20   0   15352   1588   1112 R   0.3  0.0   0:00.20 top                       

ALSA related packages installed:

alsa-lib 1.0.27.2-1
alsa-oss 1.0.25-2
alsa-plugins 1.0.27-2
alsa-utils 1.0.27.2-1

Some other possibly relevant info:

nano ~/.asoundrc 

defaults.pcm.!card 1
defaults.ctl.!card 1
aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic_1 [HD-Audio Generic], device 0: CX20757 Analog [CX20757 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
nano /proc/asound/card1/pcm0p/sub0/hw_params

access: MMAP_INTERLEAVED
format: S32_LE
subformat: STD
channels: 2
rate: 48000 (48000/1)
period_size: 1024
buffer_size: 16384

I'm still new to this so I'm not sure of where else I can look for clues. I've tried installing pulseaudio, but the issue persisted. Thank you in advance for any help you may give me.

Last edited by InspiredOne (2014-04-28 23:53:18)

Offline

#2 2014-04-23 23:09:06

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: [Solved] ALSA Locking-up/Unresponsive after frequent adjustments

Try reducing buffer size to 4x or 8x of period size (4096, 8192). Maybe loading snd-hda-intel with align_buffer_size options would help. (I assume CX20757 uses snd-hda-intel from your information)

Offline

#3 2014-04-24 16:42:49

InspiredOne
Member
Registered: 2014-04-20
Posts: 7

Re: [Solved] ALSA Locking-up/Unresponsive after frequent adjustments

emeres wrote:

Try reducing buffer size to 4x or 8x of period size (4096, 8192). Maybe loading snd-hda-intel with align_buffer_size options would help. (I assume CX20757 uses snd-hda-intel from your information)

Ok, tackling the first suggestion. I just want to be sure that I actually did it correctly before I mark it as not working. I'm still figuring out things in regards to ALSA configuration. I've modified my ~/.asoundrc to:

pcm.!default {
        type plug
        slave.pcm "dmixer"
}
pcm.dmixer  {
        type dmix
        ipc_key 1024
        slave {
                pcm "hw:1,0"
                period_time 0
                period_size 1024
                buffer_size 4096
                rate 44100
        }
        bindings {
                0 0
                1 1
        }
}
ctl.dmixer {  
        type hw
        card 1 
}
ctl.!default {
        type hw
       card 1
}

Does this accomplish reducing the buffer size to 4092 bytes? If it does, then I can confirm that it did not work for the 4096 or the 8192 byte buffer size. I still get lagging when I try to change the volume too quickly. As for the second configuration suggestion, I still need some time to figure out how to do that, as my time has been relatively tight these past few days. Forgive me for my newbishness tongue

Offline

#4 2014-04-24 17:26:00

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: [Solved] ALSA Locking-up/Unresponsive after frequent adjustments

Using both is unnecessary.

period_time 0
period_size 1024

Then delete that ~/.asoundrc and set up default card using modprobe options with vid and pid and the option I mentioned.

A workaround might be to reduce communication speed to the card. Try different options that snd-hda-intel also provides.

Last edited by emeres (2014-04-24 17:26:55)

Offline

#5 2014-04-28 23:50:21

InspiredOne
Member
Registered: 2014-04-20
Posts: 7

Re: [Solved] ALSA Locking-up/Unresponsive after frequent adjustments

emeres wrote:

Using both is unnecessary.

period_time 0
period_size 1024

Then delete that ~/.asoundrc and set up default card using modprobe options with vid and pid and the option I mentioned.

A workaround might be to reduce communication speed to the card. Try different options that snd-hda-intel also provides.

Ok, I think I've gotten it fixed. I followed your advice and tried nearly all the relevant options, and then all the not so relevant options. I read on to discover that there were some special cases in another document found here. I linked the line number with the relevant section to me.  Basically, MSI doesn't play nice with my hardware. This machine does have an AMD chipset, and the described problem was similar to what I was experiencing, so I figured I would set enable_msi=0. So far it has been working, no lock-ups or stuttering. What I don't understand is that enable_msi is supposed to be 0 by default. This solution would suggest that it was being set to 1 somehow. Why is that?

My final /etc/modprobe.d/alsa_base.conf is as follows:

blacklist pcspkr
options snd-hda-intel index=0 model=auto vid=1002 pid=9840 enable_msi=0
options snd-hda-intel index=1 model=auto vid=1022 pid=780d enable_msi=0

Anyway, I'll mark this as [solved] for now so that somebody in the future (hello future guy/girl!!!) may find this and go through considerably less agony than me. tongue Thank you for your help.

Offline

#6 2014-04-29 00:16:53

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: [Solved] ALSA Locking-up/Unresponsive after frequent adjustments

InspiredOne wrote:

Thank you for your help.

You are welcome.

HD-Audio.txt wrote:

If it works, you can add the known bad device to the blacklist defined in hda_intel.c.  In such a case, please report and give the patch back to the upstream developer.

If this is definitely the solution, it would be nice to report this to alsa developers, preferably through alsa-user mailing list.

Offline

#7 2014-04-29 00:56:42

InspiredOne
Member
Registered: 2014-04-20
Posts: 7

Re: [Solved] ALSA Locking-up/Unresponsive after frequent adjustments

emeres wrote:
HD-Audio.txt wrote:

If it works, you can add the known bad device to the blacklist defined in hda_intel.c.  In such a case, please report and give the patch back to the upstream developer.

If this is definitely the solution, it would be nice to report this to alsa developers, preferably through alsa-user mailing list.

I did see that line, and I am planning on doing so. I just did a few double checks to be sure it was that. Sure enough, removing just that option brings back the issue on reboot, so I'm pretty confident this is solved. Again, thanks for all your help.

Offline

Board footer

Powered by FluxBB