=== Performance Monitoring Counters Contact: Mitchell Horne This quarter, some improvements were made to the `pmc(3)` library and `hwpmc(4)` kernel module. Background: Traditionally, PMC event codes have been defined manually in the `sys/dev/hwpmc/pmc_events.h` header and compiled statically into the kernel. These definitions provide a translation between an event's name and its encoding and are leveraged by PMC tools like `pmcstat(8)` via the `pmc(3)` library. In 2018, a new source of truth for event definitions was introduced for the amd64 and i386 architectures, which is the pmu-events tables. These are a set of json files, maintained by the Linux kernel, which are compiled directly into libpmc and provide a more complete set of event definitions. The main result of this work was porting the use of the pmu-events definitions to arm64. Some minor refactoring to libpmc was performed, making porting to other platforms in the future easier. A few small bugs were found and fixed along the way; notably, the "instructions" alias for `pmcstat(8)` should work again on Intel CPUs. The ability was added to query the legacy event tables when pmu-events does not contain the desired event, restoring the ability to use the `pmc.soft(3)` events on x86. Finally, event definitions for newer AMD Zen3 CPUs were imported (credits: Greg V). An larger update of the PMU event definitions is planned for Q3 of 2021. This will bring us in sync with 3 years of updates for x86 CPUs and greatly increase the number of events available on arm64 platforms. Those who make regular or occasional use of FreeBSD's PMC tools are encouraged to test their typical workflow and report any regressions. Sponsor: The FreeBSD Foundation