git: c4cafc24df30 - stable/13 - libpmc: Prefer fixed counters in Intel event aliases.

From: Alexander Motin <mav_at_FreeBSD.org>
Date: Mon, 04 Jul 2022 18:09:28 UTC
The branch stable/13 has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=c4cafc24df302ccc127b167ef1652e2a16a74c38

commit c4cafc24df302ccc127b167ef1652e2a16a74c38
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2022-06-02 19:09:38 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2022-07-04 17:48:10 +0000

    libpmc: Prefer fixed counters in Intel event aliases.
    
    It is recommended by Intel to use fixed counters when possible to
    leave programmable ones for different events.
    
    This fixes `pmc stat`, which tries to count 6 events same time, while
    many Intel CPUs have only 4 programmable counters.
    
    MFC after:      1 month
    
    (cherry picked from commit e144cd92bb150b5636f97af3c1c89da49edf8ac8)
---
 lib/libpmc/libpmc_pmu_util.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c
index 6830a2457364..33b369547a0a 100644
--- a/lib/libpmc/libpmc_pmu_util.c
+++ b/lib/libpmc/libpmc_pmu_util.c
@@ -60,8 +60,8 @@ typedef enum {
 } pmu_mfr_t;
 
 static struct pmu_alias pmu_intel_alias_table[] = {
-	{"UNHALTED_CORE_CYCLES", "CPU_CLK_UNHALTED.THREAD_P_ANY"},
-	{"UNHALTED-CORE-CYCLES", "CPU_CLK_UNHALTED.THREAD_P_ANY"},
+	{"UNHALTED_CORE_CYCLES", "cpu_clk_unhalted.thread"},
+	{"UNHALTED-CORE-CYCLES", "cpu_clk_unhalted.thread"},
 	{"LLC_MISSES", "LONGEST_LAT_CACHE.MISS"},
 	{"LLC-MISSES", "LONGEST_LAT_CACHE.MISS"},
 	{"LLC_REFERENCE", "LONGEST_LAT_CACHE.REFERENCE"},
@@ -74,8 +74,8 @@ static struct pmu_alias pmu_intel_alias_table[] = {
 	{"BRANCH-INSTRUCTION-RETIRED", "BR_INST_RETIRED.ALL_BRANCHES"},
 	{"BRANCH_MISSES_RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"},
 	{"BRANCH-MISSES-RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"},
-	{"unhalted-cycles", "CPU_CLK_UNHALTED.THREAD_P_ANY"},
-	{"instructions", "inst_retired.any_p"},
+	{"unhalted-cycles", "cpu_clk_unhalted.thread"},
+	{"instructions", "inst_retired.any"},
 	{"branch-mispredicts", "br_misp_retired.all_branches"},
 	{"branches", "br_inst_retired.all_branches"},
 	{"interrupts", "hw_interrupts.received"},