Selftest for cpuidle latency measurement
v5 cover Selftest for cpuidle latency measurement
v4: https://lkml.org/lkml/2020/9/2/356
v4-->v5
Based on comments from Artem Bityutskiy, evaluation of timer based wakeup latencies may not be a fruitful measurement especially on the x86 platform which has the capability to pre-arm a CPU when a timer is set.
Hence, including only the IPI based tests for latency measurement to acheive expected behaviour across platforms.
kernel module + bash selftest approach which presents lower deviations and higher accuracy: https://lkml.org/lkml/2020/7/21/567
---
The patch series introduces a mechanism to measure wakeup latency for IPI based interrupts.
The motivation behind this series is to find significant deviations behind advertised latency values
To achieve this in the userspace, IPI latencies are calculated by sending information through pipes and inducing a wakeup.
To account for delays from kernel-userspace interactions baseline observations are taken on a 100% busy CPU and subsequent obervations must be considered relative to that.
One downside of the userspace approach in contrast to the kernel implementation is that the run to run variance can turn out to be high in the order of ms; which is the scope of the experiments at times.
Another downside of the userspace approach is that it takes much longer to run and hence a command-line option quick and full are added to make sure quick 1 CPU tests can be carried out when needed and otherwise it can carry out a full system comprehensive test.
Usage
---
./cpuidle --mode <full / quick / num_cpus> --output <output location>
full: runs on all CPUS
quick: run on a random CPUnum_cpus: Limit the number of CPUS to run on
Sample output snippet
---------------------
--IPI Latency Test---SRC_CPU DEST_CPU IPI_Latency(ns)
...
0 5 256178 0 6 478161 0 7 285445 0 8 273553
Expected IPI latency(ns): 100000
Observed Average IPI latency(ns): 248334
Pratik Rajesh Sampat (1):
selftests/cpuidle: Add support for cpuidle latency measurement
tools/testing/selftests/Makefile | 1 + tools/testing/selftests/cpuidle/Makefile | 7 + tools/testing/selftests/cpuidle/cpuidle.c | 479 ++++++++++++++++++++++ tools/testing/selftests/cpuidle/settings | 1 + 4 files changed, 488 insertions(+) create mode 100644 tools/testing/selftests/cpuidle/Makefile create mode 100644 tools/testing/selftests/cpuidle/cpuidle.c create mode 100644 tools/testing/selftests/cpuidle/settings
Signature · 1 line
2.26.2
RFC v5 1/1 selftests/cpuidle: Add support for cpuidle latency measurement
Measure cpuidle latencies on wakeup to determine and compare with the advertsied wakeup latencies for each idle state.
Cpuidle wakeup latencies are determined for IPIs and can help determine any deviations from what is advertsied by the hardware.
A baseline measurement for each case of IPIs is taken at 100 percent CPU usage to quantify for the kernel-userpsace overhead during execution.
--- tools/testing/selftests/Makefile | 1 + tools/testing/selftests/cpuidle/Makefile | 7 + tools/testing/selftests/cpuidle/cpuidle.c | 479 ++++++++++++++++++++++ tools/testing/selftests/cpuidle/settings | 1 + 4 files changed, 488 insertions(+) create mode 100644 tools/testing/selftests/cpuidle/Makefile create mode 100644 tools/testing/selftests/cpuidle/cpuidle.c create mode 100644 tools/testing/selftests/cpuidle/settings
tools/testing/selftests/Makefile +1 -0
@@ -8,6 +8,7 @@ TARGETS += cgroup TARGETS += clone3 TARGETS += core TARGETS += cpufreq +TARGETS += cpuidle TARGETS += cpu-hotplug TARGETS += drivers/dma-buf TARGETS += efivarfs
tools/testing/selftests/cpuidle/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 +TEST_GEN_PROGS := cpuidle + +CFLAGS += -O2 +LDLIBS += -lpthread + +include ../lib.mk
tools/testing/selftests/cpuidle/cpuidle.c new file +479 -0
479 lines not on this page · raw message
tools/testing/selftests/cpuidle/settings new file +1 -0
@@ -0,0 +1 @@ +timeout=0
Signature · 1 line
2.26.2