From: Dapeng Mi <dapeng1.mi@linux.intel.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Zhenyu Wang <zhenyuw@linux.intel.com>,
Zhang Xiong <xiong.y.zhang@intel.com>,
Jim Mattson <jmattson@google.com>,
Mingwei Zhang <mizhang@google.com>,
Like Xu <like.xu.linux@gmail.com>,
Dapeng Mi <dapeng1.mi@intel.com>,
Dapeng Mi <dapeng1.mi@linux.intel.com>,
Like Xu <likexu@tencent.com>
Subject: [Patch 1/2] KVM: x86/pmu: Add Intel CPUID-hinted TopDown slots event
Date: Tue, 31 Oct 2023 17:06:12 +0800 [thread overview]
Message-ID: <20231031090613.2872700-2-dapeng1.mi@linux.intel.com> (raw)
In-Reply-To: <20231031090613.2872700-1-dapeng1.mi@linux.intel.com>
This patch adds support for the architectural topdown slots event which
is hinted by CPUID.0AH.EBX.
The topdown slots event counts the total number of available slots for
an unhalted logical processor. Software can use this event as the
denominator for the top-level metrics of the topDown Microarchitecture
Analysis method.
Although the MSR_PERF_METRICS MSR required for topdown events is not
currently available in the guest, relying only on the data provided by
the slots event is sufficient for pmu users to perceive differences in
cpu pipeline machine-width across micro-architectures.
The standalone slots event, like the instruction event, can be counted
with gp counter or fixed counter 3 (if any). Its availability is also
controlled by CPUID.AH.EBX. On Linux, perf user may encode
"-e cpu/event=0xa4,umask=0x01/" or "-e cpu/slots/" to count slots events.
This patch only enables slots event on GP counters. The enabling on fixed
counter 3 will be supported in subsequent patches.
Co-developed-by: Like Xu <likexu@tencent.com>
Signed-off-by: Like Xu <likexu@tencent.com>
Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
---
arch/x86/kvm/vmx/pmu_intel.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c
index 820d3e1f6b4f..e32353f1143f 100644
--- a/arch/x86/kvm/vmx/pmu_intel.c
+++ b/arch/x86/kvm/vmx/pmu_intel.c
@@ -34,6 +34,7 @@ enum intel_pmu_architectural_events {
INTEL_ARCH_LLC_MISSES,
INTEL_ARCH_BRANCHES_RETIRED,
INTEL_ARCH_BRANCHES_MISPREDICTED,
+ INTEL_ARCH_TOPDOWN_SLOTS,
NR_REAL_INTEL_ARCH_EVENTS,
@@ -58,6 +59,7 @@ static struct {
[INTEL_ARCH_LLC_MISSES] = { 0x2e, 0x41 },
[INTEL_ARCH_BRANCHES_RETIRED] = { 0xc4, 0x00 },
[INTEL_ARCH_BRANCHES_MISPREDICTED] = { 0xc5, 0x00 },
+ [INTEL_ARCH_TOPDOWN_SLOTS] = { 0xa4, 0x01 },
[PSEUDO_ARCH_REFERENCE_CYCLES] = { 0x00, 0x03 },
};
--
2.34.1
next prev parent reply other threads:[~2023-10-31 8:58 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-31 9:06 [Patch 0/2] Enable topdown slots event in vPMU Dapeng Mi
2023-10-31 9:06 ` Dapeng Mi [this message]
2023-10-31 18:22 ` [Patch 1/2] KVM: x86/pmu: Add Intel CPUID-hinted TopDown slots event Jim Mattson
2023-11-01 1:59 ` Mi, Dapeng
2023-11-01 3:04 ` Jim Mattson
2023-11-01 3:31 ` Mi, Dapeng
2023-11-01 13:33 ` Liang, Kan
2023-11-02 2:07 ` Mi, Dapeng
2023-11-02 17:45 ` Jim Mattson
2023-11-03 10:03 ` Mi, Dapeng
2023-11-03 14:50 ` Jim Mattson
2023-11-03 15:12 ` Liang, Kan
2023-11-03 15:18 ` Jim Mattson
2023-11-03 18:03 ` Sean Christopherson
2023-10-31 9:06 ` [Patch 2/2] KVM: x86/pmu: Support PMU fixed counter 3 Dapeng Mi
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=20231031090613.2872700-2-dapeng1.mi@linux.intel.com \
--to=dapeng1.mi@linux.intel.com \
--cc=dapeng1.mi@intel.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=like.xu.linux@gmail.com \
--cc=likexu@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mizhang@google.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=xiong.y.zhang@intel.com \
--cc=zhenyuw@linux.intel.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
Powered by JetHome