With commit 110113bc086f, vnet sysctl variables can be loader tunable
but the feature is limited. When the kernel modules have been initialized,
any changes (e.g. via kenv) to kernel environment variable will not affect
subsequently created VNETs.
This change relexes the limitation by listening on kernel environment
variable's set / unset events, and then update the 'master' copy of vnet
SYSCTL or restore it to its initial value.
With this change, TUNABLE_XXX_FETCH can be greately eliminated for vnet
loader tunables.
Andrew Turner [Mon, 18 Sep 2023 16:34:51 +0000 (17:34 +0100)]
arm64: Fix errata workarounds that depend on smccc
Some arm64 errata depend on calling into the firmware via the SMCCC
interface. This needs to happen after the psci driver has attached
as they share the interface.
Fix this by allowing the workarounds to mark when they depend on
device drivers attaching.
This is only an issue on CPU 0 as the workarounds are applied later
for the non-boot CPUs.
Reviewed by: emaste
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D41916
It is useful to be able to run rpcbind in foreground mode when
starting from launcher applications. The existing debug flag
is not sufficient as it enables additional debug messages.
Newer Thinkpads come with trackpoints from different vendors. They
are mostly compatible with the original one. Not sure all features
are going to work, but at least this fixes resume operation.
Tested on: Thinkpad X1 Carbon 7th Gen
Reviewed by: wulf, imp
Diffrential Revision: https://reviews.FreeBSD.org/D41871
Sean Lim [Mon, 18 Sep 2023 23:56:30 +0000 (18:56 -0500)]
Cleanup pthread locks in ofed RDMA verbs
On FreeBSD, pthread mutex, cond, and spinlocks allocate memory. On
Linux-based systems, these calls do not allocate memory. So there was a
safe assumption that the ofed RDMA verb calls do not need to explicitly
destroy the pthread locks. This assumption is false on FreeBSD. So let
us rearrange the code to cleanup the pthread locks.
Simon J. Gerraty [Mon, 18 Sep 2023 18:40:07 +0000 (11:40 -0700)]
Update jobs.mk to leverage -jC
With bmake-20230909 we can use -j1.5C to use 1.5*ncpu
bmake will set .MAKE.JOBS.C=yes if this is supported,
and in that case jobs.mk will use JOB_MAX_C as default for JOB_MAX.
Remove logic from local.sys.mk which is now handled by jobs.mk
Also use latest dirdeps-targets.mk and meta.{autodep,subdir}.mk
- pclk and hclk are mandatory so always try to get them.
Don't make it fatal if it fails as some platform (like Zynq) don't
have a proper clock driver.
- Always use pclk for the reference clock.
- Try to get all the possible clocks and enable them.
Reviewed-by: mhorne
Tested-by: Milan Obuch <bsd@dino.sk>
Differential Revision: https://reviews.freebsd.org/D41857
Sponsored by: Beckhoff Automation GmbH & Co. KG
- Remove cdns,gem, it's the generic binding but for all platform that include
this one we need specific drivers setup so remove it.
- Remove cdns,macb, it's the generic binding for Atmel AT91 which we don't suport
- Remove cadence,gem, it's not an official binding and seems to be only used in some
obscure ARM11 SoC.
- Note that the cdns,zynq* are deprecated
- Add the new Xilinx compatible for zynq and zynqmp
Reviewed-by: mhorne
Tested-by: skibo, Milan Obuch <bsd@dino.sk>
Differential Revision: https://reviews.freebsd.org/D41856
Sponsored by: Beckhoff Automation GmbH & Co. KG
sdhci: fdt: Correctly export clock per the binding
The binding says that we can have one or two clocks to export.
The first one is the actual sdclock while the second is the sample clock.
Both have the same parent, clk_xin.
Correctly export the clocks for RK3399 and ZynqMP.
No need to use a high ID as before, we have our own clock domain so use
ids starting at 1 as all exported clocks should be.
The ZynqMP SoC have a MCU running a firmware to control clocks, resets,
fpga loading etc ...
Add a driver that can be use to communicate with it.
For now only the clock and reset part are implemented.
Ed Maste [Sat, 16 Sep 2023 20:46:16 +0000 (21:46 +0100)]
freebsd-update: do not restart sshd when updating jail/basedir
In 6cd1bc531609 for PR 263489 I changed freebsd-update to restart sshd
after upgrade, to avoid an upgrade-related incompatibility that made it
impossible to login.
This is intended to avoid losing access to remote hosts, and ought not
apply to upgrading jails (from outside).
PR: 263489, 272282
Reported by: otis
Reviewed by: otis, kevans
MFC after: 3 days
Sponsored by: The FreeBSD Foundation Fixes: 6cd1bc531609 ("freebsd-update: restart sshd after upgrade")
Differential Revision: https://reviews.freebsd.org/D41890
Summary:
Provide an implementation of fpu_kern_enter/fpu_kern_leave for PPC to
enable FPU, VSX, and Altivec usage in-kernel. The functions currently
only support FPU_KERN_NOCTX, but this is sufficient for ossl(1) and many
other users of the API.
This patchset has been tested on powerpc64le using a modified version of
the in-tree tools/tools/crypto/cryptocheck.c tool to check for FPU/Vec
register clobbering along with a follow-up patch to enable ossl(4) on
powerpc64*.
* VERSION (_MAKE_VERSION): 20230909
Merge with NetBSD make, pick up
o main.c: allow -j to compute a multiple of ncpu
If _SC_NPROCESSORS_ONLN is supported; and -j arg is a floating
point number or ends in 'C' compute .MAKE.JOBS as a multiple of
_SC_NPROCESSORS_ONLN
.MAKE.JOBS.C will be "yes" if -jC is supported
2023-08-20 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230820
Merge with NetBSD make, pick up
o make.1: note that :localtime is better for %s
o parse.c: improve error messages for invalid input.
o var.c: fix for %s:L:gmtime - set TZ=UTC and use localtime to get
correct result, it is still better to use %s:L:localtime.
2023-08-18 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230818
Merge with NetBSD make, pick up
o meta.c: meta_ignore - check raw path against metaIgnorePaths
to potentially skip call to realpath.
o var.c: be strict when parsing the argument of the ':mtime' modifier
o unit-tests/varmod-mtime.mk: document why '${%s:L:localtime}'
should be used to get an equivalent value to time(3).
2023-08-16 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230816
Merge with NetBSD make, pick up
o cond.c: clean up multiple-inclusion guards
2023-07-25 Simon J Gerraty <sjg@beast.crufty.net>
* unit-tests/Makefile: addd varmod-localtime to BROKEN_TESTS
if configure cannot work out how to control TZ.
Remove varmod-localtime from BROKEN_TESTS for IRIX*
* configure.in: fix the test for wether TZ=Europe/Berlin works.
Depending on the time of year, if run between 22:00 and 00:00 UTC
the check in configure would fail incorrectly.
Take the day into account as well.
2023-07-18 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230711
Merge with NetBSD make, pick up
o make.1: clean up wording, clarify scope of '!' in conditions
2023-07-15 Simon J Gerraty <sjg@beast.crufty.net>
* make-bootstrap.sh.in: set prefix
If configure is run using ksh we get unexpanded ${prefix} in
DEFAULT_SYS_PATH, by ensuring prefix is set we should still get
correct result.
2023-07-13 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230711
bump version for IRIX tweaks
* make.h: undef OP_NONE if defined
* unit-tests/Makefile: set BROKEN_TESTS for IRIX
* configure.in: override INSTALL on IRIX
2023-06-27 Simon J Gerraty <sjg@beast.crufty.net>
* boot-strap op_test: ensure we set TEST_MAKE as we want it.
* sys.mk: set SYS_MK and INSTALL_SH for systems with incompatible
install(1)
* sys/IRIX.mk: when setting ROOT_GROUP only match the first :0:
set INSTALL to install-sh rather than pathname that may not exist
(yet).
2023-07-07 Simon J Gerraty <sjg@beast.crufty.net>
* dirdeps.mk: pass DIRDEP_TARGETS to DIRDEP_MAKE
normally this is empty - for the default target, but there are
use-cases where we might set it to something else.
* dirdeps.mk: apply DEBUG_DIRDEPS_LIST_FILTER to lists we output
when DEBUG_DIRDEPS is in effect.
Eg. DEBUG_DIRDEPS_LIST_FILTER=ts\n
can greatly improve readability.
Summary:
Provide an implementation of fpu_kern_enter/fpu_kern_leave for PPC to
enable FPU, VSX, and Altivec usage in-kernel. The functions currently
only support FPU_KERN_NOCTX, but this is sufficient for ossl(1) and many
other users of the API.
This patchset has been tested on powerpc64le using a modified version of
the in-tree tools/tools/crypto/cryptocheck.c tool to check for FPU/Vec
register clobbering along with a follow-up patch to enable ossl(4) on
powerpc64*.
Warner Losh [Fri, 15 Sep 2023 16:02:32 +0000 (10:02 -0600)]
nvme: Give up when we've failed
Normally, we poll the device every so often to see if commands have
timed out. However, we'll go into the recovery state as part of failing
the drive. To account for all possibilties, if we're failed when we get
into the polling function, just stop polling: Party is over.
Bojan Novković [Fri, 15 Sep 2023 10:41:10 +0000 (12:41 +0200)]
amd64: Add a leaf PTP when pmap_enter(psind=1) creates a wired mapping
This patch reverts the changes made in D19670 and fixes the original
issue by allocating and prepopulating a leaf page table page for wired
userspace 2M pages.
The original issue is an edge case that creates an unmapped, wired
region in userspace. Subsequent faults on this region can trigger wired
superpage creation, which leads to a panic in pmap_demote_pde_locked()
as the pmap does not create a leaf page table page for the wired
superpage. D19670 fixed this by disallowing preemptive creation of
wired superpage mappings, but that fix is currently interfering with an
ongoing effort of speeding up vm_map_wire for large, contiguous entries
(e.g. bhyve wiring guest memory).
lib/libc/tests/string/strcspn_test.c: extend tests to catch previous bug
This extends the strcspn() unit tests to catch mistakes in the
implementation that only appear when a mismatch occurs in a certain
position of the string against a certain position of the set.
See also: 52d4a4d4e0dedc72bc33082a3f84c2d0fd6f2cbb
Sponsored by: The FreeBSD Foundation
Approved by: imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41821
Pierre Pronchery [Fri, 15 Sep 2023 15:14:16 +0000 (17:14 +0200)]
libcrypto: link engines and the legacy provider to libcrypto
OpenSSL's legacy provider module and engines need to link to
libcrypto.so, as it provides some of the actual implementations of
legacy routines.
This is a little tricky due to build order issues. Introduce a small
hack (LIBCRYPTO_WITHOUT_SUBDIRS) that builds libcrypto.so in its usual
early phase without any OpenSSL provider modules or engines. This is
intended to restore the test suite; a future change should remove the
hack and replace it with a better approach.
PR: 254853, 273528
Discussed with: Folks at EuroBSDCon in Coimbra
Sponsored by: The FreeBSD Foundation
sockets: re-check socket state after call to pr_rcvd()
Socket state may have changed after dropping the receive
buffer lock in order to call pr_rcvd(). If the buffer is
empty, re-check the state after reaquiring the lock and
skip calling sbwait() if the socket is in error or the
peer has closed.
lib/libc/amd64/string/memcmp.S: harden against phony buffer lengths
When memcmp(a, b, len) (or equally, bcmp) is called with a phony length
such that a + len < a, the code would malfunction and not compare the
two buffers correctly. While such arguments are illegal (buffers do not
wrap around the end of the address space), it is neverthless conceivable
that people try things like memcmp(a, b, SIZE_MAX) to compare a and b
until the first mismatch, in the knowledge that such a mismatch exists,
expecting memcmp() to stop comparing somewhere around the mismatch.
While memcmp() is usually written to confirm to this assumption, no
version of ISO/IEC 9899 guarantees this behaviour (in contrast to
memchr() for which it is).
Neverthless it appears sensible to at least not grossly misbehave on
phony lengths. This change hardens memcmp() against this case by
comparing at least until the end of the address space if a + len
overflows a 64 bit integer.
An explicit tzset() call is usually not needed as it happens implicitly
the first time we call localtime() or mktime(), but in some cases
(sandboxing, chroot) this may be too late.
kinst currently only traces functions that start and end with the usual
function prologue and epilogue respectively. Ignoring functions that do
not have an epilogue however, makes the filtering too strict, as this
means that we can not trace functions that never return (e.g
vnlru_proc()). This patch relaxes the filtering and only checks whether
the function pushes the frame pointer.
LinuxKPI: 802.11: fix counting the number of supbands
While the main purpose was to assign an(y) early chandef with the
loop, later additions made use of it to also count supbands as well
as to initialise max_rates.
Due to the main goal we can exit the loop early and not properly
count and initialise supbands and max_rates.
Move the terminating condition into the loop and make it a continue
rather than ending the loop.
Fixes: d9945d7821b9b ("improve hw_scan")
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
LinuxKPI: 802.11: make sure bssid for scans (probe_req) is set
In b0f73768220e9 we added bssid[] to struct cfg80211_scan_request
likely while working on mt76 and did not need it (yet) back then.
iwlwifi started to use the field in Linux f1fec51cda70f (April 2023).
Without it set firmware crashes when trying to send probe requests
((empty) SSID also given to hw_scan).
For now always set the field to the wildcard BSSID.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
While debugging other problems I ran into the case where net80211
was thinking a scan was ongoing and new scans could not be started
but given other logging there was clearly no more scan running.
It was hard after the fact to quickly determine enough state to
reconstruct or validate assumptions.
Improve a MSG_SCAN debug logging and implement _db_show_scan() ddb
output which can be printed along with show com /S or /a.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
net80211: mark argument to scan_curchan_task() __unused
Mostly as documentation mark an unused argument to scan_curchan_task()
as __unused. We may possibly want to check all callers in the future
and see if the argument was supposed to be useful or should be entirely
removed.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days