From b43b26c3df905b931be6ce6d60276b18a33ea34d Mon Sep 17 00:00:00 2001 From: Andrea Bondavalli Date: Fri, 25 Nov 2022 09:17:28 +0100 Subject: [PATCH 1/2] Added setting of Real Time Scheduler Throttling kernel parameter according to findings related to #79 --- README.md | 16 +++++++++++++--- run_latency_test.sh | 1 + run_test.sh | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 32218fb..1f2bf83 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ This directory contains the files used to run the daemon platform compatibility ## Prerequisite ## -The daemon and the test have been tested with **Ubuntu 18.04** distro on **ARMv7** and with **Ubuntu 18.04, 19.10 and 20.04** distros on **x86** using: +The daemon and the test have been verified starting from **Ubuntu 18.04** distro onwards for **ARMv7** and **x86** platforms using: * Linux kernel version >= 4.10.x * GCC version >= 7.x / clang >= 6.x (C++17 support required) @@ -138,7 +138,7 @@ See [Armbian NanoPi NEO2 ](https://www.armbian.com/nanopi-neo-2/) for additional The [ubuntu-packages.sh](ubuntu-packages.sh) script can be used to install all the packages required to compile and run the AES67 daemon, and the [platform compatibility test](#test). **_Important_** CPU scaling events could affect daemon streams causing unexpected distortions, see [CPU scaling events and scripts notes](#notes). - +**_Important_** Starting from Linux kernel 5.10.x onwards a change in a kernel parameter is required to fix a problem with round robin scheduler causing the latency test to fail, see [Real Time Scheduler Throttling](#notes). **_Important_** _PulseAudio_ must be disabled or uninstalled for the daemon to work properly, see [PulseAudio and scripts notes](#notes). ## How to build ## @@ -261,6 +261,8 @@ In case underrun happened the status reported is: and the specified buffer size cannot be used. +**_Important_** Starting from Linux kernel 5.10.x onwards a change in a kernel parameter is required to fix a problem with round robin scheduler causing the latency test to fail, see [Real Time Scheduler Throttling](#notes). + ## Run the daemon regression tests ## To run daemon regression tests install the ALSA RAVENNA/AES67 kernel module with: @@ -280,7 +282,15 @@ make sure that no instances of the aes67-daemon are running, enter the [tests](d * All the scripts in this repository are provided as a reference to help setting up the system and run the platform compatibility test. - They have been tested on **Ubuntu 18.04 19.10 20.04** distros. + They have been tested starting from **Ubuntu 18.04** distros onwards. +* Starting from Linux kernel 5.10.x onwards a change in a kernel parameter is required to fix a problem with round robin scheduler causing the latency test to fail, see [issue 79](https://github.com/bondagit/aes67-linux-daemon/issues/96) and alsa-lib [issue-285](https://github.com/alsa-project/alsa-lib/issues/285). + + Set the total bandwidth available to all real-time tasks to 100% of the CPU with: + + sysctl -w kernel.sched_rt_runtime_us=1000000 + + By default this value is set to 95%. + * CPU scaling events could have an impact on daemon streams causing unexpected distortion for a few seconds, see [issue 96](https://github.com/bondagit/aes67-linux-daemon/issues/96). Before running the daemon make sure you disable CPU scaling events: diff --git a/run_latency_test.sh b/run_latency_test.sh index 0249a66..66bb14c 100755 --- a/run_latency_test.sh +++ b/run_latency_test.sh @@ -108,6 +108,7 @@ trap cleanup EXIT #configure system parms sudo sysctl -w net/ipv4/igmp_max_memberships=66 sudo sysctl -w kernel/perf_cpu_time_max_percent=0 +sudo sysctl -w kernel/sched_rt_runtime_us=1000000 if [ -x /usr/bin/pulseaudio ]; then #stop pulseaudio, this seems to open/close ALSA continuosly diff --git a/run_test.sh b/run_test.sh index 3d1715b..eac12a4 100755 --- a/run_test.sh +++ b/run_test.sh @@ -95,6 +95,7 @@ trap cleanup EXIT #configure system parms sudo sysctl -w net/ipv4/igmp_max_memberships=66 sudo sysctl -w kernel/perf_cpu_time_max_percent=0 +sudo sysctl -w kernel/sched_rt_runtime_us=1000000 if [ -x /usr/bin/pulseaudio ]; then #stop pulseaudio, this seems to open/close ALSA continuosly From 1d562e38432742f746c39c0f469228a2e2bc7fc6 Mon Sep 17 00:00:00 2001 From: Andrea Bondavalli <56439183+bondagit@users.noreply.github.com> Date: Fri, 25 Nov 2022 09:21:38 +0100 Subject: [PATCH 2/2] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1f2bf83..ae12be7 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,9 @@ See [Armbian NanoPi NEO2 ](https://www.armbian.com/nanopi-neo-2/) for additional The [ubuntu-packages.sh](ubuntu-packages.sh) script can be used to install all the packages required to compile and run the AES67 daemon, and the [platform compatibility test](#test). **_Important_** CPU scaling events could affect daemon streams causing unexpected distortions, see [CPU scaling events and scripts notes](#notes). + **_Important_** Starting from Linux kernel 5.10.x onwards a change in a kernel parameter is required to fix a problem with round robin scheduler causing the latency test to fail, see [Real Time Scheduler Throttling](#notes). + **_Important_** _PulseAudio_ must be disabled or uninstalled for the daemon to work properly, see [PulseAudio and scripts notes](#notes). ## How to build ##