unblock restrictions on alsa (max id of card and sample rate for alsa Loopback)

Bug #1895833 reported by SCHMITT Olivier
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ALSA Libraries
New
Undecided
Unassigned
Alsa utilities
New
Undecided
Unassigned
alsa-lib (Ubuntu)
Undecided
Unassigned
alsa-utils (Ubuntu)
Undecided
Unassigned

Bug Description

SRU Justification:

[Impact] kernel, alsa-lib, alsa-utils
We are using more and more cards recognized as sound peripherals. When the number of loopback and hardware cards exceeds 32, we can no longer use them.
Also some new devices are already using 384khz but the limitation is for alsa Loopback.

I thinks we must increse CONFIG_SND_MAX_CARDS to 256 and change 192000 sample rate value fixed in aloop.c to 384000 or 768000 to provide an additional margin in alsa Loopback.

[Test Case]

sudo add-apt-repository -y universe
apt-get update && sudo apt-get upgrade -y
sudo apt-get install alsa alsa-*

shutdown -r now

sudo modprobe snd-aloop
sudo echo snd-aloop >> /etc/modules
sudo adduser $(whoami) audio

shutdown -r now

sudo apt-get install -y apt-get install alsa alsa-utils libasound2-dev
sudo apt-get install -y screen build-essential initramfs-tools fakeroot debconf-utils dpkg-dev debhelper bin86 flex bison pkgconf dkms python3-docutils \
libudev-dev mt-st cpufrequtils libpci-dev libssl-dev libiberty-dev libcap-dev asciidoc default-jdk libncurses-dev \
kernel-package kernel-wedge libnvpair1linux libuutil1linux libzfs2linux libzpool2linux zfs-dkms zfs-zed zfsutils-linux \
crash makedumpfile libncurses5 libncurses5-dev libelf-dev binutils-dev kexec-tools

screen

mkdir ~/megamod
cd ~/megamod
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-focal.git
cd ubuntu-focal
sed -i 's/SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_192000,/SNDRV_PCM_RATE_CONTINUOUS,/g' ./sound/drivers/aloop.c
sed -i 's/192000/768000/g' ./sound/drivers/aloop.c
grep -rnl './' -e "CONFIG_SND_MAX_CARDS=32" | xargs -i@ sed -i 's/CONFIG_SND_MAX_CARDS=32/CONFIG_SND_MAX_CARDS=256/g' @

search and replace 32 by 256 in and ./debian.master/config/annotations for CONFIG_SND_MAX_CARDS

fakeroot debian/rules clean
fakeroot debian/rules binary

dpkg -i ../linux*5.4.0-*.deb

shutdown -r now

sudo systemctl disable hv-kvp-daemon.service

####################

echo "options snd-aloop \" >> /etc/modprobe.d/alsa-base.conf
echo "index=10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45 \" >> /etc/modprobe.d/alsa-base.conf
echo "id=lp0,lp1,lp2,lp3,lp4,lp5,lp6,lp7,lp8,lp9,lp10,lp11,lp12,lp13,lp14,lp15,lp16,lp17,lp18,lp19,lp20,lp21,lp22,lp23,lp24,lp25,lp26,lp27,lp28,lp29,lp30,lp31,lp32,lp33,lp34,lp35 \" >> /etc/modprobe.d/alsa-base.conf
echo "enable=1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 \" >> /etc/modprobe.d/alsa-base.conf
echo "pcm_substreams=2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2" >> /etc/modprobe.d/alsa-base.conf

sudo su
sudo mkdir /usr/src/alsa
cd /usr/src/alsa
git clone git://git.alsa-project.org/alsa-lib.git alsa-lib
cd /usr/src/alsa/alsa-lib
./gitcompile --with-max-cards=256
make install

cp /usr/lib/libasound* /usr/lib/x86_64-linux-gnu/

cd /usr/src/alsa
git clone git://git.alsa-project.org/alsa-utils.git alsa-utils
cd /usr/src/alsa/alsa-utils
./gitcompile --with-max-cards=256
make install

shutdown -r now

[Regression Potential]

* The regression can be considered as low, because this is because it's functional since 16.04

[Other]

* This requires a patch to be included into the kernel, alsa-lib and alsa-utils package. - please see [Test Case] description for more details.

* changes can be made independently and have no impact on others

[Patch]

In /sound/drivers/aloop.c:
L555 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_192000,
to
L555 .rates = SNDRV_PCM_RATE_CONTINUOUS,

In /sound/drivers/aloop.c:
L557 .rate_max = 192000,
to
L557 .rate_max = 768000,

In /sound/drivers/aloop.c:
L557 uinfo->value.integer.max = 192000;
to
L557 uinfo->value.integer.max = 768000;

In /debian.master/config/config.common.ubuntu
L9069 CONFIG_SND_MAX_CARDS=32
to
L9069 CONFIG_SND_MAX_CARDS=256

and update debian.master/rules.d/hooks.mk

For alsa-lib and alsa-util, package can be simply update with ./gitcompile --with-max-cards=256

Thanks everybody

Revision history for this message
Erich Eickmeyer  (eeickmeyer) wrote :

Bugs in Ubuntu are never filed against the distribution as a whole, but rather, individual components/packages. Removed affecting Ubuntu.

no longer affects: ubuntu
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers