From 39d9b13e09246f6eca3f1209d29e79bccadd7adc Mon Sep 17 00:00:00 2001 From: Dietmar Eggemann Date: Mon, 27 Nov 2023 22:45:02 +0100 Subject: [PATCH] lisa._assets.kmodules.lisa: Don't rely on rq->cpu_capacity_orig anymore The kernel commit 7bc263840bc3 ("sched/topology: Consolidate and clean up access to a CPU's max compute") removed rq->cpu_capacity_orig so we can't use it anymore to retrieve the original CPU capacity nor for setting the FREQ_INVARIANCE kernel feature in LISA. Split the micro-architectural part of the Invariance from the FREQ_INVARIANCE into its own kernel feature UARCH_INVARIANCE. Use a copy of the Arm64 (+ Arm, Riscv) kernel implementation (per-cpu cpu_scale variable in drivers/base/arch_topology.c) also in the lisa trace module code. Tested on Juno-r0 with 'lisa-load-kmod --conf target_conf.yml' by evaluating the 'capacity_orig' field of the 'lisa__sched_cpu_capacity' trace event. Signed-off-by: Dietmar Eggemann --- lisa/_assets/kmodules/lisa/introspection.json | 3 ++- lisa/_assets/kmodules/lisa/sched_helpers.h | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lisa/_assets/kmodules/lisa/introspection.json b/lisa/_assets/kmodules/lisa/introspection.json index 1955511b5d..78f83811be 100644 --- a/lisa/_assets/kmodules/lisa/introspection.json +++ b/lisa/_assets/kmodules/lisa/introspection.json @@ -29,6 +29,7 @@ "SCHED_AVG_RBL": "HAS_MEMBER(struct, sched_avg, runnable_load_avg) || HAS_MEMBER(struct, sched_avg, runnable_avg)", "FILE_IO": "HAS_SYMBOL(kernel_read) && HAS_SYMBOL(kernel_write) && HAS_SYMBOL(filp_open)", - "FREQ_INVARIANCE": "HAS_SYMBOL(arch_freq_scale) && HAS_MEMBER(struct, rq, cpu_capacity_orig)" + "FREQ_INVARIANCE": "HAS_SYMBOL(arch_freq_scale)", + "UARCH_INVARIANCE": "HAS_SYMBOL(cpu_scale)" } } diff --git a/lisa/_assets/kmodules/lisa/sched_helpers.h b/lisa/_assets/kmodules/lisa/sched_helpers.h index 2e4cb771e9..51d3ff6cba 100644 --- a/lisa/_assets/kmodules/lisa/sched_helpers.h +++ b/lisa/_assets/kmodules/lisa/sched_helpers.h @@ -214,11 +214,15 @@ static inline int rq_cpu_capacity(const struct rq *rq) ; } +# if HAS_KERNEL_FEATURE(UARCH_INVARIANCE) +DECLARE_PER_CPU(unsigned long, cpu_scale); +# endif + static inline int rq_cpu_orig_capacity(const struct rq *rq) { return -# if HAS_KERNEL_FEATURE(FREQ_INVARIANCE) - rq->cpu_capacity_orig; +# if HAS_KERNEL_FEATURE(UARCH_INVARIANCE) + per_cpu(cpu_scale, rq->cpu) # else rq_cpu_capacity(rq) # endif