For context it started with user reporting failures when running arecord without any error or warning in dmesg (after fixing some configuration problems thet they had). https://bugzilla.kernel.org/show_bug.cgi?id=201251#c279
After spending time investigating the issue it was narrowed to quite big setting of CONFIG_SND_HDA_PREALLOC_SIZE (4096). When looking at code https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/soun... there is a limit of memory per card: max_alloc_per_card = 32UL * 1024UL * 1024UL
When SND_HDA_PREALLOC_SIZE is set to 4096 it only has memory to alloc for 8 frontends, while Skylake HDA card has 10 of them (6 playback and 4 capture), so preallocated memory is exhausted while probing. In consequence 2 of FEs end without allocated memory.
It can be workarounded on user side with setting SND_HDA_PREALLOC_SIZE to lower value, other is changing memory limit per card.
However in order to not waste user memory, change maximum allocation size on HDA controller to 4MB and force automatical memory allocation insted of preallocated one.
First patch adds prints, so similar issues can be easily identified in the future. Second changes maximum size of hda buffer to reasonable value of 4MB. And last one reverts patch which allowed setting prealloc size on X86 platforms.
Amadeusz Sławiński (3): ALSA: pcm: Add debug print on memory allocation failure ALSA: hda: Change AZX_MAX_BUF_SIZE from 1GB to 4MB ALSA: hda: Revert "ALSA: hda: Allow setting preallocation again for x86"
include/sound/hda_register.h | 4 ++-- sound/core/pcm_memory.c | 8 ++++++++ sound/hda/Kconfig | 7 +++---- 3 files changed, 13 insertions(+), 6 deletions(-)