KVM: selftest: Add family and model check for zen4 in PMU filter test
PATCH 1/1 KVM: selftest: Add family and model check for zen4 in PMU filter test
PMU event filter test fails on zen4 architecture because of unavailability of family and model check for zen4 in use_amd_pmu(). So, add family and model check for zen4 architecture in use_amd_pmu().
--- .../testing/selftests/kvm/x86_64/pmu_event_filter_test.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c +8 -1
@@ -374,6 +374,12 @@ static bool is_zen3(uint32_t family, uint32_t model)return family ==0x19 && model <=0x0f ; } +static bool is_zen4 (uint32_t family,uint32_t model) +{ +return family ==0x19 && ((model >=0x10 && model <=0x1f ) || + (model >=0xa0 && model <=0xaf )); +} +/* * Determining AMD support for a PMU event requires consulting the AMD * PPR for the CPU or reference material derived therefrom. The AMD
@@ -390,7 +396,8 @@ static bool use_amd_pmu(void)return host_cpu_is_amd && (is_zen1 (family, model) ||is_zen2 (family, model) || -is_zen3 (family, model)); +is_zen3 (family, model) || +is_zen4 (family, model)); }/*
Signature · 1 line
2.34.1
Sean Christopherson
reviewerQuoted 3 lines · Manali Shukla
PMU event filter test fails on zen4 architecture because of unavailability of family and model check for zen4 in
use_amd_pmu(). So, add family and model check for zen4 architecture inuse_amd_pmu().
Is there a less ugly way to detect that 0xc2,0 == "branch instructions retired"? E.g. can we instead check for v2 PMU support, or are there no guarantees going forward? Pivoting on FMS is so painful :-(
Quoted 8 lines · Sean Christopherson
Quoted 3 lines · Manali Shukla
PMU event filter test fails on zen4 architecture because of unavailability of family and model check for zen4 in
use_amd_pmu(). So, add family and model check for zen4 architecture inuse_amd_pmu().Is there a less ugly way to detect that 0xc2,0 == "branch instructions retired"? E.g. can we instead check for v2 PMU support, or are there no guarantees going forward? Pivoting on FMS is so painful :-(
We have confirmed with the hardware team that 0xc2,0 == "branch instructions retired" is always true going forward, we intend to maintain backward compatibility for branch instruction retired. Since event 0xc2 is supported on all currently released F17h+ processors as branch instructions retired, we can check for "family >= 0x17" for all Zen and its successors instead of checking them individually in pmu_event_filter_test.c.
- Manali
Sean Christopherson
reviewerQuoted 10 lines · Manali Shukla
Quoted 8 lines · Sean Christopherson
Quoted 3 lines · Manali Shukla
PMU event filter test fails on zen4 architecture because of unavailability of family and model check for zen4 in
use_amd_pmu(). So, add family and model check for zen4 architecture inuse_amd_pmu().Is there a less ugly way to detect that 0xc2,0 == "branch instructions retired"? E.g. can we instead check for v2 PMU support, or are there no guarantees going forward? Pivoting on FMS is so painful :-(
Quoted 5 lines
We have confirmed with the hardware team that 0xc2,0 == "branch instructions retired" is always true going forward, we intend to maintain backward compatibility for branch instruction retired. Since event
0xc2is supported on all currently released F17h+ processors as branch instructions retired, we can check for "family >=0x17" for all Zen and its successors instead of checking them individually inpmu_event_filter_test.c.
Can you send a patch for this? Please :-)
Quoted 11 lines · Sean Christopherson
Quoted 10 lines · Manali Shukla
Quoted 8 lines · Sean Christopherson
Quoted 3 lines · Manali Shukla
PMU event filter test fails on zen4 architecture because of unavailability of family and model check for zen4 in
use_amd_pmu(). So, add family and model check for zen4 architecture inuse_amd_pmu().Is there a less ugly way to detect that 0xc2,0 == "branch instructions retired"? E.g. can we instead check for v2 PMU support, or are there no guarantees going forward? Pivoting on FMS is so painful :-(
Quoted 7 lines
Quoted 5 lines
We have confirmed with the hardware team that 0xc2,0 == "branch instructions retired" is always true going forward, we intend to maintain backward compatibility for branch instruction retired. Since event
0xc2is supported on all currently released F17h+ processors as branch instructions retired, we can check for "family >=0x17" for all Zen and its successors instead of checking them individually inpmu_event_filter_test.c.Can you send a patch for this? Please :-)
Sent.
https://lore.kernel.org/kvm/[email protected]/T/#u
-Manali