Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#70064 - [linux] Audio frontend allocation fails on some platforms.

Attached to Project: Arch Linux
Opened by Eli M- (sykhro) - Thursday, 18 March 2021, 13:31 GMT
Last edited by Jan Alexander Steffens (heftig) - Friday, 11 March 2022, 16:35 GMT
Task Type Feature Request
Category Kernel
Status Closed
Assigned To Jan Alexander Steffens (heftig)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

This popped up after fixing  FS#69992  but might manifest on other setups as well.

The kernel defines max_alloc_per_card = 32MB (pcm_memory.c:30);
now, take into account SND_HDA_PREALLOC_SIZE=4096 as per Arch Linux default and a typical Kabylake laptop with, for the sake of argument, 10 audio frontends (DMIC, HDMI, Analog out, Analog in):
FEs * SND_HDA_PREALLOC_SIZE * 1024 = 10 * 4096 * 1024 = 42MB > max_alloc_per_card
which results in the system exhausting the preallocated memory and (silently!) failing to allocate frontends (in my case, HDMI3 and DMIC).

Now, this can be worked around by skipping preallocation and setting SND_HDA_PREALLOC_SIZE = 0.
However, this causes some applications to allocate all memory available and end up with -ENOMEM.
Users can fix this by overriding max_alloc_per_card via modprobe, setting it to an appropriate value (in my case, 41943040). But this assumes SND_HDA_PREALLOC_SIZE = 4096.

Discussion is ongoing[1], the ALSA mantainer proposed the following temporary fix:
- set SND_HDA_PREALLOC_SIZE to 0
- set AZX_MAX_BUF_SIZE to something sensible, like 4MB (right now it's ~1GB)

1: https://bugzilla.kernel.org/show_bug.cgi?id=201251

This task depends upon

Closed by  Jan Alexander Steffens (heftig)
Friday, 11 March 2022, 16:35 GMT
Reason for closing:  Fixed
Comment by Michel Koss (MichelKoss1) - Friday, 26 March 2021, 18:08 GMT
It looks like this is changed back and forth while both settings cause issues: https://bugs.archlinux.org/task/68092
Comment by Jan Alexander Steffens (heftig) - Friday, 26 March 2021, 18:13 GMT
It looks like the bugs with size=0 should be fixed in userspace, though. E.g. the speaker-test problem can be worked around by giving the program a fixed buffer size, e.g. `speaker-test -c2 -Dhw:0 -b 100000`.
Comment by Eli M- (sykhro) - Friday, 26 March 2021, 18:18 GMT
The userspace bugs that stem from the prealloc buffer being zero should be fixed with the following patch https://www.spinics.net/lists/alsa-devel/msg123921.html
Comment by mattia (nTia89) - Friday, 11 March 2022, 15:57 GMT
Upstream bug has been fixed.

Can we close ours?

Loading...