diff options
| author | Mitchell Horne <mhorne@FreeBSD.org> | 2023-06-06 17:26:46 +0000 |
|---|---|---|
| committer | Mitchell Horne <mhorne@FreeBSD.org> | 2023-09-11 19:19:58 +0000 |
| commit | 5adb91c72985b840b2c7fbf3c3308619acd2b61a (patch) | |
| tree | 7f4a411601691e52ea97baaa19e7baf9eeed022d /lib/libpmc | |
| parent | 196bb0e152cf2d3a0ba61bda8a2d09c8107a809a (diff) | |
Diffstat (limited to 'lib/libpmc')
| -rw-r--r-- | lib/libpmc/libpmc.c | 9 | ||||
| -rw-r--r-- | lib/libpmc/libpmc_pmu_util.c | 2 | ||||
| -rw-r--r-- | lib/libpmc/pmclog.c | 11 |
3 files changed, 5 insertions, 17 deletions
diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index a7ed1c3d9ac8..f10a64e28cac 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -33,7 +33,6 @@ #include <sys/pmc.h> #include <sys/syscall.h> -#include <assert.h> #include <ctype.h> #include <errno.h> #include <err.h> @@ -1083,14 +1082,8 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, r = spec_copy = strdup(ctrspec); ctrname = strsep(&r, ","); if (pmc_pmu_enabled()) { - if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) { - /* - * XXX: pmclog_get_event exploits this to disambiguate - * PMU from PMC event codes in PMCALLOCATE events. - */ - assert(pmc_config.pm_ev < PMC_EVENT_FIRST); + if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) goto found; - } } free(spec_copy); spec_copy = NULL; diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 772dec7a9d53..fa2e76e8d026 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -649,7 +649,6 @@ pmc_pmu_pmcallocate_md(const char *event_name, struct pmc_op_pmcallocate *pm) assert(idx >= 0); pm->pm_ev = idx; pm->pm_md.pm_md_config = ped.ped_event; - pm->pm_md.pm_md_flags |= PM_MD_RAW_EVENT; pm->pm_class = PMC_CLASS_ARMV8; pm->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE); @@ -680,5 +679,6 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) return (error); } + pm->pm_flags |= PMC_F_EV_PMU; return (0); } diff --git a/lib/libpmc/pmclog.c b/lib/libpmc/pmclog.c index a21fe42c9947..3b1572baaa2c 100644 --- a/lib/libpmc/pmclog.c +++ b/lib/libpmc/pmclog.c @@ -357,15 +357,10 @@ pmclog_get_event(void *cookie, char **data, ssize_t *len, PMCLOG_READ64(le,ev->pl_u.pl_a.pl_rate); /* - * Could be either a PMC event code or a PMU event index; - * assume that their encodings don't overlap (i.e. no PMU event - * table is more than 0x1000 entries) to distinguish them here. - * Otherwise pmc_pmu_event_get_by_idx will go out of bounds if - * given a PMC event code when it knows about that CPU. - * - * XXX: Ideally we'd have user flags to give us that context. + * pl_event could contain either a PMC event code or a PMU + * event index. */ - if (ev->pl_u.pl_a.pl_event < PMC_EVENT_FIRST) + if ((ev->pl_u.pl_a.pl_flags & PMC_F_EV_PMU) != 0) ev->pl_u.pl_a.pl_evname = pmc_pmu_event_get_by_idx(ps->ps_cpuid, ev->pl_u.pl_a.pl_event); |
