Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge FreeBSD 2024-06-14 #2218

Merged
merged 181 commits into from
Sep 8, 2024
Merged

Conversation

bsdjhb
Copy link
Collaborator

@bsdjhb bsdjhb commented Sep 6, 2024

PR for CI

alcriceedu and others added 30 commits June 8, 2024 02:26
Defer the bti lookup until after page table page allocation is complete.
We sometimes release the pmap lock and sleep during page table page
allocation.  Consequently, the result of a bti lookup from before
page table page allocation could be stale when we finally create the
mapping based on it.

Modify pmap_bti_same() to update the prototype PTE at the same time as
checking the address range.  This eliminates the need for calling
pmap_pte_bti() in addition to pmap_bti_same().  pmap_bti_same() was
already doing most of the work of pmap_pte_bti().

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D45502
PR:		277783
Reported by:	Victor Stinner
Submitted by:	kargl
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D44433
During code inspection, I noticed that
NFSD_VNET_DEFINE(nfsrv_dontlisthead)
is unused, so delete it.

MFC after:	2 weeks
On creating the pflog(4) interface, pflog_clone_create() does an
unconditional bpfattach(). Use bpf_peers_present() which was introduced
in commit 16d878c [1] to check the presence of bpf peers.

This will save a little CPU cycles when no bpf peers present. There
should be no functional change.

1. 16d878c Fix the following bpf(4) race condition which can result in a panic

Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45532
On creating the pfsync(4) interface, pfsync_clone_create() does an
unconditional bpfattach(). Use bpf_peers_present() which was introduced
in commit 16d878c [1] to check the presence of bpf peers.

This will save a little CPU cycles and memory usage when the
synchronisation interface is not configured and there is no bpf peers
present. There should be no functional change.

1. 16d878c Fix the following bpf(4) race condition which can result in a panic

Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45533
Fixes:	459dc61 ("arm: Convert drivers to use device_set_desc(f)()")
See 8164d51 ("libc/tests: Fix installation without MK_TOOLCHAIN")
for some background.  Here we should really be testing MK_CLANG instead,
since that's what gates compilation of libclang_rt.

Fixes:	8164d51 ("libc/tests: Fix installation without MK_TOOLCHAIN")
Extend SNDST_DSPS_PROVIDER_INFO for sound(4) to include information
about each channel in a given device, similar to how cat'ing
/dev/sndstat with hw.snd.verbose=2 works.

While here, document all provider_info fields.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D45501
Some of the string functions in contrib/arm-optimized routines are SIMD
enhanced which is not reflect on the simd(7) manpage. This commit
addresses that and introduces a new label A for functions enhanced with
the Arm ASIMD (Neon) extension.

Approved by:	emaste
Reviewed by:	fuz (GSoC mentor)
MFC to:		stable/14
Sponsored by:   Google LLC (GSoC 2024)
Differential Revision:	https://reviews.freebsd.org/D45523
When we update credits there is a potential for a race causing an
overflow of vxcr_next (i.e. incrementing it past vxcr_ndesc). Change the
check to >= rather than == to be more robust against this.

Reviewed by:	emaste
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D43712
Fixes:		2b88768
Sponsored by:	Microsoft
namei was mistaken for a typo (see GitHub pull request CTSRD-CHERI#1284).  Add an
xref to make it clear.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45546
A common convention suggests a 50 column commit subject line (the first
line of the commit message).  Add a 50 column marker to the commit
message template

Reviewed by:	lwhsu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45538
This code runs at EL2 while the kernel runs at EL1. We build these
files for EL2 through a dependency in vmm_hyp_blob.elf.full so there
is no need to include them in SRCS.

Reviewed by:	imp, kib, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45467
Adjust the mair_el1 macro indentation to be consistent with the
surrounding macros.

Reviewed by:	emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45524
It isn't used, and only masks/unmasks FIQs on the local CPU so will be
broken on SMP.

Reviewed by:	mmel
Differential Revision:	https://reviews.freebsd.org/D33804
Before FreeBSD 15 I plan to switch to LLVM_BINUTILS by default.  Add the
src.conf description now, for the benefit of downstream branches and
testing/CI.

PR:		258872 [exp-run]
Sponsored by:	The FreeBSD Foundation
So far only "ctladm port -c" and "ctladm port -r" are covered.

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	mav
Pull Request:	freebsd/freebsd-src#1279
Make "ctladm port -c" print the port number of the newly successful
port.  This way it won't have to be guessed by a subsequent "ctladm
portlist" command.  That means it's safe to use it concurrently with
other ctladm processes.  In particular, this allows the tests to be run
in parallel.

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:    mav
Pull Request:   freebsd/freebsd-src#1279
MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:    mav
Pull Request:   freebsd/freebsd-src#1279
When removing a port, the ioctl frontend requires the "-p" argument.
But other frontends, like cfiscsi, do not.  So don't require that
argument in the ctladm command.  The frontend driver will report an
error if any required argument is missing.

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:    mav
Pull Request:   freebsd/freebsd-src#1279
MFC after:	2 weeks
MFC with:	9747d11
Sponsored by:	Axcient
Reviewed by:	asomers, markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45535
Reviewed by:	markj
Fixes:		7affbee virstor: basic functional test
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45551
During the initial label of a virstor device, write out the allocation
map in chunks if it is large (> 1 MB) in order to avoid large mallocs.

Even though the kernel virstor geom may still do a large malloc to
represent the allocation map, this may still be useful to avoid a
ulimit.

Reviewed by:	markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45517
There's no reason why the virstor chunk size needs to relate to MAXPHYS.
Remove it.  Instead, just make sure that the chunk size is a multiple of
the sector size.

Reviewed by:	imp
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45518
Add boot parameter hw.vmbus.tlb_hcall for tlb flush hypercall.
By default it is set to 1 to allow hyercall tlb flush. It can be
set to 0 in loader.conf to turn off hypercall and use system
provided tlb flush routine.

The change also changes flag in the per cpu contiguous memory
allocation to no wait to avoid panic happened some cases which there
are no enough contiguous memery available at boot time.

Reported by:	gbe
Tested by:	whu
MFC after:	1 week
Fixes:		2b88768
Sponsored by:	Microsoft
markjdb and others added 27 commits September 6, 2024 17:41
No functional change intended.

Suggested by:	alc
Reviewed by:	dougm, alc, kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D43636
FreeBSD's boot times have decreased to the point where vm_page array
initialization represents a significant fraction of the total boot time.
For example, when booting FreeBSD in Firecracker (a VMM designed to
support lightweight VMs) with 128MB and 1GB of RAM, vm_page
initialization consumes 9% (3ms) and 37% (21.5ms) of the kernel boot
time, respectively.  This is generally relevant in cloud environments,
where one wants to be able to spin up VMs as quickly as possible.

This patch implements lazy initialization of (most) page structures,
following a suggestion from cperciva@.  The idea is to introduce a new
free pool, VM_FREEPOOL_LAZYINIT, into which all vm_page structures are
initially placed.  For this to work, we need only initialize the first
free page of each chunk placed into the buddy allocator.  Then, early
page allocations draw from the lazy init pool and initialize vm_page
chunks (up to 16MB, 4096 pages) on demand.  Once APs are started, an
idle-priority thread drains the lazy init pool in the background to
avoid introducing extra latency in the allocator.  With this scheme,
almost all of the initialization work is moved out of the critical path.

A couple of vm_phys operations require the pool to be drained before
they can run: vm_phys_find_range() and vm_phys_unfree_page().  However,
these are rare operations.  I believe that
vm_phys_find_freelist_contig() does not require any special treatment,
as it only ever accesses the first page in a power-of-2-sized free page
chunk, which is always initialized.

For now the new pool is only used on amd64 and arm64, since that's where
I can easily test and those platforms would get the most benefit.

Reviewed by:	alc, kib
Differential Revision:	https://reviews.freebsd.org/D40403
No functional change intended.

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D45556
Most of vmm.h is machine-independent.  Simplify merging amd64 and arm64
vmm code by removing this machine-dependent routine from arm64's vmm.h.
No functional change intended.

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D45557
CTASSERT is defined in kassert.h, so include that here.  No functional
change intended.

MFC after:	1 week
vm_phys_seg_paddr_to_vm_page() expects a PA that's in bounds, but
vm_phys_find_range() purposefully returns a pointer to the end of the
last page in a segment.

Fixes:	69cbb18 ("vm_phys: Add a vm_phys_seg_paddr_to_vm_page() helper")
Have PCTRIE_RECLAIM_CALLBACK typecast one function pointer type to
another, to relieve the writer of the call back function from having
to cast its first argument from void* to member type.

Reviewed by:	rlibby
Differential Revision:	https://reviews.freebsd.org/D45586
Skipping the UTC question via -s will not create or delete
/etc/wall_cmos_clock.

Reported by:	Tomoaki AOKI
Reviewed by:	imp, allanjude, jrm
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45576
Change 483fe96 embedded struct inpcb into struct udpcb and updated the
intoudpcb macro to use __containerof to locate it. This change accidentally
introduced a dependency on the identifier inp being defined in the block the
macro is expanded in. This should have been the macro argument ip. This change
makes this simple correction.

No functional change intended.

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
libkern.h uses KASSERT, which fails when building in the boot
loader. This is hacked around in a number of other places, but it's
easier to just include sys/kassert.h here. Those other hacks still work,
but are no longer really needed and can be torn down over time.

Reviewed by: emaste
Sponsored by: Netflix
Normally, memset isn't used. However for OPT_INIT_ALL=zero it is. Always
include it since we're not space constrained and latter-day loaders won't
include a copy if it's not actually used.

Reviewed by: emaste
Sponsored by: Netflix
Storing local time in the RTC is a legacy of 1990s PCs; it's not
relevant on other platforms of interest to FreeBSD.

While here switch to C99 bool.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	allanjude (earlier), imp (earlier)
Differential Revision: https://reviews.freebsd.org/D45575
PR:		272682
Reported by:	Miguel Salcedo
Reviewed by:	emaste
The parse_bias method returns a signed int, with a value of -1 when
the device tree reports nothing of the bias configuration. Convert the
local 'bias' from unsigned to signed to properly check this condition.

PR:		229721
Reviewed by:	mhorne
MFC after:	3 days
Add -Wno-format for zfs_module and regroup. This fixes warnings when
EFI_DEBUG is defined.

PR: 279071
Reviewed-by: imp
Make sure we do this BEFORE pmap_bootstrap().

Reviewed by:	markj, jhb
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45325
This code path should never be hit, if it does it means we did not
bootstrap correctly. Turn it into a panic like we do on amd64 and arm64.

Reviewed by:	markj, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45326
Make it explicit why we must set the trap vector before enabling virtual
memory.

Reviewed by:	br, jhb, markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45474
MFC after:	2 weeks
Reviewed by:	mav
Sponsored by:	Axcient
Reported by:	valgrind
Pull Request:	freebsd/freebsd-src#1288
Clarify that the "sysvipc" svcj option inherits from the host / parent.
Add "sysvipcnew" which creates a new SysV namespace for the service
jail.
Sanity check that only one of them is used.
Add some sanity checks when service jails are used in jails:
 - children.max > 0
 - children.max - children.cur > 0

The nesting is too deep at those places to have a sane formatting, so no
line wrapping at the usual column.
If someone has a better idea how to format this: feel free to go ahead.
vm_phys_enq_chunk() inserts a run of pages into the buddy queues.  When
lazy initialization is enabled, only the first page of each run is
initialized; vm_phys_enq_chunk() thus initializes the page following the
just-inserted run.

This fails to account for the possibility that the page following the
run doesn't belong to the segment.  Handle that in vm_phys_enq_chunk().

Reported by:	KASAN
Reported by:	[email protected]
Fixes:	b16b4c2 ("vm_page: Implement lazy page initialization")
Add the NVME_IOCTL_ID, NVME_IOCTL_ADMIN_CMD, and NVME_IOCTL_IO_CMD Linux
compatible ioctls. These may be run on either an I/O (ns) dev or a nvme
(admin) dev. Linux allows both on either device, and programs use this
and aren't careful about having the right device open. Emulate this
feature, and implement these ioctls. The data is passed in into the
kernel in host byte order (not converted to le). Results are returned in
host order.

The timeout field is ignore, and the metadata and metadata_len fields
must be zero.

The addr field can be null, even when the data_len is non zero (FreeBSD's
ioctl interface prohibits this, Linux's just ignores the inconsistency).

Only the cdw10 is returned from the command: the status is not returned
in 'result' field. XXX need to verify that this is what Linux does on an
error signaled from the drive.

No external include file is yet available for this: most programs that
call this interface either use a linux-specific path <linux/nvme.h> or
have their own private copy of the data. It's unclear the best thing to
do.

Also, create a /dev/nvmeXnY as an alias for /dev/nvmeXnsY.

These changes allow a native build of nvme-cli to work for everything
that doesn't depend on sysfs entries in /sys, calls that use metadata,
send / receive drive data and sed functionality not in our nvme driver.

Sponsored by:		Netflix
Co-Authored-by:		Chuck Tuffli <[email protected]>
Reviewed by:		chuck
Differential Revision:	https://reviews.freebsd.org/D45415
The lower layers implement a ABI compatible Linux ioctl for a few of the
Linux IOCTLs. Translate them and pass them down. Since they are ABI
compatible, just use the nvme ioctl name.

Co-Authored-by: Warner Losh <[email protected]>
Reviewed by:	chuck
Differential Revision:	https://reviews.freebsd.org/D45416
I am unsure if AArch64 Windows systems keep UTC or local time in the RTC
by default, so keep tzsetup consistent across architectures for now.

This reverts commit aa6fb1d.

Reported by:	 Mark Millard

(cherry picked from commit c6030b380469f928c8cae87ed53bcb234cb3486f)
@bsdjhb bsdjhb merged commit e52eeb8 into CTSRD-CHERI:dev Sep 8, 2024
29 checks passed
@bsdjhb bsdjhb deleted the merge-freebsd-20240614 branch September 8, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.