From c68d53c9bc0c6a8d5dbdf62d4947cea87279b196 Mon Sep 17 00:00:00 2001 From: Andrea Bondavalli Date: Thu, 17 Nov 2022 21:51:05 +0100 Subject: [PATCH] Added documentation about effects of CPU scaling events on daemon streams and patched daemon test scripts to disable CPU scaling --- README.md | 19 ++++++++++++++++++- daemon/scripts/disable_cpu_scaling.sh | 4 ++++ run_latency_test.sh | 1 + run_test.sh | 1 + 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100755 daemon/scripts/disable_cpu_scaling.sh diff --git a/README.md b/README.md index 1a303f9..b83cdf4 100644 --- a/README.md +++ b/README.md @@ -121,10 +121,11 @@ The following ARM platform have been used for testing: The BeagleBone® Black board with ARM Cortex-A8 32-Bit processor. See [Ubuntu 18.04 on BeagleBone® Black](https://elinux.org/BeagleBoardUbuntu) for additional information about how to setup Ubuntu on this board. -The NanoPi NEO2 with Allwinner H5, Quad-core 64-bit high-performance Cortex A53 processor. +The NanoPi NEO2 with Allwinner H5 Quad-core 64-bit Cortex A53 processor. See [Armbian NanoPi NEO2 ](https://www.armbian.com/nanopi-neo-2/) for additional information about how to setup Ubuntu on this board. 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 scale events could affect daemon streams adding unexpected distortions, see [CPU scale events and scripts notes](#notes). **_Important_** _PulseAudio_ must be disabled or uninstalled for the daemon to work properly, see [PulseAudio and scripts notes](#notes). ## How to build ## @@ -267,6 +268,22 @@ 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. +* CPU scale events could have an impact on daemon streams causing unexpected distortion for a few seconds, see #96. +Before running the daemon make sure you disable CPU scaling events: + + Check if CPU scaling is enabled with: + + cat /proc/sys/kernel/perf_cpu_time_max_percent + + If result is not 0, (it's usually set to 25) set it to 0 with: + + sudo sysctl -w kernel.perf_cpu_time_max_percent=0 + + You may also want to review the current CPU scaling governor with (cpu0 in this case): + + cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + + See https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt for dditional info. * **PulseAudio** can create instability problems. Before running the daemon verify that PulseAudio is not running with: diff --git a/daemon/scripts/disable_cpu_scaling.sh b/daemon/scripts/disable_cpu_scaling.sh new file mode 100755 index 0000000..eca3604 --- /dev/null +++ b/daemon/scripts/disable_cpu_scaling.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +sudo sysctl -w kernel.perf_cpu_time_max_percent=0 + diff --git a/run_latency_test.sh b/run_latency_test.sh index 2b5bfd1..0249a66 100755 --- a/run_latency_test.sh +++ b/run_latency_test.sh @@ -107,6 +107,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 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 00f124c..3d1715b 100755 --- a/run_test.sh +++ b/run_test.sh @@ -94,6 +94,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 if [ -x /usr/bin/pulseaudio ]; then #stop pulseaudio, this seems to open/close ALSA continuosly