Trying to setup a streaming station, I found, getting crackled audio with puredata:
"priority 8 scheduling failed" for dsp process and "priority 6 scheduling failed." for GUI...
Test:
$ ulimit -r
0
$ /usr/bin/chrt -f 8 true
chrt: failed to set pid 0's policy: Operation not permitted
Fix the security limits `ulimit -r`-> 0:
- add a group audio, I set the limits in security:
sudo -s
cat > /etc/security/limits.d/99-audio.conf << EOF
@audio - rtprio 20
@audio - memlock unlimited
#@audio - nice -19
EOF
so
ulimit -r is now 20, which is correct.
But still
chrt -f 8 true fails, so I looked in kernel config:
grep -E 'CONFIG_(CGROUPS|CGROUP_SCHED|RT_GROUP_SCHED|PREEMPT_RT)=|# CONFIG_(CGROUPS|CGROUP_SCHED|RT_GROUP_SCHED|PREEMPT_RT) is not set' "/boot/config-$(uname -r)"
CONFIG_CGROUPS=y
CONFIG_CGROUP_SCHED=y
CONFIG_RT_GROUP_SCHED=y
With AI help, I found:
QuoteCONFIG_RT_GROUP_SCHED=y. With that option, a task in any cgroup other than the root cgroup can only use realtime scheduling if that cgroup has cpu.rt_runtime_us > 0. systemd puts your login session in user.slice/user-1000.slice/session-N.scope, and those cgroups default to 0. The kernel then returns EPERM even though rtprio is 20 in limits.conf
Solution: build and installed new kernel from last branch with new config like described in Olimage-guide.pdf:
scripts/config --disable RT_GROUP_SCHED
make olddefconfig
grep RT_GROUP_SCHED .config # should show "is not set"
So the issue is now fixed and working without crackling.
The questions:
Was there a reason for "CONFIG_RT_GROUP_SCHED=y", maybe the stability of the system might be affected or something other does not work ?
Is it this fix save ?
Any hint or discussion about this is welcomed.
Mfg winfried