After talking with a number of people about the removal of some things
to make the loader fit, readjust things a little.
Add back GZIP and BZIP2 compression support. Many of the downstream MFC
packaging systems depend on this. This adds back 20k to the size of the
loader.
Make the boot loader text-only by default. This saves 40k in size. Net,
we're 20k smaller. The graphics loader for BIOS is less useful than the
zip functionality: You can still boot w/a text only one it and you can
build a custom one if you really want it. It's also the default we use
for dual console.
This should be merged back into stable/14 and stable/13 so it's in the
next release for each of these. That way we have only one release (13.4)
with the other defaults.
MFC After: 3 days
Sponsored by: Netflix
Reviewed by: olce, rgrimes, emaste
Differential Revision: https://reviews.freebsd.org/D47203
An assertion that an object was write-locked should be instead an
assertion that the object is read locked.
Reported by: Jenkins
Fixes: db08b0b04d tmpfs_vnops: move swap work to swap_pager
Differential Revision: https://reviews.freebsd.org/D47278
It turns out the new libc++ 19 headers result in a -Werror warning from
gcc 13:
In file included from /usr/obj/usr/src/freebsd/src/amd64.amd64/tmp/usr/include/c++/v1/__memory/shared_ptr.h:31:
/usr/obj/usr/src/freebsd/src/amd64.amd64/tmp/usr/include/c++/v1/__memory/uninitialized_algorithms.h: In instantiation of 'constexpr void std::__1::__uninitialized_allocator_relocate(_Alloc&, _Tp*, _Tp*, _Tp*) [with _Alloc = allocator<basic_string<char> >; _Tp = basic_string<char>]':
/usr/obj/usr/src/freebsd/src/amd64.amd64/tmp/usr/include/c++/v1/vector:1052:42: required from 'void std::__1::vector<_Tp, _Alloc>::__swap_out_circular_buffer(std::__1::__split_buffer<_Tp, _Allocator&>&) [with _Tp = std::__1::basic_string<char>; _Allocator = std::__1::allocator<std::__1::basic_string<char> >]'
/usr/obj/usr/src/freebsd/src/amd64.amd64/tmp/usr/include/c++/v1/vector:1469:31: required from 'void std::__1::vector<_Tp, _Alloc>::reserve(size_type) [with _Tp = std::__1::basic_string<char>; _Allocator = std::__1::allocator<std::__1::basic_string<char> >; size_type = long unsigned int]'
/usr/src/freebsd/src/contrib/googletest/googletest/src/gtest.cc:795:27: required from here
/usr/obj/usr/src/freebsd/src/amd64.amd64/tmp/usr/include/c++/v1/__memory/uninitialized_algorithms.h:645:21: error: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' writing to an object of type 'std::__1::__remove_const_t<std::__1::basic_string<char> >' {aka 'class std::__1::basic_string<char>'} with no trivial copy-assignment; use copy-assignment or copy-initialization instead o[-Werror=class-memaccess]
645 | __builtin_memcpy(const_cast<__remove_const_t<_Tp>*>(__result), __first, sizeof(_Tp) * (__last - __first));
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/obj/usr/src/freebsd/src/amd64.amd64/tmp/usr/include/c++/v1/__system_error/error_category.h:15,
from /usr/obj/usr/src/freebsd/src/amd64.amd64/tmp/usr/include/c++/v1/__system_error/error_code.h:18,
from /usr/obj/usr/src/freebsd/src/amd64.amd64/tmp/usr/include/c++/v1/__ostream/basic_ostream.h:16:
/usr/obj/usr/src/freebsd/src/amd64.amd64/tmp/usr/include/c++/v1/string:752:7: note: 'std::__1::__remove_const_t<std::__1::basic_string<char> >' {aka 'class std::__1::basic_string<char>'} declared here
752 | class basic_string {
| ^~~~~~~~~~~~
Since this is all benign, turn off errors for -Wclass-memaccess.
PR: 280562
MFC after: 3 days
Two functions in tmpfs_vnops.c use an interface provided by
swap_pager.c. Move most of the implementation of those functions to
swap_pager.c so that they can be implemented more effectively, with
access to implementation details of the swap pager.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D47212
This allows to remove the drop of the lock tcp_timer_enter(), which closes
a sophisticated but possible race that involves three threads. In case we
got a callout executing and two threads trying to close the connection,
e.g. and interrupt and a syscall, then lock yielding in tcp_timer_enter()
may transfer lock from one closing thread to the other closing thread,
instead of the callout.
Reviewed by: jtl
Differential Revision: https://reviews.freebsd.org/D45747
If a callout was initialized with the flag, then the callout(9) system
will not drop the callwheel lock in softclock_call_cc() to obtain the
callout lock. Instead it will use try-lock semantic to obtain the
callout's lock. In case of a failure the callout will be rescheduled to
the 50% of the precision value. The main benefit of such behavior is not
the avoidance of the lock contention in the callout thread, but the fact
that callout with such flag can be actually stopped in a safe manner,
because the race window in the beginning of softclock_call_cc() is closed.
Call of callout_stop() on such a callout would guarantee that nothing will
be executed after callout_stop() returns, neither callout lock will be
dereferenced. A callout marked as CALLOUT_TRYLOCK |
CALLOUT_RETURNUNLOCKED can call callout_stop() from the callout function
itself (0, a failure to stop, will be returned), then unlock the lock and
then free the memory containing the callout structure.
Caveat: when calling callout_stop() from outside the callout function, the
return value from callout_stop() is still inconsistent. A race window at
the end of softclock_call_cc() still exists, so callout_stop() may report
failure to stop, which would not be true.
Reviewed by: jtl, kib
Differential Revision: https://reviews.freebsd.org/D45746
Now that we export the relevant stats via the net.route.stats sysctl,
switch to using that to avoid having to dig around in mem(4) for live
kernel statistics. Based on callers of kresolve_list(), this is the
last live path using mem(4) that could be functional today.
Tested both with `netstat -rs` and `netstat -rs -M`.
Note that this will not be able to extract stats from a running kernel
that predates 3360a15898 / 1500026, but this can be worked around by
specifying `-M /dev/mem` explicitly in the interim to fallback to
libkvm against /dev/mem.
Reviewed by: glebius, markj, zlei
Differential Revision: https://reviews.freebsd.org/D47231
The previous fix for a stack buffer leak in the ahci device model
actually broke the handling of TRIM as one of the checks it added
caused TRIM commands to never be completed. This resulted in command
timeouts if a guest OS did a 'newfs -E' of an AHCI disk, for example.
Also, for the invalid case the previous check was handling, the device
model should be failing with an error rather than claiming success.
To resolve this, validate the length of a TRIM request and fail with
an error if it exceeds the maximum number of supported blocks
advertised via IDENTIFY. In addition, if the PRDT does not provide
enough data, fail the command with an error rather than performing a
partial completion.
This is somewhat complicated by the implementation of TRIM in the ahci
device model. A single TRIM request can specify multiple LBA ranges.
The device model handles this by dispatching blockif_delete() requests
one at a time. When a blockif_delete() request completes, the device
model locates the TRIM buffer and searches for the next LBA range to
handle. Previously, the device model would re-read the trim buffer
from guest memory each time. However, this was subject to some
unpleasant races if the guest changed the PRDT entries or CFIS while a
command was in flight. Instead, read the buffer of trim ranges once
and cache it across multipe internal blockif requests.
Reviewed by: mav
Fixes: 71fa171c64 bhyve: Initialize stack buffer in pci_ahci
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47224
Before de8c0d15a64fa ("sound: Get rid of snd_clone and use
DEVFS_CDEVPRIV(9)"), sound(4) would create one device for each allocated
channel. The device names would be chosen from dsp_cdevs[], and created
with dsp_unit2name(). Additionally, dsp_cdevs[] was also used to match
these devices names, as well as OSSv4 aliases in dsp_clone().
Since sound(4) does not create separate devices for each channel
anymore, the meaning and use dsp_cdevs[] has changed. Part of it no
longer corresponds to devices at all, but instead is used to create
channel names, and another part is used to match only OSSv4 aliases in
dsp_clone().
To address this confusion, separate dsp_cdevs[] into a dsp_aliases[]
array, and move dsp_unit2name() to pcm/channel.c and rename it to
chn_mkname().
While here, get rid of the SND_DEV_DSPHW_* channel types, and simply use
the existing PCMDIR_* constants as the channel types. There is no need
to duplicate the same meaning twice.
Sponsored by: The FreeBSD Foundation
MFC after: 2 days
Reviewed by: dev_submerge.ch
Differential Revision: https://reviews.freebsd.org/D47199
Needed by a follow-up patch, so that channels can be sorted properly.
This change does not affect the behavior of any subsystem.
While here, change to an enum.
Sponsored by: The FreeBSD Foundation
MFC after: 2 days
Reviewed by: dev_submerge.ch, markj
Differential Revision: https://reviews.freebsd.org/D47198
DSP_REGISTERED calls PCM_REGISTERED, and already contains all the checks
we are doing.
No functional change intended.
Sponsored by: The FreeBSD Foundation
MFC after: 2 days
Reviewed by: dev_submerge.ch, markj
Differential Revision: https://reviews.freebsd.org/D47196
DSP_REGISTERED first checks if the softc is not null, through
PCM_REGISTERED, which in turn calls PCM_ALIVE, whereas PCM_DETACHING
accesses the softc flags directly.
Sponsored by: The FreeBSD Foundation
MFC after: 2 days
Reviewed by: dev_submerge.ch, markj, emaste
Differential Revision: https://reviews.freebsd.org/D47195
This is a function that calls into the EFI Runtime Services, but can
handle a fault. To support this add a handler in assembly that can
restore the kernel state on an exception and return a failure to the
caller.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D46817
When we receive an exception while in a spinlock we shouldn't enable
interrupts. When entering a spinlock we disable interrupts so enabling
them here could cause surprising results.
The three cases that could cause this are:
1. A break-before-make sequence
2. Accessing possibly unmapped code with a fault handler
3. Buggy code
1 and 2 are supported later in the data abort handler, and 3 should be
fixed when found.
Reviewed by: mmel, kib, markj
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D46816
As with other architectures when the TDP_NOFAULTING flag is set we
shouldn't panic when td_critnest is non-zero or if the witness check
fails.
The EFI runtime service functions will soon set this flag to handle
exceptions in the services.
Reviewed by: markj
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D46815
When registering an interrupt controller we take a priority to compare.
We never store the priority so any later calls may act incorrectly.
Store the priority so later calls act as expected.
Reviewed by: jrtc27
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D47235
The firmware may have unmasked pl011 interrupts. If we don't have a
device to handle one the kernel will print a spurious interrupt
warning. Rather than print the warning mask all interrupts until we
are ready to handle them.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D46863
When assertions are disabled, the upstream build system disables
LLVM_ENABLE_ABI_BREAKING_CHECKS by default. Though the upstream build
system allows it to be force-enabled, it looks like that is not a
well-tested build-time configuration.
Therefore, always disable LLVM_ENABLE_ABI_BREAKING_CHECKS when
assertions are disabled, which will also save some more runtime cost
when people use WITHOUT_LLVM_ASSERTIONS.
PR: 280562
MFC after: 1 month
Some internal checking functions should only be declared when both
NDEBUG and LLVM_ENABLE_ABI_BREAKING_CHECKS are undefined, otherwise you
would get compile errors similar to:
/usr/src/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:921:13: error: no member named 'VerifyDAGDivergence' in 'llvm::SelectionDAG'
921 | CurDAG->VerifyDAGDivergence();
| ~~~~~~ ^
Adjust the conditions for declaring and using these functions. This has
also been reported upstream.
Reported by: cy
PR: 280562
MFC after: 1 month
sys/intr.h originally started life as an extract of arm's intr.h, and
this include was dropped in its place. Changes in flight want to add
some MD definitions that we'll use in the more MI parts of INTRNG.
Let's formally reverse the dependency now since this is way more
common in general. All of the includes switched in this change that I
spot-checked were in-fact wanting declarations historically included in
sys/intr.h anyways.
Reviewed by: andrew, imp, jrtc27, mhorne, mmel, olce
Differential Revision: https://reviews.freebsd.org/D47002
uint32_t is handy for directly interfacing with assembly-language. For
the C portion, enum is much handier. In particular there is no need to
count the number of roots by hand. This also works better for being
able to build kernels with varying numbers of roots.
Switch to INTR_ROOT_COUNT as this better matches the purpose of the
value. Switch to root_type, rather than rootnum for similar reasons.
Remove the default from the core. Better to require the architectures
to declare the type since they will routinely deviate and a default
chosen now will likely be suboptimal.
Leave intr_irq_handler() taking a register type as that better matches
for interfacing with assembly-language.
Rather than keeping the entire machine interrupt header assembly-safe,
switch to use of the existing genassym.c program to generate them. This
will be handier in the long-term, most of the header never needs to be
exposed to assembly-language.
This roughly corresponds to Linux 9d9e5347b035412daa844f884b94a05bac94f864
For FreeBSD this is currently not expected to cause any difference in
behavior because we do not have the MTP force smbus changes for modern
standby.
MFC after: 3 days
Sponsored by: BBOX.io
Exporting the relevant pcpustat is trivial, so let's do that. We will
use it in a near-future change in netstat to avoid having to dig around
in mem(4) for live kernel statistics.
Differential Revision: https://reviews.freebsd.org/D47231
Move vm_object_scan_all_shadowed from vm_object.c to swap_pager.c, and
rename it. In the moved function, use vm_page and swblk iterators to
advance through the objects. Avoid checking a backing page for
busyness or validity more than once, or when it is beyond the upper
bound of the scan.
Reviewed by: kib, markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D47150
Detect and delete out of date clang-tblgen produced output. I found it
sufficent for compilation to delete only arm_*.inc files, but it seems
safer to regenerate all output and a few extra clang-tblgen runs pales
in comparison to the full build we're doing at this point.
Reviewed by: dim, emaste
Differential Revision: https://reviews.freebsd.org/D47270