The IRPERF MSR counter (0xc00000e9) exposes an instructions-retired count when read. Its support is advertised through CPUID leaf 0x80000008 EBX bit 1. If this bit is set, the CPU supports the IRPERF MSR. For it to be used by the system, bit 30 of the HWCR MSR (0xC0010015) needs to be enabled. This patch checks for availability of the feature and enables the bit. If the feature is available, the hwpmc PERF class detects its presence and registers a third PERF MSR counter that allows hwpmc users to measure instructions retired using IRPERF. This is AMD-only, as Intel does not support IRPERF. Due to erratum #1054 affecting AMD Zen 1 before model 30h, IRPERF is only enabled for AMD Zen 1 model 30h onwards and later microarchitectures. This commit also implements a validation step to make sure the IRPERF counter is actually incrementing; otherwise, the feature is not enabled. This guarantees it is working as expected before being made available to the system and users. To support this, the perf_pmcdesc[] structure changed from being statically initialized with 2 entries (MPERF/APERF) to being populated dynamically. If both MPERF/APERF and IRPERF are supported, the structure will contain three entries: MPERF, APERF, and IRPERF. Each entry now also carries its own MSR address and PMC event, so perf_read_pmc() reads the MSR to use from the matching perf_pmcdesc[] entry at runtime instead of switching over a fixed set of row indices. Definitions for the features available on the HWCR MSR did not previously exist. This commit adds macros for those features, including HWCR_IRPERFEN. The MSR definition for MSR_IRPERF was also missing and has now been added. This commit also updates the manual page accordingly. Signed-off-by: Anderson Nascimento <[email protected]> Reviewed by: mhorne, adrian Sponsored by: AMD Differential Revision: https://reviews.freebsd.org/D59554
FreeBSD Source:
This is the top level of the FreeBSD source directory.
FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms. A large community has continually developed it for more than thirty years. Its advanced networking, security, and storage features have made FreeBSD the platform of choice for many of the busiest web sites and most pervasive embedded networking and storage devices.
For copyright information, please see the file COPYRIGHT in this directory. Additional copyright information also exists for some sources in this tree - please see the specific source directories for more information.
The Makefile in this directory supports a number of targets for building components (or all) of the FreeBSD source tree. See build(7), config(8), FreeBSD handbook on building userland, and Handbook for kernels for more information, including setting make(1) variables.
For information on the CPU architectures and platforms supported by FreeBSD, see the FreeBSD website's Platforms page.
For official FreeBSD bootable images, see the release page.
Source Roadmap:
| Directory | Description |
|---|---|
| bin | System/user commands. |
| cddl | Source code for third-party software under the Common Development and Distribution License. |
| contrib | Source code for third-party software. |
| crypto | Source code for cryptographic libraries and commands (see crypto/README). |
| etc | Template files for /etc. |
| include | System include files. |
| kerberos5 | Build system for Kerberos 5 (Heimdal). |
| krb5 | Build system for Kerberos 5 (MIT). |
| lib | System libraries. |
| libexec | System commands intended to be executed by other commands or daemons. |
| packages | Base system packages. |
| release | Makefiles and scripts used for building releases and VM images. |
| rescue | Build system for statically linked /rescue commands. |
| sbin | System commands. |
| secure | Build system for cryptographic libraries and commands (excluding Kerberos). |
| share | Shared resources. |
| stand | Boot loader sources. |
| sys | Kernel sources (see sys/README.md). |
| targets | Support for experimental DIRDEPS_BUILD |
| tests | Tests which can be run by Kyua. See tests/README for additional information. |
| tools | Ancillary utilities and tests (not included in the build). |
| usr.bin | User commands. |
| usr.sbin | System administration commands. |
For information on synchronizing your source tree with one or more of the FreeBSD Project's development branches, please see FreeBSD Handbook.