From: Aboorva Devarajan <aboorvad@linux.vnet.ibm.com>
To: mpe@ellerman.id.au, npiggin@gmail.com, rmclure@linux.ibm.com,
arnd@arndb.de, joel@jms.id.au, shuah@kernel.org,
linux-kselftest@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org, pratik.r.sampat@gmail.com,
aboorvad@linux.vnet.ibm.com
Cc: sshegde@linux.vnet.ibm.com, srikar@linux.vnet.ibm.com,
rafael@kernel.org, daniel.lezcano@linaro.org,
linux-pm@vger.kernel.org
Subject: Re: [RFC v3 0/2] CPU-Idle latency selftest framework
Date: Mon, 25 Sep 2023 10:36:19 +0530 [thread overview]
Message-ID: <2725211932028cf24ab34da9eb9d19190848cceb.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <20230911053620.87973-1-aboorvad@linux.vnet.ibm.com>
On Mon, 2023-09-11 at 11:06 +0530, Aboorva Devarajan wrote:
CC'ing CPUidle lists and maintainers,
Patch Summary:
The patchset introduces a kernel module and userspace driver designed
for estimating the wakeup latency experienced when waking up from
various CPU idle states. It primarily measures latencies related to two
types of events: Inter-Processor Interrupts (IPIs) and Timers.
Background:
Initially, these patches were introduced as a generic self-test.
However, it was later discovered that Intel platforms incorporate
timer-based wakeup optimizations. These optimizations allow CPUs to
perform a pre-wakeup, which limits the effectiveness of latency
observation in certain scenarios because it only measures the optimized
wakeup latency [1].
Therefore, in this RFC, the self-test is specifically integrated into
PowerPC, as it has been tested and used in PowerPC so far.
Another proposal is to introduce these patches as a generic cpuilde IPI
and timer wake-up test. While this method may not give us an exact
measurement of latency variations at the hardware level, it can still
help us assess this metric from a software observability standpoint.
Looking forward to hearing what you think and any suggestions you may
have regarding this. Thanks.
[1]
https://lore.kernel.org/linux-pm/20200914174625.GB25628@in.ibm.com/T/#m5c004b9b1a918f669e91b3d0f33e2e3500923234
> Changelog: v2 -> v3
>
> * Minimal code refactoring
> * Rebased on v6.6-rc1
>
> RFC v1:
> https://lore.kernel.org/all/20210611124154.56427-1-psampat@linux.ibm.com/
>
> RFC v2:
> https://lore.kernel.org/all/20230828061530.126588-2-aboorvad@linux.vnet.ibm.com/
>
> Other related RFC:
> https://lore.kernel.org/all/20210430082804.38018-1-psampat@linux.ibm.com/
>
> Userspace selftest:
> https://lkml.org/lkml/2020/9/2/356
>
> ----
>
> A kernel module + userspace driver to estimate the wakeup latency
> caused by going into stop states. The motivation behind this program
> is
> to find significant deviations behind advertised latency and
> residency
> values.
>
> The patchset measures latencies for two kinds of events. IPIs and
> Timers
> As this is a software-only mechanism, there will be additional
> latencies
> of the kernel-firmware-hardware interactions. To account for that,
> the
> program also measures a baseline latency on a 100 percent loaded CPU
> and the latencies achieved must be in view relative to that.
>
> To achieve this, we introduce a kernel module and expose its control
> knobs through the debugfs interface that the selftests can engage
> with.
>
> The kernel module provides the following interfaces within
> /sys/kernel/debug/powerpc/latency_test/ for,
>
> IPI test:
> ipi_cpu_dest = Destination CPU for the IPI
> ipi_cpu_src = Origin of the IPI
> ipi_latency_ns = Measured latency time in ns
> Timeout test:
> timeout_cpu_src = CPU on which the timer to be queued
> timeout_expected_ns = Timer duration
> timeout_diff_ns = Difference of actual duration vs expected timer
>
> Sample output is as follows:
>
> # --IPI Latency Test---
> # Baseline Avg IPI latency(ns): 2720
> # Observed Avg IPI latency(ns) - State snooze: 2565
> # Observed Avg IPI latency(ns) - State stop0_lite: 3856
> # Observed Avg IPI latency(ns) - State stop0: 3670
> # Observed Avg IPI latency(ns) - State stop1: 3872
> # Observed Avg IPI latency(ns) - State stop2: 17421
> # Observed Avg IPI latency(ns) - State stop4: 1003922
> # Observed Avg IPI latency(ns) - State stop5: 1058870
> #
> # --Timeout Latency Test--
> # Baseline Avg timeout diff(ns): 1435
> # Observed Avg timeout diff(ns) - State snooze: 1709
> # Observed Avg timeout diff(ns) - State stop0_lite: 2028
> # Observed Avg timeout diff(ns) - State stop0: 1954
> # Observed Avg timeout diff(ns) - State stop1: 1895
> # Observed Avg timeout diff(ns) - State stop2: 14556
> # Observed Avg timeout diff(ns) - State stop4: 873988
> # Observed Avg timeout diff(ns) - State stop5: 959137
>
> Aboorva Devarajan (2):
> powerpc/cpuidle: cpuidle wakeup latency based on IPI and timer
> events
> powerpc/selftest: Add support for cpuidle latency measurement
>
> arch/powerpc/Kconfig.debug | 10 +
> arch/powerpc/kernel/Makefile | 1 +
> arch/powerpc/kernel/test_cpuidle_latency.c | 154 ++++++
> tools/testing/selftests/powerpc/Makefile | 1 +
> .../powerpc/cpuidle_latency/.gitignore | 2 +
> .../powerpc/cpuidle_latency/Makefile | 6 +
> .../cpuidle_latency/cpuidle_latency.sh | 443
> ++++++++++++++++++
> .../powerpc/cpuidle_latency/settings | 1 +
> 8 files changed, 618 insertions(+)
> create mode 100644 arch/powerpc/kernel/test_cpuidle_latency.c
> create mode 100644
> tools/testing/selftests/powerpc/cpuidle_latency/.gitignore
> create mode 100644
> tools/testing/selftests/powerpc/cpuidle_latency/Makefile
> create mode 100755
> tools/testing/selftests/powerpc/cpuidle_latency/cpuidle_latency.sh
> create mode 100644
> tools/testing/selftests/powerpc/cpuidle_latency/settings
>
next parent reply other threads:[~2023-09-25 5:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230911053620.87973-1-aboorvad@linux.vnet.ibm.com>
2023-09-25 5:06 ` Aboorva Devarajan [this message]
2023-10-12 4:48 ` [RFC v3 0/2] CPU-Idle latency selftest framework Aboorva Devarajan
2021-04-04 8:33 Pratik Rajesh Sampat
2021-04-09 5:23 ` Doug Smythies
2021-04-09 7:43 ` Pratik Sampat
2021-04-09 14:26 ` Doug Smythies
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2725211932028cf24ab34da9eb9d19190848cceb.camel@linux.vnet.ibm.com \
--to=aboorvad@linux.vnet.ibm.com \
--cc=20230911053620.87973-1-aboorvad@linux.vnet.ibm.com \
--cc=arnd@arndb.de \
--cc=daniel.lezcano@linaro.org \
--cc=joel@jms.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=pratik.r.sampat@gmail.com \
--cc=rafael@kernel.org \
--cc=rmclure@linux.ibm.com \
--cc=shuah@kernel.org \
--cc=srikar@linux.vnet.ibm.com \
--cc=sshegde@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).