FreeBSD/src 5369f8elib/libpmc libpmc.c pmc.perf.3, sys/dev/hwpmc hwpmc_amd.c hwpmc_intel.c

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]
DeltaFile
+360-0sys/dev/hwpmc/hwpmc_perf.c
+132-0lib/libpmc/pmc.perf.3
+31-0lib/libpmc/libpmc.c
+28-0sys/dev/hwpmc/hwpmc_perf.h
+18-0sys/dev/hwpmc/hwpmc_intel.c
+16-0sys/dev/hwpmc/hwpmc_amd.c
+585-07 files not shown
+613-313 files

FreeBSD/src 7324487tools/boot universe.sh

universe.sh: don't overwrite no_zfs's build log

Give the WITHOUT_LOADER_BIOS_TEXTONLY build its own log file.
DeltaFile
+1-1tools/boot/universe.sh
+1-11 files

FreeBSD/src 0e3dae1tests/sys/fs/fusefs utils.cc Makefile

tests/fusefs: fix the build with gcc 16

Reviewed by:    asomers
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
DeltaFile
+7-0tests/sys/fs/fusefs/Makefile
+1-1tests/sys/fs/fusefs/utils.cc
+8-12 files

FreeBSD/src 84eac60sbin/pfctl pfctl.8

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@
DeltaFile
+1-1sbin/pfctl/pfctl.8
+1-11 files

FreeBSD/src 6af3031sys/dev/tpm tpm_crb.c

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
DeltaFile
+88-29sys/dev/tpm/tpm_crb.c
+88-291 files

FreeBSD/src 74c5995usr.sbin/syslogd/tests syslogd_test.sh

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)
DeltaFile
+7-0usr.sbin/syslogd/tests/syslogd_test.sh
+7-01 files

FreeBSD/src 266331csys/netpfil/pf pf_lb.c pf.c

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]
DeltaFile
+15-10sys/netpfil/pf/pf.c
+10-1sys/netpfil/pf/pf_lb.c
+25-112 files

FreeBSD/src 8cf0058usr.sbin/syslogd syslogd.c

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)
DeltaFile
+9-5usr.sbin/syslogd/syslogd.c
+9-51 files

FreeBSD/src 1de79e7tools/boot universe.sh

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
DeltaFile
+12-0tools/boot/universe.sh
+12-01 files

FreeBSD/src bac0daatools/boot universe.sh

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
DeltaFile
+1-1tools/boot/universe.sh
+1-11 files

FreeBSD/src 35c935brelease/tools vmimage.subr

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)
DeltaFile
+1-1release/tools/vmimage.subr
+1-11 files

FreeBSD/src a63319erelease/tools vmimage.subr

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)
DeltaFile
+1-1release/tools/vmimage.subr
+1-11 files

FreeBSD/src 18a5549lib/msun/amd64 Makefile.inc s_fma_avx.S, lib/msun/src s_fmaf.c s_fma.c

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
DeltaFile
+24-0lib/msun/amd64/s_fma_avx.S
+24-0lib/msun/amd64/s_fmaf_avx.S
+10-1lib/msun/src/s_fmaf.c
+10-1lib/msun/src/s_fma.c
+8-1lib/msun/amd64/Makefile.inc
+76-35 files

FreeBSD/src b45fd24lib/msun Makefile

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
DeltaFile
+5-4lib/msun/Makefile
+5-41 files

FreeBSD/src 4fb4be7usr.bin/sort sort.1.in

sort.1: Fix default memory buffer size

PR:             261496
Fixes:          554442439dd0 ("Change the memory heuristics")
MFC after:      3 days
Reported by:    wosch
DeltaFile
+1-1usr.bin/sort/sort.1.in
+1-11 files

FreeBSD/src ae45851share/misc bsd-family-tree

bsd-family-tree: add NetBSD 9.5 and FreeBSD 14.5
DeltaFile
+41-37share/misc/bsd-family-tree
+41-371 files

FreeBSD/src b60c523sys/arm64/arm64 busdma_bounce.c

arm64: busdma_bounce: Only use bufzone if it can meet requested alignment

Reported by:    alc
Tested by:      alc
Reviewed by:    andrew
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D59476
DeltaFile
+1-1sys/arm64/arm64/busdma_bounce.c
+1-11 files

FreeBSD/src e8aebacsys/arm64/acpica acpi_iort.c, sys/dev/acpica acpivar.h

sys: arm64: acpica: Add support for GICv5 ITS & IWB nodes

Reviewed by:    andrew
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D59168
DeltaFile
+129-15sys/arm64/acpica/acpi_iort.c
+2-0sys/dev/acpica/acpivar.h
+131-152 files

FreeBSD/src 5d57f8asys/arm64/include armreg.h

arm64: Fix definition of CLIDR_EL1_op0

Fix incorrect opcode on CLIDR_EL1.

Signed-off-by: Kajetan Puchalski <kajetan.puchalski at arm.com>
Reviewed by:    andrew
Sponsored by:   Arm Ltd
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2400
DeltaFile
+1-1sys/arm64/include/armreg.h
+1-11 files

FreeBSD/src 038843asys/arm64/arm64 gicv5reg.h

arm64: Add GICv5 GSI definitions

Reviewed by:    andrew
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D59170
DeltaFile
+15-0sys/arm64/arm64/gicv5reg.h
+15-01 files

FreeBSD/src a890eb4sys/arm64/vmm/io vgic_v3_reg.h

arm64/vmm: vgic_v3: Fix value of ICH_VTR_EL2.PREbits

ICH_VTR_EL2.PREbits contains the number of virtual preemption bits
implemented minus one, analogous to ICH_VTR_EL2.PRIbits. Unlike PRIbits,
the macro for PREbits does not account for "minus one". Make the two match.

Signed-off-by: Kajetan Puchalski <kajetan.puchalski at arm.com>
Reviewed by:    andrew
Sponsored by:   Arm Ltd
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2391
DeltaFile
+1-1sys/arm64/vmm/io/vgic_v3_reg.h
+1-11 files

FreeBSD/src 728d9f3sys/arm64/arm64 pmap.c

arm64/pmap: Fix invalidate_icache condition in stage2 fault

pmap_stage2_fault is supposed to invalidate the icache if it is
accessing an executable page. Instead, the condition currently checks
whether execution is disallowed at any EL. Make it check whether
execution is allowed at any EL to match the intended behaviour.

Signed-off-by: Kajetan Puchalski <kajetan.puchalski at arm.com>
Reviewed by:    andrew
Sponsored by:   Arm Ltd
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2416
DeltaFile
+1-1sys/arm64/arm64/pmap.c
+1-11 files

FreeBSD/src d9106d7sys/arm64/include armreg.h

arm64: Remove ID_AA64PFR0_GIC_BITS

It's unused since 05f6f65c3bda ("arm64: add CHECK_CPU_FEAT() for
checking feature support in assembly"). It's been replaces with a
commonly named ID_AA64PFR0_GIC_WIDTH macro.

Reviewed by:    Kajetan Puchalski <kajetan.puchalski at arm.com>
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D59177
DeltaFile
+0-1sys/arm64/include/armreg.h
+0-11 files

FreeBSD/src 4837a14sys/arm64/arm64 identcpu.c, sys/arm64/include armreg.h

arm64: Fix the ID_AA64MMFR1_EL1.CMOW name

This was incorrectly names CMOVW. Remove the unneeded 'V'.

Reviewed by:    Kajetan Puchalski <kajetan.puchalski at arm.com>
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D59175
DeltaFile
+6-6sys/arm64/include/armreg.h
+3-3sys/arm64/arm64/identcpu.c
+9-92 files

FreeBSD/src fe659a8sys/arm64/arm64 exec_machdep.c debug_monitor.c, sys/arm64/include armreg.h

arm64: Rename some ID_AA64DFR0_EL1 macros

These macros are used to extract the number of breakpoints and
watchpoints from the register. Rename them to not conflict with the
common meaning of an _VAL macro in this file.

Reviewed by:    Kajetan Puchalski <kajetan.puchalski at arm.com>
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D59178
DeltaFile
+4-4sys/arm64/vmm/vmm_hyp.c
+3-3sys/arm64/include/armreg.h
+2-2sys/arm64/arm64/exec_machdep.c
+2-2sys/arm64/arm64/debug_monitor.c
+11-114 files

FreeBSD/src 5c9daa5sys/arm64/include armreg.h, sys/arm64/vmm/io vgic_v3.c

arm64: Add ICC_SGI1R_IRM_VAL and use it

This will be the name of the generated macro. As we only need to check
if this field is set or not use the common ICC_SGI1R_IRM_VAL name.

Reviewed by:    Kajetan Puchalski <kajetan.puchalski at arm.com>
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D59179
DeltaFile
+4-1sys/arm64/include/armreg.h
+1-1sys/arm64/vmm/io/vgic_v3.c
+5-22 files

FreeBSD/src e1f684asys/arm64/arm64 gic_v3.c, sys/arm64/include armreg.h

arm64: Fix the ICC_SGI1R_EL1 field names

Use the field names from the Arm Documentation for the ICC_SGI1R_EL1
register. These will later be generated from a BSD Licensed JSON file
so to reduce the diff for that rename now.

Reviewed by:    Kajetan Puchalski <kajetan.puchalski at arm.com>
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D59174
DeltaFile
+19-19sys/arm64/include/armreg.h
+8-7sys/arm64/vmm/io/vgic_v3.c
+4-4sys/arm64/arm64/gic_v3.c
+31-303 files

FreeBSD/src 93a08bfsys/arm64/apple apple_aic.c, sys/arm64/include armreg.h

arm64: Move the CNTV_CTL_EL0 fields to armreg.h

They are architecturally defined, so should be in the common location.

Reviewed by:    emaste, Kajetan Puchalski <kajetan.puchalski at arm.com>
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D59181
DeltaFile
+0-3sys/arm64/apple/apple_aic.c
+3-0sys/arm64/include/armreg.h
+3-32 files

FreeBSD/src deb43dasys/arm64/arm64 locore.S machdep.c, sys/arm64/include armreg.h

arm64: Fix the capitalization of CurrentEL

Use the same capitalization as the Arm documentation.

Reviewed by:    Kajetan Puchalski <kajetan.puchalski at arm.com>
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D59180
DeltaFile
+6-6sys/arm64/include/armreg.h
+3-3sys/arm64/arm64/machdep.c
+2-2sys/arm64/arm64/locore.S
+11-113 files

FreeBSD/src 747c377stand/arm64/libarm64 cache.c, sys/arm64/arm64 identcpu.c

arm64: Fix the CTR_EL0 field names

Use the field names from the Arm Documentation for the CTR_EL0
register. These will later be generated from a BSD Licensed JSON file
so to reduce the diff for that rename now.

Reviewed by:    Kajetan Puchalski <kajetan.puchalski at arm.com>
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D59173
DeltaFile
+19-19sys/arm64/arm64/identcpu.c
+16-16sys/arm64/include/armreg.h
+1-1sys/arm64/vmm/vmm_nvhe.c
+1-1stand/arm64/libarm64/cache.c
+37-374 files