netgraph/ng_ksocket: Enter epoch on NG_SEND_DATA_ONLY
The work queued by ng_send_fn() is intentionally processed
outside of the epoch in ngthread().
It is ng_ksocket's responsibility to enter epoch if it decides
to send data from such work.
Reviewed by: glebius
Fixes: 104827151e2a ("ng_iface: don't recursively enter epoch ...")
Differential Revision: https://reviews.freebsd.org/D60589
virtual_oss(8): Fix cuse.ko check
There is no need at all to load the cuse module to just access the tool help.
kldload always checks for permissions first returning -EPERM if the user can't
load modules and -EEXIST if the user can, but the module is already loaded.
Approved by: christos@
Differential Revision: https://reviews.freebsd.org/D59844
MFC after: 2 weeks
(cherry picked from commit 5aac18d0faec96c768baf1a9de63a50de3796023)
LinuxKPI: introduce LINUXKPI_DEBUG to enable LinuxKPI debugging
This allows us to build kernels which will (if the sysctl is enabled
too) show pr_debug() and pr_devel() output.
Enable it by default for debug kernels.
This option can later also be used for other LinuxKPI parts, like
skbuffs, netdevice, rcu, ... to conditionally compile in debugging
support to further justify its existence beyond an in-code #define.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: dumbbell, emaste
Differential Revision: https://reviews.freebsd.org/D54060
LinuxKPI: use LINUXKPI_DEBUG to determine on witness lock tracing
LinuxKPI by default tells witness to ignore the locks, which is
unhelpful in case of panics like 'panic: sleeping thread holds lnxspin'.
While I have edited the lock initialitzation manually in the past,
make this dependent on both LINUXKPI_DEBUG and WITNESS.
Define an internal _LKPI_MTX_NOWITNESS (and equivalent for other lock
types used) and set them accordingly in kconfig.h, a file automatically
included to all LinuxKPI compiled code (like global.h). (*)
In addition, in the debug case, also define WITNESS_ALL to get file,
line, and lock name as a lock name rather than just, e.g., lnxspin.
(*) We will need another follow-up as -include ordering is currently
wrong for LinuxKPI modules. See D60207.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D59231
LinuxKPI: re-implement pm_runtime.h
The original implementation was based on OpenBSD under public domain
but just defined the functions to void.
FreeBSD later extended the file with more inline functions or dealing
with differences in Linux versions.
This rework tries to group some functions, adds properly typed arguments
and return values in some cases.
It further adjusts return values based on the !CONFIG_PM expectations.
Lastly pr_debug() calls are added so we could see if/how much these
functions are used in new/other works rather than code just compiling
but the functions entirely being ignored without the knowledge of the
person porting code.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D58169
LinuxKPI; factor out parts of device.h into device/devres.h
In [1] it was pointed out that devm_kmemdup_* have moved apparently
in Linux 7.0 into their own device/devres.h header file from device.h.
Move them and other parts (some being dependencies) along.
device/devres.h gets included from device.h so all that changes is
prototype, macro, and inline function ordering.
This should prepare us in case drivers start directly including
the sub-header. It also helps to keep device.h more reasable.
Suggested by: dumbbell (in D56396) [1]
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D60213
lindebugfs: implement debugfs_create_devm_seqfile()
Implement debugfs_create_devm_seqfile() keyed by device and a
read function.
This was implemented months ago in order to support debugfs with mt76
but hasn't been exercised since.
The code does not really seem to belong in lindebugfs, but also does
not really fit into debugfs.h (rather fs.h?); leave it here with a
comment for now as neither dumbbell nor I could come up with a better
place.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D57524
ng_ubt: ignore further MediaTek USB BT devices
Following 8b21c469dbd6 add more entries for various MT BT USB VPI
combinations given we currently do not support any of them.
Suggested by: thierry (while testing MT7920 wireless)
MFC after: 3 days
Reviewed by: emaste, imp
Differential Revision: https://reviews.freebsd.org/D60279
tests/libc: only build brk_test where libc provides sbrk
Replace the exclusion list with an allowlist of the architectures
whose libc exports brk/sbrk: amd64, i386, arm and powerpc.
On aarch64, riscv and loongarch libc does not export those symbols
and the test cannot run, so do not build it there. New architectures
now default to not building the test unless brk support is added.
MFC after: 1 week
Signed-off-by: Xiaoqiang Zhao <zhaoxiaoqiang007 at gmail.com>
Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D60357
tests/libc: use an allowlist for sbrk in NetBSD-derived tests
sbrk is obsolete and libc only provides it on amd64, arm, i386 and
powerpc. Replace the growing exclusion lists in t_dir.c and t_mlock.c
with a single positive HAVE_SBRK definition per file, so architectures
without sbrk need not be enumerated as they are added.
Signed-off-by: Xiaoqiang Zhao <zhaoxiaoqiang007 at gmail.com>
Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D60358
Revert "tests/libc: use an allowlist for sbrk in NetBSD-derived tests"
Need to update the commit message.
This reverts commit 36b849b5c76406bb6d9341bfb1a7f16ae5c189c9.
tests/libc: use an allowlist for sbrk in NetBSD-derived tests
sbrk is obsolete and libc only provides it on amd64, arm, i386 and
powerpc. Replace the growing exclusion lists in t_dir.c and t_mlock.c
with a single positive HAS_SBRK definition per file, so architectures
without sbrk need not be enumerated as they are added.
Signed-off-by: Xiaoqiang Zhao <zhaoxiaoqiang007 at gmail.com>
Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D60358
rtld: release rtld_bind_lock around calls to .preinit_array initializers
We unlock the bind lock around .init calls anyway. Also, the main
object cannot be unloaded.
Reported and reviewed by: dim
PR: 298943
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D60588
if_me: Do not reuse gre(4)'s static sysctl OID number
if_me(4) registers its net.link.me node with the static OID number
IFT_TUNNEL, the same number if_gre(4) has used for net.link.gre since
2003, so the two tunnel drivers collide under net.link. Until
d35c4cfad580 that only printed a warning and left two nodes with the
same number; since then sysctl_register_oid() panics, so loading if_me
after if_gre (or the other way round) takes the box down:
kldload if_gre
kldload if_me
panic: sysctl: OID number(131) is already in use for 'me'
Use OID_AUTO like the other tunnel drivers. Nothing addresses the node
by number.
Reviewed by: ae
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D60536
riscv/pmap.c: Don't pass hartid map to 'smp_rendezvous_cpus'
The pm_active bitmask is indexed by hart IDs which can differ from
CPU IDs. `pmap_invalidate_range_svinval` assumes that the map is
indexed by CPU IDs, which is wrong and causes remote TLB invalidations
on unrelated CPUs.
Fix this by adding a routine that converts a hart-indexed bitmask
to a CPU ID-indexed bitmask. While we're here, fix a similar issue
in `pmap_active_cpus`.
Fixes: 99360212c739 ("riscv/pmap.c: Add an Svinval-aware variant of pmap_invalidate_range")
Reported by: markj
Reviewed by: markj, mhorne
Differential Revision: https://reviews.freebsd.org/D60072
man: Link mgb.4 to if_mgb.4
For consistency, create a symbolic link from mgb.4 to also
if_mgb.4
Reviewed by: #manpages, ziaee, emaste
Differential Revision: https://reviews.freebsd.org/D60551
MFC after: 3 days
acl(9): expound on NFSv4 constants' meanings
This change adds missing documentation for various NFSv4 constants
supported by acl(9).
Bump `.Dd` for the change.
MFC after: 1 week
Reviewed by: rmacklem
Differential Revision: https://reviews.freebsd.org/D58736
zfs: drop duplicate `vfs.zfs.metaslab.condense_pct` sysctl
`metaslab.c` already registers this tunable via `ZFS_MODULE_PARAM`, so the
`SYSCTL_UINT` here is a second registration of the same leaf. This
resulted in messages like:
```
sysctl_register_oid: can't re-use a leaf (vfs.zfs.metaslab.condense_pct)
```
Remove the duplicate sysctl registration, as upstream (OpenZFS) did.
MFC after: 1 week
Signed-off-by: Christos Longros <chris.longros at gmail.com>
Reviewed by: imp, mm, ngie
Differential Revision: https://reviews.freebsd.org/D57721
lib80211: fix build with eXpat 2.9.0
eXpat 2.9.0 deprecates XML_GetCurrentLineNumber() in favour of
XML_GetCurrentLineNumber64(). The new function behaves the same
as the old one but is not prone to 32 bit integer wrap-around.
(cherry picked from commit 657c089950a0388811c7ba3f6d3e7127c297864e)
lib80211: fix build with eXpat 2.9.0
eXpat 2.9.0 deprecates XML_GetCurrentLineNumber() in favour of
XML_GetCurrentLineNumber64(). The new function behaves the same
as the old one but is not prone to 32 bit integer wrap-around.
(cherry picked from commit 657c089950a0388811c7ba3f6d3e7127c297864e)
libalias: index fully specified inbound links by remote endpoint
Inbound lookups find the (alias address, alias port, link type) group
with a splay tree and then walk grp->full, a list of every fully
specified link in that group, comparing the remote address and port.
With redirect_addr in front of a busy server, every client connection
to public:443 lands in the same group, so each inbound packet that is
not near the head of the list walks all of it. TCP links live up to
24 hours unless libalias sees a clean close, so the list can grow to
hundreds of thousands of entries and saturate a core at a few hundred
packets per second.
Keep the fully specified links of a group in an RB tree ordered by
(dst_addr, dst_port). Links that share an endpoint are ordered newest
first by a per-instance insertion counter, which keeps the "most recent
link wins" behaviour of the list (tested by 3_natin:2_portoverlap).
Lookups with an unknown remote address and a known port still scan the
group. Each link grows by 16 bytes.
[8 lines not shown]
linux: Exposes renderD nodes and chardev in sysfs
To allow normal users to render through the render device, we expose the
renderD node. This enables Wayland applications to use hardware
acceleration when running under the Linux emulator.
Additionally, libdrm and Mesa need to look up
/sys/dev/char/<major>:<minor> and <pcidev>/drm to identify the
corresponding renderer device (e.g., a renderD device). We expose this
path as well so that libdrm can locate the renderer.
Differential Revision: https://reviews.freebsd.org/D59190
(cherry picked from commit 102adf88e6e8f83a9ab9769732d168c501f8eb6c)
libthr: Support disable spinloop
Like yieldloops, we shoulde be able to set _thr_spinloops to zero.
Originally, it makes us to enformce default spin time even if we try to
disable it. Make MUTEX_ADAPTIVE_SPINS a one time initialization now.
Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D60486
hyperv: Fix single page invalidation path
A single page invalidation sets addr2 == 0. In the original code, it
falsely flush the whole address in non global pmap. However, the
kernel pmap are all PG_G, which means a single page flush will always be
staled and thus become invalid. As a result, we set parameter based on
their op in a new helper function instead of relying on args. This
affects only on AMD platform as Intel has their PTI implementation.
PR: 291577
Tested by: franco at opnsense.org
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D60380