The locking paths into these routines LOOK correct, but I figured
it'd be good to at least enforce we're not doing concurrent entry
into iwx_start() / iwx_tx() without the lock held.
Differential Revision: https://reviews.freebsd.org/D52655
Reviewed by: thj
I'm seeing random disconnects in iwx without any useful information
as to why. I'll start by adding missed beacon debugging here; hopefully
they're generally useful.
Differential Revision: https://reviews.freebsd.org/D52524
Reviewed by: bz
While both locking and unlocking a spinlock used to be inline, this
changed when spinlock_enter/spinlock_exit got introduced, defeating the
point of inlining them.
This either needs to have inlined spinlock enter/exit in place or have
mtx lock/unlock as function calls with the irq flags inlined in there.
Sponsored by: Rubicon Communications, LLC ("Netgate")
Bootstrap flua has some magic now to handle modules by building them in
and discovering them via linker sets. This is slightly cleaner than
always building them in and baking them into loadedlibs for both
bootstrap and system flua.
Adjust the stand build now that these three libs have their own new
homes.
Reviewed by: bapt, emaste
Differential Revision: https://reviews.freebsd.org/D51891
This version builds every module into the flua binary itself, since all
of the bootstrap tools are built -DNO_SHARED. As a result, we also
cannot dlsym(), so we can't really discover the names of our newly
builtin modules. Instead, just build out a linker set with all of our
luaopen_*() functions to register everything up-front.
Building in all of the modules isn't strictly necessary, but it means
that we have an example of how to add a bootstrap module everywhere you
go and one doesn't need to consider whether bootstrap flua can use a
module when writing scripts. On my build machine, the consequence on
our binary size is an increase from around 1.6M -> 1.9M, which isn't
really that bad.
.lua modules can install into their usual path below $WORLDTMP/legacy
and we'll pick them up automagically by way of the ctor that sets up
LUA_PATH early on.
This re-lands bootstrap module support with a more sensible subset, and
after having verified that it cross-builds fine on macOS and Linux -- we
cannot do libfreebsd on !FreeBSD because it's more system header
dependant. We also need to bootstrap libmd to bring in libhash, and
libucl + libyaml.
Reviewed by: bapt, emaste (both previous version)
Differential Revision: https://reviews.freebsd.org/D51890
This reverts commit 1953a12ee2, because it
cannot work at all on macOS without more work, at a minimum. We use
linker sets for module discovery, but we don't have a version of this
that works for mach-o at the moment.
This is a tarball containing the pkgbase repository for the release.
Note: This is an uncompressed tarball, because all of its constituent
.pkg files are already compressed; there's no point adding another
layer of compression.
Reviewed by: ivy
MFC after: 1 minute
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D52899
In addition to not putting distribution sets onto ISO images, if
NODISTSETS is set then we should not build the distribution sets
or put them onto the "FTP" site (aka download.freebsd.org).
MFC after: 3 days
Sponsored by: https://www.patreon.com/cperciva
Treat an empty NODISTSETS the same as if it is not defined; this avoids
problems if a script calls 'make release NODISTSETS=${NODISTSETS}'.
MFC after: 3 days
Sponsored by: https://www.patreon.com/cperciva
Add a new --jail option to the pkgbase script which installs
jail-specific set variants if they exist:
* "minimal" is replaced with "minimal-jail"
* A kernel is not installed.
* For sets shown in the component selection dialogue, only show the
appropriate variant (jail or non-jail) for the target.
Modify the jail script to pass --jail to the pkgbase script.
Remove the redundant --no-kernel option, which was added in 15.0 and
was only used to install jails.
MFC after: 3000ms
Reviewed by: ifreund_freebsdfoundation.org
Sponsored by: https://www.patreon.com/bsdivy
Differential Revision: https://reviews.freebsd.org/D52829
This largely eliminates contention on the vnode interlock.
Note this still does not scale, to be fixed(tm).
Reviewed by: kib
Tested by: pho (previous version)
Differential Revision: https://reviews.freebsd.org/D38761
Vast majority of real-world contention on the hash comes from lookups,
notably seen during highly parallel poudriere runs.
Lockless lookup largely alleviates the problem.
Reviewed by: kib
Tested by: pho (previous version)
Differential Revision: https://reviews.freebsd.org/D38761
While here some style touch ups and fixing a stale name in an assert.
Reviewed by: kib
Tested by: pho (previous version)
Differential Revision: https://reviews.freebsd.org/D38761
Both lower vnode and null data are safe while the lock is held,
at the same time neither is touched after unlock.
While here remove stale comment about interlock handling. It is no
longer legal to pass to unlock.
Reviewed by: kib
Tested by: pho (previous version)
Differential Revision: https://reviews.freebsd.org/D38761
Bootstrap flua has some magic now to handle modules by building them in
and discovering them via linker sets. This is slightly cleaner than
always building them in and baking them into loadedlibs for both
bootstrap and system flua.
Adjust the stand build now that these three libs have their own new
homes.
Reviewed by: bapt, emaste
Differential Revision: https://reviews.freebsd.org/D51891
This version builds every module into the flua binary itself, since all
of the bootstrap tools are built -DNO_SHARED. As a result, we also
cannot dlsym(), so we can't really discover the names of our newly
builtin modules. Instead, just build out a linker set with all of our
luaopen_*() functions to register everything up-front.
Building in all of the modules isn't strictly necessary, but it means
that we have an example of how to add a bootstrap module everywhere you
go and one doesn't need to consider whether bootstrap flua can use a
module when writing scripts. On my build machine, the consequence on
our binary size is an increase from around 1.6M -> 1.9M, which isn't
really that bad.
.lua modules can install into their usual path below $WORLDTMP/legacy
and we'll pick them up automagically by way of the ctor that sets up
LUA_PATH early on.
Reviewed by: bapt, emaste
Differential Revision: https://reviews.freebsd.org/D51890
libopenbsd retains recallocarray() during bootstrapping for now
as it is needed for mandoc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D52864
This function from OpenBSD is a hybrid of reallocarray() and calloc().
It reallocates an array, clearing any newly allocated items.
reallocarray() ultimately originates from OpenBSD.
The source is taken from lib/libopenbsd, which now no longer has the
function unless when bootstrapping (needed for mandoc).
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D52863
Summary:
This makes the code easier to understand and slightly faster,
but requires C23. calloc() would benefit, too, but I didn't
want to touch the imported jemalloc code base.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D52854
Previously if WITHOUT_TOOLCHAIN was set we'd create a FreeBSD-clang
package that contained only ar.5. As ar.5 describes the ar format
and doesn't come from Clang/LLVM move it to the FreeBSD-toolchain
package and make it conditional on MK_TOOLCHAIN.
Reviewed by: ivy
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52886
- Use the recently-added fsetfl_lock/unlock API to synchronize direct
FIONBIO and FIOASYNC ioctls with fcntl(F_SETFL).
- While here, skip calling the underlying ioctl if the flag's current
state matches the requested state.
- Also while here, only update the flag state if the underlying ioctl
succeeds. This fixes a bug where the flags represented the new
state even if the underlying ioctl failed. A test is added for this
last case that a failing FIOASYNC on /dev/null doesn't result in
setting O_ASYNC in the file flags.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D52721
Keeping cumulative MCA statistics in the kernel provides a way for
users to get an accurate count of various kinds of errors reported
by the CPU.
After ca8929d2a3, it is possible that
the kernel will drop the record of some MCA interrupts. Moreover, this
provides a cheaper interface to obtain statistics if that is the only
reason a user is processing MCA logs.
Reviewed by: markj
Sponsored by: Netflix
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D52709
We previously used `PKG_FORMAT: tar` to avoid spending a lot of time in
zstd compression. Instead just set PKG_LEVEL to compression level 1,
which still produces packages that are much smaller than uncompressed
tarballs with only a small penalty in build time.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52858
This change simplifies integration of gdb python scripts with our kernel
debugging infrastructure. Rather than putting debugging scripts in
/usr/libexec/kgdb, move them to <path-to-kernel-debug-symbols>/gdb, and
add a kernel-gdb.py which automatically loads modules from that
directory. kernel-gdb.py will be automatically executed by kgdb when
loading kernel debug symbols (assuming a default configuration), so one
no longer needs to do anything to use these modules.
The change also adds a couple of new modules, vnet.py and pcpu.py, for
conveniently accessing VNET symbols and PCPU/DPCPU fields, respectively.
Note that these require a change to the kernel linker when accessing
symbols from a loadable kernel module.
sys/tools/gdb/README.txt describes the scheme in more detail and
provides some rudiementary documentation for the commands and functions
added by these modules. It should be updated when adding new features.
sys/tools/gdb/selftest.py can be used to do some primitive testing of
the modules. All it does is execute a number of gdb commands making use
of commands and functions added by these modules. The developer is
expected to verify that the commands complete without errors and that
the output looks sane.
Discussed with: kp, avg, jhb, glebius
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D50825
When trying to find the address of a VNET variable from a debugger, it
helps to have the original address of the VNET section. In particular,
given the address of a vnet_entry_foo symbol, one wants to easily find
the linker file that the symbol belongs to.
In link_elf_obj.c, the section address for VNET and DPCPU sections is
overwritten in link_elf_link_preload() and link_elf_load_file(). Add an
"origaddr" field to store the original absolute address of the section
base.
In link_elf.c the elf_file_t already has the fields we want, but they
were not getting filled out for the kernel itself. Fix that too, since
that simplifies things for debuggers and improves consistency.
Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D52730
Replace counter(9) usage with more lightweight atomic(9) in the
code handling RFC 7217 SLAAC address generation.
Also, use `u_int` types with this. Leaving `dad_failures` local to
`in6_get_stableifid()` as a `uint64_t` to avoid changing the generated
addresses from previous code; this also gives some headroom for
future changes.
While here, moved some `#include` lines to adhere to style(9).
Reviewed by: glebius, jhibbits, jtl, zlei
Approved by: glebius, jtl, zlei
Differential Revision: https://reviews.freebsd.org/D52731
* use ND_NA_FLAG_ROUTER flag in carp_send_na() when we work as router.
* use in6addr_any as destination address for nd6_na_output(), then it
will use ipv6-all-nodes multicast address.
* add in6_selectsrc_nbr() function that accepts additional argument
ip6_moptions. Use this function from ND6 code to avoid cases when
nd6_na_output/nd6_ns_output can not find source address for
multicast destinations.
* add some comments from RFC2461 for better understanding.
* use tlladdr argument as flags and use ND6_NA_OPT_LLA when we need
to add target link-layer address option, and ND6_NA_CARP_MASTER when
we know that target address is CARP master. Then we can prepare
correct CARP's mac address if target address is CARP master.
* move blocks of code where multicast options is initialized and
use it when destination address is multicast.
Reviewed by: kp
Obtained from: Yandex LLC
MFC after: 2 weeks
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D52825
We need to tell pkg to record files in METALOG; otherwise when we
create the VM image it's almost empty.
MFC after: 6 hours
Sponsored by: https://www.patreon.com/cperciva
In some devices, there may be multiple isa bridges available from different
sources. Therefore, we allow multiple lpc devices to be generated so that
pcie bus won't show "none" anymore.
For example, in my AMD based Framework Laptop, there are two such
bridges. One is acpi hinted, another is from pcie.
Reviewed by: imp
Approved by: lwhsu (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D52815
When trying to walk lock chains, we have to deduce what a thread is
blocked on. Checking LOCK_CLASS(td->td_wchan) is not a very reliable
method by itself, as it just tests whether a particular 4 bits near
where td_wchan points have a particular value. Misinterpreting wait
channel pointers of other sleeps as lockmgr locks would frequently cause
ddb show allchains (or show lockchain) to trap, or to produce incorrect
output.
Now, check the sleepq_type. When calling sleepq_add, we use SLEEPQ_LK
for lockmgr locks and SLEEPQ_SX for sx locks. This is a more reliable
indication that the td_wchan is actually a lock.
While here, also make the output of lockmgr and sx locks consistent with
the output for other locks (see print_lockchain). Outputting a pointer
to the lock allows it to be inspected further with ddb show lock or
other methods.
Reviewed by: markj
Sponsored by: Dell Inc.
Differential Revision: https://reviews.freebsd.org/D52794
The (update-)packages targets require buildworld and buildkernel to
run first. Add some .ORDER statements to ensure this happens.
This fixes 'make -j8 buildworld buildkernel packages'.
PR: 289969
Reported by: yasu
MFC after: 3 days
Reviewed by: yasu, emaste
Sponsored by: https://www.patreon.com/bsdivy
Differential Revision: https://reviews.freebsd.org/D52877
When doing a NO_ROOT build we can't run pkg inside a chroot, for
multiple reasons including not having /dev mounted.
MFC after: 6 hours
Sponsored by: https://www.patreon.com/cperciva
If an rdr (or nat) rule specifies 'pass' we don't run the filter rules, we just
pass the traffic. Or at least, we did until that got unintentionally broken.
Restore that behaviour and add a test case.
While here also fix nat:dummynet_mask, which relied on the broken behaviour.
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D52838
The syncache entry is locked by the hash bucket lock. After running
SCH_UNLOCK(), we have no guarantee that the syncache entry still
exists.
Resolve the race by moving SCH_UNLOCK() after the log() call which
reads variables from the syncache entry.
Reviewed by: rrs, tuexen, Nick Banks
Sponsored by: Netflix
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D52868