git: abd7dfa09a0e - main - hwpmc: use the UMC enable bit with PerfMonV2
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 05 Nov 2026 13:46:01 UTC
The branch main has been updated by mhorne:
URL: https://cgit.FreeBSD.org/src/commit/?id=abd7dfa09a0ed1c06924226da0285d0731273f66
commit abd7dfa09a0ed1c06924226da0285d0731273f66
Author: Osvaldo Janeri Filho <ojanerif@amd.com>
AuthorDate: 2026-11-05 13:32:29 +0000
Commit: Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2026-11-05 13:45:58 +0000
hwpmc: use the UMC enable bit with PerfMonV2
The PerfMonV2 start and stop methods set the core enable bit on UMC
counters too, so UMC events never count. Use the UMC enable bit, as
the legacy methods do.
Reviewed by: mhorne, Ali Mashtizadeh <ali@mashtizadeh.com>
Fixes: 9d3064010590 ("hwpmc_amd: add PerfMonV2 global-control path")
Sponsored by: AMD
Signed-off-by: Osvaldo Janeri Filho <ojanerif@amd.com>
Differential Revision: https://reviews.freebsd.org/D60770
---
sys/dev/hwpmc/hwpmc_amd.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/sys/dev/hwpmc/hwpmc_amd.c b/sys/dev/hwpmc/hwpmc_amd.c
index dac50207656d..f466fff4cfb3 100644
--- a/sys/dev/hwpmc/hwpmc_amd.c
+++ b/sys/dev/hwpmc/hwpmc_amd.c
@@ -797,7 +797,10 @@ amd_start_pmc_v2(int cpu __diagused, int ri, struct pmc *pm)
}
/* Enable EVSEL while the virtual slot's global bit is off. */
- config = pm->pm_md.pm_amd.pm_amd_evsel | AMD_PMC_ENABLE;
+ if (pd->pm_subclass == PMC_AMD_SUB_CLASS_UMC)
+ config = pm->pm_md.pm_amd.pm_amd_evsel | AMD_PMC_UMC_ENABLE;
+ else
+ config = pm->pm_md.pm_amd.pm_amd_evsel | AMD_PMC_ENABLE;
wrmsr(pd->pm_evsel, config);
if (pd->pm_subclass == PMC_AMD_SUB_CLASS_CORE &&
@@ -868,6 +871,7 @@ amd_stop_pmc_v2(int cpu __diagused, int ri, struct pmc *pm)
{
const struct amd_descr *pd;
enum pmc_mode mode;
+ uint64_t config;
int i;
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
@@ -888,8 +892,11 @@ amd_stop_pmc_v2(int cpu __diagused, int ri, struct pmc *pm)
}
/* Disable EVSEL after the counter's global bit is off. */
- wrmsr(pd->pm_evsel,
- pm->pm_md.pm_amd.pm_amd_evsel & ~AMD_PMC_ENABLE);
+ if (pd->pm_subclass == PMC_AMD_SUB_CLASS_UMC)
+ config = pm->pm_md.pm_amd.pm_amd_evsel & ~AMD_PMC_UMC_ENABLE;
+ else
+ config = pm->pm_md.pm_amd.pm_amd_evsel & ~AMD_PMC_ENABLE;
+ wrmsr(pd->pm_evsel, config);
/* Wait out an in-flight overflow NMI. The handler clears the status bit. */
if (pd->pm_subclass == PMC_AMD_SUB_CLASS_CORE &&