The variables in vcpu->arch currently store the latest values read from PACA when the vCPU exits. Change this to instead store aggregate values so that every vCPU has its own record of total context switch latencies it has accumulated. This is essential for the vpa-pmu driver to report correct numbers. Fixes: 176cda0619b6 ("powerpc/perf: Add perf interface to expose vpa counters") Cc: Signed-off-by: Gautam Menghani --- v1 -> v2: 1. Add stable/fixes tags arch/powerpc/kvm/book3s_hv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 61dbeea317f3..342168b8bfc8 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -4163,12 +4163,12 @@ static void do_trace_nested_cs_time(struct kvm_vcpu *vcpu) trace_kvmppc_vcpu_stats(vcpu, l1_to_l2_ns - *l1_to_l2_cs_ptr, l2_to_l1_ns - *l2_to_l1_cs_ptr, l2_runtime_ns - *l2_runtime_agg_ptr); + vcpu->arch.l1_to_l2_cs += (l1_to_l2_ns - *l1_to_l2_cs_ptr); + vcpu->arch.l2_to_l1_cs += (l2_to_l1_ns - *l2_to_l1_cs_ptr); + vcpu->arch.l2_runtime_agg += (l2_runtime_ns - *l2_runtime_agg_ptr); *l1_to_l2_cs_ptr = l1_to_l2_ns; *l2_to_l1_cs_ptr = l2_to_l1_ns; *l2_runtime_agg_ptr = l2_runtime_ns; - vcpu->arch.l1_to_l2_cs = l1_to_l2_ns; - vcpu->arch.l2_to_l1_cs = l2_to_l1_ns; - vcpu->arch.l2_runtime_agg = l2_runtime_ns; } u64 kvmhv_get_l1_to_l2_cs_time(void) -- 2.54.0