hwpstate_amd(4): Rename '*set_autonomous_hwp*()' => 'enable_cppc*()'
This is to better reflect that we are really enabling CPPC in these
functions and because we are likely to stop activating CPPC autonomous
mode by default in the near future.
No functional change (intended).
Sponsored by: The FreeBSD Foundation
hwpstate_amd(4): Rename PSTATE_CPPC internal flag
While here, also rename check_cppc_enabled() => check_cppc_in_use().
No functional change (intended).
Sponsored by: The FreeBSD Foundation
hwpstate_amd(4): Style: Align 'machdep.hwpstate_amd_cppc_enable'
Align it like the rest.
No functional change (intended).
Sponsored by: The FreeBSD Foundation
hwpstate_amd(4): Add knobs to get/set all fields of CPPC_REQUEST
This will allow experimentations and finer-grained tuning to the full
extent allowed by the hardware, which is especially important given that
the spec leaves to hardware implementors an important leeway in
interpreting CPPC's numeric parameters, causing the same settings to
have different effects on different CPU models.
PR: 292615
Reviewed by: aokblast (older version)
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55010
hwpstate_amd(4): 'epp' sysctl leaf to operate on real EPP hardware values
We were using percents, for compatibility with hwpstate_intel(4), but
this looses granularity that might be important in some scenarios or
with specific CPU models.
For consistency, hwpstate_intel(4) should be changed accordingly, at the
expense of breaking compatibility.
For release notes: Introduction of hwpstate_amd(4) deserves a release
note, even if the original commit was not tagged. Functionality
introduced by recent commits tagged with "Relnotes" should be mentioned
along that one.
PR: 292615
Reviewed by: aokblast
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55009
hwpstate_amd(4): Factor out setting the CPPC_REQUEST register
In preparation for creating other knobs to tweak values in this register
beyond just the EPP (Efficiency/Performance Preference).
While here, add a herald comment before the softc structure indicating
how we achieve atomicity when modifying the softc.
Reviewed by: aokblast
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55008
hwpstate_amd(4): attach(): More diagnostic on CPPC enable
When the 'debug.hwpstate_verbose' tunable/sysctl knob is set, dump the
initial content of the CPPC_CAPABILITY_1 and CPPC_REQUEST registers.
If, after enabling CPPC, reading/writing some MSR fails during the attach
sequence, print a diagnostic. However, once CPPC is enabled, we cannot
go back (disabling it is impossible), so we'll attach even if fiddling
with other MSRs failed.
While here, move diagnostic printing on attach out of the callback that
is executed on (potentially) another CPU and with interrupts disabled,
putting it into the attach routine itself.
While here, fix format for printing the CPU ID.
PR: 292615
Reviewed by: aokblast (older version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55006
hwpstate_amd(4): Sane defaults for min/max perf on insane capabilities
If the CPPC_CAPABILITY_1 register stays at its reset value (0) even
after enabling CPPC, as observed in the field (see the referenced PR
below), use sane min/max performance limits as hinted by the ACPI spec,
i.e., all 0s for the minimum value and all 1s for the maximum one.
While here, let's cope upfront with some more insane situations, where
the minimum value would be greater than the maximum one, but also if
they would be equal which does not seem to make sense at all in the CPPC
frame (and, anyway, in this case, the actual minimum and maximum values
we program should have no effect at all). That last case actually also
covers the one exposed in the previous paragraph.
PR: 292615
Reviewed by: aokblast
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55007
hwpstate_amd(4): Register dump: Fine-grained error reporting
If some of the registers cannot be read, report that but continue trying
reading the others. This also has the side benefit of simplifying code.
While here, use sbuf_new_for_sysctl(), and rename 'res' and 'ret', which
are to contain error values, to 'error'.
While here, remove the test on getting the per-cpu structure, as if it
is not present we would have already crashed on device attach.
While here, fix format for printing the CPU ID.
PR: 292615
Reviewed by: aokblast (older version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55005
ls: check fts_children() for errors that may not surface otherwise
In particular, if one simply does a non-recursive `ls` on a directory
that is not accessible, there are some classes of errors that may cause
it to fail that wouldn't be surfaced unless we do an fts_read() that
will recurse into the inaccessible directory. Catch those kinds of
errors here since we cannot expect to an FTS_ERR/FTS_DNR entry to follow
up on them.
PR: 287451
Reviewed by: kib
Discusssed with: des
Differential Revision: https://reviews.freebsd.org/D51056
pw: make manual page more friendly for uid/gid search
pw.8 structure is quite different from usual manual page, especially in
describing -o option usage. Specifically, these paragraphs do not
contain "uid/gid" terms, and have "user id"/"group id" instead,
making searching for "override duplicate safety belt" difficult.
Try to simplify such searches.
Also, clarify uid/gid space between 100 and 1000 as "somewhat special",
as it actually is.
Discussed on: russian telegram FreeBSD group
Reviewed by: eugen, novel
MFC after: 1 week
lagg: Avoid dropping locks when starting the interface
The init routine of a lagg(4) interface will not change during the whole
lifecycle. So we can call lagg_init() directly instead of through the
function pointer. Well, that requires a drop and pickup lock, which
unnecessarily expose a small race window. Refactor lagg_init() into
lagg_init_locked() and call the later one to avoid that.
Meanwhile, delay updating the driver managed status until after the
interface is really ready.
Reviewed by: markj
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D55198
diff: Improve directory loop detection
When we're done processing a directory, remove its entry from the tree
of visited inodes, ensuring that we only report a loop when we encounter
a descendant-to-ancestor link, not when we encounter a cousin-to-cousin
or sibling-to-sibling link.
MFC after: 1 week
Reported by: Bakul Shah <bakul at iitbombay.org>
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D55248
install: Expect EINTR while copying
Both copy_file_range() and read() / write() in our fallback loop can be
interrupted before copying anything at all, in which case it returns -1
and sets errno to EINTR. If that happens, we should retry, not fail.
While here, drop the size argument from copy() (we always want to copy
the entire file anyway) and add test cases which exercise the metalog
and digest functionality.
PR: 293028
MFC after: 1 week
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D55168
cp: Expect EINTR while copying
Both copy_file_range() and copy_fallback() can be interrupted before
they have read anything at all, in which case they return -1 and set
errno to EINTR. If that happens, we should retry, not fail.
PR: 293028
MFC after: 1 week
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D55167
amd64: add LASS support
In short, LASS enforces all kernel memory accesses to have bit 63 set to
1, and all userspace accesses have bit 63 set to 0. Violations of these
rules cause #GP. There are natural loopholes, like SMAP with rflags.AC=1
allows kernel to access userspace.
Enablement is simple, we need to set CR4.LASS bit on all CPUs. There
are complications when kernel has to execute code at low addresses, e.g.
for la57 trampoline, or calling into EFI RT. The patch turns CR4.LASS
off around these regions.
LASS is officially documented in SDM, since at least rev. 085, October
2024. Tested in simics.
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D55218
freebsd-update: Error for -b basedir without UNAME_r set
freebsd-update sets the currently running release from UNAME -r, which
can be overridden via the --currently-running commandline option (or by
setting UNAME_r in the environment). This may be invalid if -b is used
to specify a basedir other than /, so error out if -b is specified
without setting the currently running version.
PR: 283229
Reviewed by: cperciva
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48016
libfetch: Check for failure to create SSL context
* Drop the ssl_meth member, there is no reason to hang on to it.
* Replace deprecated SSLv23_client_method() with TLS_client_method().
* Check the return value from SSL_CTX_new().
MFC after: 1 week
PR: 292903
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D55098
(cherry picked from commit 4e160c6197f75fda3d5d5997ce893087058cf718)
lagg: Remove the member pr_num from struct lagg_proto
It is set but never used. Remove it to avoid confusion and save a
little space.
While here, use designated initializers to initialize the LAGG protocol
table. That improves readability, and it will be safer to initialize the
table if we introduce new protocols in the future.
No functional change intended.
Reviewed by: glebius
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D55124
(cherry picked from commit 5ba503fc2cabc1a614997f102ace671d996bcc53)
qlnxe: Overhaul setting the multicast MAC filters
When operating the multicast MAC filters, the current usage of
ECORE_FILTER_ADD and ECORE_FILTER_REMOVE are rather misleading.
ECORE_FILTER_ADD reads "adding new filter", but it actually removes
any existing filters and then addes a new one. ECORE_FILTER_REMOVE
reads "removing a filter", but it actually removes all filters.
Let's use ECORE_FILTER_REPLACE and ECORE_FILTER_FLUSH instead to
avoid confusion.
In the current implementation, only one MAC address is passed to
ecore_sp_eth_filter_mcast() and any previously installed filters are
removed, hence it breaks the multicast function. That can be observed
via either assigning new IPv6 addresses to the interface or putting
the interface as a member of lagg(4) interface with LACP aggregation
protocol. Fix that by calculating the multicast filter bins directly
from multicast MAC addresses and replace the filters every time
the bins changes.
[20 lines not shown]
lagg: Make the none protocol a first-class citizen
All the other protocols have corresponding start and input routines,
which are used in the fast path. Currently the none protocol is
treated specially. In the fast path it is checked to indicate whether
a working protocol is configured. There are two issues raised by this
design:
1. In production, other protocols are commonly used, but not the
none protocol. It smells like an overkill to always check it in the
fast path. It is unfair to other commonly used protocols.
2. PR 289017 reveals that there's a small window between checking the
protocol and calling lagg_proto_start(). lagg_proto_start() is possible
to see the none protocol and do NULL deferencing.
Fix them by making the none protocol a first-class citizen so that it
has start and input routines just the same as other protocols. Then we
can stop checking it in the fast path, since lagg_proto_start() and
[15 lines not shown]
qlnxe: Allow tapping the TX packets
Currently only the packets in the RX path can be captured by tcpdump
as the ETHER_BPF_MTAP call in the TX path is missing. Add it so that
packets in both directions can be captured.
PR: 290973
Reviewed by: kbowling
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D54891
(cherry picked from commit 968647502ec21464ad3aecc7577ff0e8dfd41693)
qlnxe: Refactor setting the promiscuous and allmulti mode
There are two entry points to set the promiscuous and allmulti mode.
One is ioctl, and another is the init routine. Given they share almost
the identical logic, refactor a little to make the code more clear.
While here, for the ioctl, translate the error to EINVAL to avoid
confusing the net stack.
Reviewed by: kbowling
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D54890
(cherry picked from commit 45b1718fadae7d56051ba04ef9d7a175a602a226)