From: Zide Chen <zide.chen@intel.com>
To: kvm@vger.kernel.org
Cc: Zide Chen <zide.chen@intel.com>, Dapeng Mi <dapeng1.mi@linux.intel.com>
Subject: [kvm-unit-test PATCH 2/3] x86/pmu: Fixed PEBS basic record parsing issue
Date: Mon, 18 Nov 2024 14:52:06 -0800 [thread overview]
Message-ID: <20241118225207.16596-2-zide.chen@intel.com> (raw)
In-Reply-To: <20241118225207.16596-1-zide.chen@intel.com>
If adaptive PEBS is supported, to parse the PEBS record_format[47:0],
SDM states that "This field indicates which data groups are included
in the record. The field is zero if none of the counters that triggered
the current PEBS record have their Adaptive_Record bit set. Otherwise
it contains the value of MSR_PEBS_DATA_CFG."
Without this fix, if neither IA32_PERFEVTSELx.Adaptive_Record[34] nor
IA32_FIXED_CTR_CTRL.FCx_Adaptive_Record is set on adaptive PEBS capable
systems, test will fail.
Fixes: 2cb2af7f53d ("x86/pmu: Test adaptive PEBS without any adaptive counters")
Signed-off-by: Zide Chen <zide.chen@intel.com>
Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
---
x86/pmu_pebs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/x86/pmu_pebs.c b/x86/pmu_pebs.c
index 77875c4fee35..6b4a5ed3b91e 100644
--- a/x86/pmu_pebs.c
+++ b/x86/pmu_pebs.c
@@ -297,6 +297,8 @@ static void check_pebs_records(u64 bitmask, u64 pebs_data_cfg, bool use_adaptive
pebs_idx_match = pebs_rec->applicable_counters & bitmask;
pebs_size_match = pebs_record_size == get_pebs_record_size(pebs_data_cfg, use_adaptive);
data_cfg_match = (pebs_rec->format_size & GENMASK_ULL(47, 0)) == pebs_data_cfg;
+ data_cfg_match = (pebs_rec->format_size & GENMASK_ULL(47, 0)) ==
+ (use_adaptive ? pebs_data_cfg : 0);
expected = pebs_idx_match && pebs_size_match && data_cfg_match;
report(expected,
"PEBS record (written seq %d) is verified (including size, counters and cfg).", count);
--
2.34.1
next prev parent reply other threads:[~2024-11-18 22:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 22:52 [kvm-unit-test PATCH 1/3] nVMX: fixed-function performance counters could be not contiguous Zide Chen
2024-11-18 22:52 ` Zide Chen [this message]
2024-11-18 22:52 ` [kvm-unit-test PATCH 3/3] x86/pmu: Execute PEBS test only if PEBSRecordFormat >= 4 Zide Chen
2025-02-24 17:24 ` [kvm-unit-test PATCH 1/3] nVMX: fixed-function performance counters could be not contiguous Sean Christopherson
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=20241118225207.16596-2-zide.chen@intel.com \
--to=zide.chen@intel.com \
--cc=dapeng1.mi@linux.intel.com \
--cc=kvm@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.