diff options
author | Mitchell Horne <mhorne@FreeBSD.org> | 2021-08-30 17:02:23 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2022-07-05 16:38:52 +0000 |
commit | 1e8f338d7f227fc9e1cace1280fe89ab11bfc33b (patch) | |
tree | 7569b0c9178f90a25282017efd405cd9b015ffb9 /sys/dev/hwpmc/hwpmc_powerpc.h | |
parent | 376acb0648390ab3fe5eac3ca8fd774b6832ea68 (diff) |
hwpmc: consistently validate PMC class in allocation method
It is always a good idea. In one case, attempting to allocate N+1 PMCs
from a class with N hardware counters would incorrectly attempt to
allocate from the next class in the list. Without this validation, this
can lead to all kinds of strange behaviour.
Since powerpc_allocate_pmc() is used by both the mpc7xxx and ppc970
classes, add a new global to track which is active (it will never be
both).
Reviewed by: luporl, ray
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31387
(cherry picked from commit 315cd55dba61416495a847f0eed6e522421e2347)
Diffstat (limited to 'sys/dev/hwpmc/hwpmc_powerpc.h')
-rw-r--r-- | sys/dev/hwpmc/hwpmc_powerpc.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/dev/hwpmc/hwpmc_powerpc.h b/sys/dev/hwpmc/hwpmc_powerpc.h index 551f59b60528..25b041327b84 100644 --- a/sys/dev/hwpmc/hwpmc_powerpc.h +++ b/sys/dev/hwpmc/hwpmc_powerpc.h @@ -82,6 +82,7 @@ extern size_t ppc_event_codes_size; extern int ppc_event_first; extern int ppc_event_last; extern int ppc_max_pmcs; +extern enum pmc_class ppc_class; extern void (*powerpc_set_pmc)(int cpu, int ri, int config); extern pmc_value_t (*powerpc_pmcn_read)(unsigned int pmc); |