[alsa-devel] Can't detect "XRUNs"

Takashi Iwai tiwai at suse.de
Wed Jul 4 12:33:49 CEST 2018


On Wed, 04 Jul 2018 12:26:01 +0200,
Raphaël Dingé wrote:
> 
> Hi,
> 
> I don't get audio drop notification "XRUNs" in /proc/kmsg.
> 
> Not sure if this is the right mailing list as maybe my question is
> more kernel related, but I'll try a shot here.
> 
> I'm currently making a proof of concept to see if I can run a quite
> CPU hungry audio application running without audio drops over time
> given a set of tests. In particular I want to automate playback buffer
> underruns detection so that I don't have to sit and listen closely
> when they happen.
> 
> With some very extreme tests, I can hear that there are audio drops
> all over the place.
> 
> I have 2 audio cards in the system, one is audio over HDMI, and the
> other one is an USB audio card that supports audio class definition.
> In both case the sound is working as I would expect. The system itself
> is an Intel NUC i7.
> 
> I configured the kernel with CONFIG_SND_DEBUG=y,
> CONFIG_SND_PCM_XRUN_DEBUG=y and CONFIG_SND_VERBOSE_PROCFS=y as well as
> echo 5 > /proc/asound/cardX/pcmYp/xrun_debug with X and Y the card and
> pcm stream of interest, and so hw:X,Y when opening the device with
> snd_pcm_open.
> 
> Then I watch the output of the ksyslog interface using cat /proc/kmsg
> 
> When an audio drop occurs, there is nothing about XRUNs or whatever it
> is called. I don't even know what kind of log message it should look
> like, and can't find it on google as well.
> 
> With audio over HDMI, I have some occurence of ALSA: PCM: [Q] Lost
> interrupts? that seems more of less related to audio drops, but not
> always.
> With the USB audio card, I have nothing.
> 
> I tried to write to the xrun_injection proc file in the stream, but
> nothing happens as well.
> 
> Finally I log any occurence of snd_pcm_writei returning a negative
> number, but that never happens as well.
> 
> Am I missing something completely?

The recent kernel puts the xrun debug messages in trace buffer instead
of the kernel messages.  Try to enable the tracing in
/sys/kernel/debug/tracing/events/snd_pcm/xrun/enable, and watch the
trace buffer (/sys/kernel/debug/tracing/trace).


Takashi


More information about the Alsa-devel mailing list