#
6729e8a4 |
| 23-May-2024 |
Brooks Davis <brooks@FreeBSD.org> |
libpmc: remove tautological assert
gcc13 whines about this assert than an unsigned integer is >= 0.
Reviewed by: luporl Fixes: b48a2770d48b9 powerpc64: add Power8 and Power9 PMCs Differential Revi
libpmc: remove tautological assert
gcc13 whines about this assert than an unsigned integer is >= 0.
Reviewed by: luporl Fixes: b48a2770d48b9 powerpc64: add Power8 and Power9 PMCs Differential Revision: https://reviews.freebsd.org/D45232
show more ...
|
Revision tags: release/13.3.0, release/14.0.0 |
|
#
c190fb35 |
| 06-Jun-2023 |
Mitchell Horne <mhorne@FreeBSD.org> |
pmc: better distinguish pmu-events allocation path
Background:
The pm_ev field of struct pmc_op_pmcallocate and struct pmc traditionally contains the index of the chosen event, corresponding to the
pmc: better distinguish pmu-events allocation path
Background:
The pm_ev field of struct pmc_op_pmcallocate and struct pmc traditionally contains the index of the chosen event, corresponding to the __PMC_EVENTS array in pmc_events.h. This is a static list of events, maintained by FreeBSD.
In the usual case, libpmc translates the user supplied event name (string) into the pm_ev index, which is passed as an argument to the allocation syscall. On the kernel side, the allocation method for the relevant hwpmc class translates the given index into the event code that will be written to an event selection register.
In 2018, a new source of performance event definitions was introduced: the pmu-events json files, which are maintained by the Linux kernel. The result was better coverage for newer Intel processors with a reduced maintenance burden for libpmc/hwpmc. Intel and AMD CPUs were unconditionally switched to allocate events from pmu-events instead of the traditional scheme (959826ca1bb0a, 81eb4dcf9e0d).
Under the pmu-events scheme, the pm_ev field contains an index corresponding to the selected event from the pmu-events table, something which the kernel has no knowledge of. The configuration for the performance counting registers is instead passed via class-dependent fields (struct pmc_md_op_pmcallocate).
In 2021 I changed the allocation logic so that it would attempt to pull from the pmu-events table first, and fall-back to the traditional method (dfb4fb41166bc3). Later, pmu-events support for arm64 and power8 CPUs was added (28dd6730a5d6 and b48a2770d48b).
The problem that remains is that the pm_ev field is overloaded, without a definitive way to determine whether the event allocation came from the pmu-events table or FreeBSD's statically-defined PMC events. This resulted in a recent fix, 21f7397a61f7.
Change:
To disambiguate these two supported but separate use-cases, add a new flag, PMC_F_EV_PMU, to be set as part of the allocation, indicating that the event index came from pmu-events.
This is useful in two ways: 1. On the kernel side, we can validate the syscall arguments better. Some classes support only the traditional event scheme (e.g. hwpmc_armv7), while others support only the pmu-events method (e.g. hwpmc_core for Intel). We can now check for this. The hwpmc_arm64 class supports both methods, so the new flag supersedes the existing MD flag, PM_MD_EVENT_RAW.
2. The flag will be tracked in struct pmc for the duration of its lifetime, meaning it is communicated back to userspace. This allows libpmc to perform the reverse index-to-event-name translation without speculating about the meaning of the index value.
Adding the flag is a backwards-incompatible ABI change. We recently bumped the major version of the hwpmc module, so this breakage is acceptable.
Reviewed by: jkoshy MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40753
show more ...
|
#
45dcc17e |
| 20-Jun-2023 |
Mitchell Horne <mhorne@FreeBSD.org> |
libpmc: make pmc_pmu_pmcallocate() machine-independent
Have it call the platform-dependent version. For better layering, move the reset logic inside the new function. This is mainly to facilitate an
libpmc: make pmc_pmu_pmcallocate() machine-independent
Have it call the platform-dependent version. For better layering, move the reset logic inside the new function. This is mainly to facilitate an upcoming change.
Reviewed by: jkoshy MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40752
show more ...
|
#
b3e76948 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
#
4d846d26 |
| 10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause.
Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
show more ...
|
Revision tags: release/13.2.0, release/12.4.0 |
|
#
6f50b73e |
| 06-Jul-2022 |
Mitchell Horne <mhorne@FreeBSD.org> |
libpmc: add armv8 pmu-event aliases
These are all "standard microarchitectural events", which in theory are supported by every ARMv8 processor. In practice, it depends on the pmu-event definitions b
libpmc: add armv8 pmu-event aliases
These are all "standard microarchitectural events", which in theory are supported by every ARMv8 processor. In practice, it depends on the pmu-event definitions being complete and accurate, which they are not for every processor. Still, these aliases should be functional on the majority of systems.
PR: 254532 Reported by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35550
show more ...
|
#
e144cd92 |
| 02-Jun-2022 |
Alexander Motin <mav@FreeBSD.org> |
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 tr
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
show more ...
|
#
037dd0a9 |
| 31-May-2022 |
Alexander Motin <mav@FreeBSD.org> |
libpmc: Fix INVERT flag mapping for both Intel and AMD.
Looks like somebody's trivial copy/paste bug.
MFC after: 1 month
|
#
73b7b181 |
| 31-May-2022 |
Alexander Motin <mav@FreeBSD.org> |
libpmc: Disable hardcoding of Intel fixed counters.
Intel json's now have pretty reasonable fixed counters representation via event=0 and umask. Hardcoded values create more confusion than fix.
MF
libpmc: Disable hardcoding of Intel fixed counters.
Intel json's now have pretty reasonable fixed counters representation via event=0 and umask. Hardcoded values create more confusion than fix.
MFC after: 1 month
show more ...
|
Revision tags: release/13.1.0, release/12.3.0 |
|
#
a20c1089 |
| 30-Sep-2021 |
Mitchell Horne <mhorne@FreeBSD.org> |
libpmc: add some AMD pmu counter aliases
Make it mostly compatible with what's defined for Intel. Except where noted, these are defined for all of amdzen(1|2|3).
Reviewed by: emaste MFC after: 1 we
libpmc: add some AMD pmu counter aliases
Make it mostly compatible with what's defined for Intel. Except where noted, these are defined for all of amdzen(1|2|3).
Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32162
show more ...
|
#
937539e0 |
| 30-Sep-2021 |
Mitchell Horne <mhorne@FreeBSD.org> |
libpmc: fix the 'cycles' event alias on x86
Looking for "tsc-tsc" in the pmu tables will fail every time. Instead, make this an alias for the static TSC event defined in pmc_events.h. This fixes 'pm
libpmc: fix the 'cycles' event alias on x86
Looking for "tsc-tsc" in the pmu tables will fail every time. Instead, make this an alias for the static TSC event defined in pmc_events.h. This fixes 'pmcstat -s cycles' on Intel and AMD.
Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32197
show more ...
|
#
b48a2770 |
| 23-Jul-2021 |
Leandro Lupori <luporl@FreeBSD.org> |
powerpc64: add Power8 and Power9 PMCs
Add support to allocate Power8 and 9 PMCs.
Submitted by: Leonardo Bianconi <leonardo.bianconi@eldorado.org.br> Reviewed by: mhorne Sponsored by: Instituto d
powerpc64: add Power8 and Power9 PMCs
Add support to allocate Power8 and 9 PMCs.
Submitted by: Leonardo Bianconi <leonardo.bianconi@eldorado.org.br> Reviewed by: mhorne Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D31109
show more ...
|
#
27ea55fc |
| 22-Jul-2021 |
Mitchell Horne <mhorne@FreeBSD.org> |
libpmc/hwpmc: fix issues with arm64 pmu-events support
Due to a mis-merge, the changes committed to libpmc never called pmu_parse_event(), or set pm->pm_ev. However, this field shouldn't be used to
libpmc/hwpmc: fix issues with arm64 pmu-events support
Due to a mis-merge, the changes committed to libpmc never called pmu_parse_event(), or set pm->pm_ev. However, this field shouldn't be used to carry the actual pmc event code anyway, as it is expected to contain the index into the pmu event array (otherwise, it breaks event name lookup in pmclog_get_event()). Add a new MD field, pm_md.pm_md_config, to pass the raw event code to arm64_allocate_pmc().
Additionally, the change made to pmc_md_op_pmcallocate was incorrect, as this is a union, not a struct. Restore the proper padding size.
Reviewed by: luporl, ray, andrew Fixes: 28dd6730a5d6 ("libpmc: enable pmu_utils on arm64") Fixes: 8cc3815f02be ("hwpmc_arm64: accept raw event codes...") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31221
show more ...
|
#
28dd6730 |
| 27-May-2021 |
Mitchell Horne <mhorne@FreeBSD.org> |
libpmc: enable pmu_utils on arm64
This allows supported libpmc to query/select from the pmu-events table, which may have a more complete set of events than what we define manually. A future update t
libpmc: enable pmu_utils on arm64
This allows supported libpmc to query/select from the pmu-events table, which may have a more complete set of events than what we define manually. A future update to these definitions should greatly improve this support. The alias table is empty for now, until this future import is complete.
Add the Foundation's copyright for recent work on this file.
Reviewed by: ray (slightly earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30603
show more ...
|
#
0024f1aa |
| 31-May-2021 |
Mitchell Horne <mhorne@FreeBSD.org> |
libpmc: make libpmc_pmu_utils.c more amenable to porting
The current version has every function stubbed out for !x86. Only two functions (pmu_alias_get() and pmc_pmu_pmcallocate() are really platfor
libpmc: make libpmc_pmu_utils.c more amenable to porting
The current version has every function stubbed out for !x86. Only two functions (pmu_alias_get() and pmc_pmu_pmcallocate() are really platform dependent, so reduce the width of the ifdefs and remove some of the stubs.
Reviewed by: ray MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30532
show more ...
|
#
0c915023 |
| 31-May-2021 |
Mitchell Horne <mhorne@FreeBSD.org> |
libpmc: remove pe->alias
It has never been a part of upstream's struct pmu_event. The jevents utility will not fill this field, so remove it.
Reviewed by: gnn MFC after: 2 weeks Sponsored by: The F
libpmc: remove pe->alias
It has never been a part of upstream's struct pmu_event. The jevents utility will not fill this field, so remove it.
Reviewed by: gnn MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30530
show more ...
|
#
ec66cc95 |
| 31-May-2021 |
Mitchell Horne <mhorne@FreeBSD.org> |
libpmc: eliminate pmc_pmu_stat_mode()
There is a single consumer, the pmc utility, that clearly has knowledge of which counters it is expecting. Remove this function and have it use common counter a
libpmc: eliminate pmc_pmu_stat_mode()
There is a single consumer, the pmc utility, that clearly has knowledge of which counters it is expecting. Remove this function and have it use common counter aliases instead.
Reviewed by: gnn MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30528
show more ...
|
#
0092642f |
| 31-May-2021 |
Mitchell Horne <mhorne@FreeBSD.org> |
libpmc: remove unused 'isfixed' variable
Reviewed by: gnn, emaste MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30529
|
#
bc1a6a9d |
| 31-May-2021 |
Mitchell Horne <mhorne@FreeBSD.org> |
libpmc: fix "instructions" alias on Intel
The typo prevents the counter from being allocated.
This fixes e.g. pmcstat -s instructions sleep 5
Reviewed by: mizhka, gnn, ray, emaste MFC after: 5 day
libpmc: fix "instructions" alias on Intel
The typo prevents the counter from being allocated.
This fixes e.g. pmcstat -s instructions sleep 5
Reviewed by: mizhka, gnn, ray, emaste MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30527
show more ...
|
Revision tags: release/13.0.0, release/12.2.0 |
|
#
c7aa572c |
| 31-Jul-2020 |
Glen Barber <gjb@FreeBSD.org> |
MFH
Sponsored by: Rubicon Communications, LLC (netgate.com)
|
#
17996960 |
| 31-Jul-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r363583 through r363738.
|
#
24e337be |
| 28-Jul-2020 |
Ryan Moeller <freqlabs@FreeBSD.org> |
libpmc: Use known pmc_cpuid buffer size
Use the existing PMC_CPUID_LEN to size pmc_cpuid in the kernel and various buffers for reading it in libpmc. This avoids some extra syscalls and malloc/frees
libpmc: Use known pmc_cpuid buffer size
Use the existing PMC_CPUID_LEN to size pmc_cpuid in the kernel and various buffers for reading it in libpmc. This avoids some extra syscalls and malloc/frees.
While in here, use strlcpy to copy a user-provided cpuid string instead of memcpy, to make sure we terminate the buffer.
Reviewed by: mav MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D25679
show more ...
|
#
e2c0e292 |
| 16-Jul-2020 |
Glen Barber <gjb@FreeBSD.org> |
MFH
Sponsored by: Rubicon Communications, LLC (netgate.com)
|
#
1791cad0 |
| 14-Jul-2020 |
Alexander Motin <mav@FreeBSD.org> |
Add stepping to the kern.hwpmc.cpuid string on x86.
It follows the equivalent Linux change to be able to differentiate skylakex and cascadelakex, sharing the same model but not stepping.
This fixes
Add stepping to the kern.hwpmc.cpuid string on x86.
It follows the equivalent Linux change to be able to differentiate skylakex and cascadelakex, sharing the same model but not stepping.
This fixes skylakex handling broken by r363144.
MFC after: 6 days
show more ...
|
Revision tags: release/11.4.0 |
|
#
44e86fbd |
| 13-Feb-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r357662 through r357854.
|