hwpmc: add MPERF/APERF MSR support for AMD/Intel CPUs
Add support for reading the MPERF (MSR 0xE7) and APERF (MSR 0xE8)
model-specific registers on AMD/Intel CPUs through hwpmc(4). These
counters track maximum and actual performance frequency respectively,
and are used to compute effective CPU frequency scaling independent
of the nominal TSC rate. The name of the class was chosen as PERF
because later support for other PERF MSRs can be added to the same
class.
Extend libpmc(3) to expose the AMD/Intel MPERF/APERF counters added
to hwpmc(4) in the companion kernel change, so userland consumers
(pmcstat(8), etc.) can allocate and read these events by name.
Document the new PERF class and its MPERF/APERF counters in a new
pmc.perf.3 manual page, describing their semantics and how to read
them via pmc(3) and pmcstat(8).
Bump PMC_VERSION_MINOR.
[6 lines not shown]
pfctl(8): Remove superflous parenthesis
Since apropos(8) uses case-insensitive regular expressions by default
for both manpage names and descriptions, pfctl appears in results
regardless of the parenthetical initialism.
MFC after: 1 week
Reported by: ziaee@
tpm: crb: make the Pluton startmethod more resilient
The original implementation assumed that the start/reply doorbells
lived within the device _CRS space, but that isn't always the case. On
my AMD Ryzen 7640U-based frame.work laptop, device memory runs from
0xc0500000-0xc0500fff while the doorbells are up around 0xc0508000.
Stop sanity checking the addresses and just map them in to work reliably
whether they're within the device range or not.
pluton_wait_reply is cribbed from tpm_wait_for_u32, but rewritten
slightly to read in just one place and to read one last time before
giving up at the end of the timeout, just in case.
Reviewed by: kbowling
Differential Revision: https://reviews.freebsd.org/D59327
syslogd/tests: Amend a test to catch leaked process descriptors
This serves to catch the regression fixed by commit
1a669b66ddb4 ("syslogd: reap pipe children on config reload").
MFC after: 1 week
(cherry picked from commit 231dfc99a08874c269593c2e491ce16a618f4ed6)
syslogd: reap pipe children on config reload
On SIGHUP reload, closelogfiles() frees each F_PIPE filed even when its
pipe process is still running. close_filed() sets f_type to F_UNUSED
before the check, so the condition f_type != F_PIPE is always true and
the filed is freed while its process descriptor is still on the dead
queue and registered in the kqueue. When the child later exits, the
NOTE_EXIT handler dereferences the freed filed (use-after-free) and
never closes the process descriptor, leaving the pipe child as a
persistent zombie.
Capture whether the filed is a pipe with an active process descriptor
before calling close_filed(), and defer the free in that case so the
NOTE_EXIT handler can reap the child and free the filed.
Reviewed by: markj
Fixes: 95381c0139d6 (syslogd: Use process descriptors)
Differential Revision: https://reviews.freebsd.org/D59319
(cherry picked from commit 1a669b66ddb4748c24116e32dcb51eabaf4859ed)
pf: Re-optimize state key handling
pf states may be looked up using one of two keys: the stack key or the
wire key. For states involving address translation, these will be
distinct; the stack key describes the addresses seen by the local
network stack, and the wire key has the translated addresses.
Historically, pf would avoid allocating separate keys if both are
identical. This changed in commit fcdb520c1b4e ("pf: nat64") to always
allocate separate state key structures. Incidentally, OpenBSD seems to
maintain the optimization, but also has an explicit reference count
embedded in state keys.
The change breaks another optimization: pf_state_key_attach() still uses
state key pointer equality to check whether the stack and wire keys are
equal, so those checks are always false after the aforementioned commit.
Thus we never skip the second key lookup, even when that's possible
(i.e., no address translation is involved).
[15 lines not shown]
universe.sh: add MK_BEARSSL build
BEARSSL is disabled by default, add this here to make sure it doesn't
break.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D59516
universe.sh: build with 1.5 * ncpu jobs
Build with 1.5 * ncpu jobs instead of hardcoding 40.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D59515
vmimage.subr: Use makefs -N
By default, makefs uses the host environment's user and group databases
when creating filesystems. This causes makefs to fail when trying to
create files owned by users or groups which don't exist in the host
environment, for example when creating a VM with packages pre-installed
which added their own users/groups.
Pass "-N ${DESTDIR}/etc" to makefs to point it at the user and group
databases from the image being created.
MFC after: 1 week
Sponsored by: Amazon
(cherry picked from commit 7ca0c1eba2e4c49ac92499ef0f6adf27c8b930d4)
lib/msun amd64: use AVX FMA instructions for fma(3) and fmaf(3) when available
Utilize the ARCHLEVEL framework from libc/amd64/string to provide the
way for runtime selection of the implementation, if wanted.
Reviewed by: fuz, kfv
Discussed with: kargl
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D59462
lib/msun: move the calculation of LIBC_SRCTOP earlier
which makes the variable available for machine/Makefile.inc usage.
Reviewed by: fuz, kfv
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D59462