Skip to content

Commit 5f0b48c

Browse files
kjain101mpe
authored andcommitted
powerpc/kvm: Add vpa latency counters to kvm_vcpu_arch
Commit e1f288d ("KVM: PPC: Book3S HV nestedv2: Add support for reading VPA counters for pseries guests") introduced support for new Virtual Process Area(VPA) based software counters. These counters are useful when observing context switch latency of L1 <-> L2. It also added access to counters in lppaca, which is good enough to understand latency details per-cpu level. But to extend and aggregate per-process level(qemu) or per-pid/tid level(vcpu), these counters also needs to be added as part of kvm_vcpu_arch struct. Additional code added to update these new kvm_vcpu_arch variables in do_trace_nested_cs_time function. Signed-off-by: Kajol Jain <[email protected]> Co-developed-by: Madhavan Srinivasan <[email protected]> Signed-off-by: Madhavan Srinivasan <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 4ae0b32 commit 5f0b48c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

arch/powerpc/include/asm/kvm_host.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,11 @@ struct kvm_vcpu_arch {
871871
struct kvmhv_tb_accumulator cede_time; /* time napping inside guest */
872872
#endif
873873
#endif /* CONFIG_KVM_BOOK3S_HV_EXIT_TIMING */
874+
#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
875+
u64 l1_to_l2_cs;
876+
u64 l2_to_l1_cs;
877+
u64 l2_runtime_agg;
878+
#endif
874879
};
875880

876881
#define VCPU_FPR(vcpu, i) (vcpu)->arch.fp.fpr[i][TS_FPROFFSET]

arch/powerpc/kvm/book3s_hv.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4167,6 +4167,9 @@ static void do_trace_nested_cs_time(struct kvm_vcpu *vcpu)
41674167
*l1_to_l2_cs_ptr = l1_to_l2_ns;
41684168
*l2_to_l1_cs_ptr = l2_to_l1_ns;
41694169
*l2_runtime_agg_ptr = l2_runtime_ns;
4170+
vcpu->arch.l1_to_l2_cs = l1_to_l2_ns;
4171+
vcpu->arch.l2_to_l1_cs = l2_to_l1_ns;
4172+
vcpu->arch.l2_runtime_agg = l2_runtime_ns;
41704173
}
41714174

41724175
u64 kvmhv_get_l1_to_l2_cs_time(void)

0 commit comments

Comments
 (0)