summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/perf
diff options
context:
space:
mode:
authorKajol Jain <kjain@linux.ibm.com>2024-11-18 12:41:14 +0100
committerMichael Ellerman <mpe@ellerman.id.au>2024-11-19 04:11:30 +0100
commitf26f9933e3e31b2117b804b6b8932388db88a131 (patch)
treecca45a6dd146b18e165bf36d208c10b8b0895748 /arch/powerpc/perf
parentpowerpc/kvm: Add vpa latency counters to kvm_vcpu_arch (diff)
downloadlinux-f26f9933e3e31b2117b804b6b8932388db88a131.tar.xz
linux-f26f9933e3e31b2117b804b6b8932388db88a131.zip
powerpc/perf: Add per-task/process monitoring to vpa_pmu driver
Enhance the vpa_pmu driver with a feature to observe context switch latency event for both per-task (tid) and per-pid (pid) option. Couple of new helper functions are added to hide the abstraction of reading the context switch latency counter from kvm_vcpu_arch struct and these helper functions are defined in the "kvm/book3s_hv.c". "PERF_ATTACH_TASK" flag is used to decide whether to read the counter values from lppaca or kvm_vcpu_arch struct. Signed-off-by: Kajol Jain <kjain@linux.ibm.com> Co-developed-by: Madhavan Srinivasan <maddy@linux.ibm.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://patch.msgid.link/20241118114114.208964-4-kjain@linux.ibm.com
Diffstat (limited to 'arch/powerpc/perf')
-rw-r--r--arch/powerpc/perf/vpa-pmu.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/arch/powerpc/perf/vpa-pmu.c b/arch/powerpc/perf/vpa-pmu.c
index c143c626b4a0..6a5bfd2a13b5 100644
--- a/arch/powerpc/perf/vpa-pmu.c
+++ b/arch/powerpc/perf/vpa-pmu.c
@@ -97,13 +97,22 @@ static unsigned long get_counter_data(struct perf_event *event)
switch (config) {
case L1_TO_L2_CS_LAT:
- data = kvmhv_get_l1_to_l2_cs_time();
+ if (event->attach_state & PERF_ATTACH_TASK)
+ data = kvmhv_get_l1_to_l2_cs_time_vcpu();
+ else
+ data = kvmhv_get_l1_to_l2_cs_time();
break;
case L2_TO_L1_CS_LAT:
- data = kvmhv_get_l2_to_l1_cs_time();
+ if (event->attach_state & PERF_ATTACH_TASK)
+ data = kvmhv_get_l2_to_l1_cs_time_vcpu();
+ else
+ data = kvmhv_get_l2_to_l1_cs_time();
break;
case L2_RUNTIME_AGG:
- data = kvmhv_get_l2_runtime_agg();
+ if (event->attach_state & PERF_ATTACH_TASK)
+ data = kvmhv_get_l2_runtime_agg_vcpu();
+ else
+ data = kvmhv_get_l2_runtime_agg();
break;
default:
data = 0;