Commit Graph

273597 Commits

Author SHA1 Message Date
Li-Wen Hsu
0088bc444e
DTrace test: skip flakey common.misc.t_dtrace_contrib.tst_dynopt_d in CI
PR:		237641
Sponsored by:	The FreeBSD Foundation
2022-03-24 11:37:50 +08:00
Li-Wen Hsu
e62aee66b0
DTrace test: Add a new keyword SKIPCI to gentest.sh
This is for marking a test case is flakey and should not be executed in
the CI environment.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34635
2022-03-24 11:30:27 +08:00
Henri Hennebert
9b261d2e0a rtsx: Display error if rtsx_read()/rtsx_write() fail.
MFC after:	1 week
2022-03-23 21:01:00 -04:00
Henri Hennebert
6b7718377b rtsx: Don't detach during shutdown
MFC after:	1 week
2022-03-23 20:58:38 -04:00
Ed Maste
a10c85e0f9 hda: whitespace fix for realtek pin patches 2022-03-23 20:54:51 -04:00
Ed Maste
da03ac41c9 sound: test PCM_REGISTERED before PCM_DETACHING
PCM_REGISTERED(d) tests that d is not NULL, so perform that check first
as we may have cases where devclass_get_softc has a null entry.

PR:		262671
Reviewed by:	hselasky
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34648
2022-03-23 20:10:00 -04:00
Farhan Khan
4b1e2c2f77 bsdinstall(8): Usage example of tar doesn't work
The order of arguments in the example does not work, because tar thinks
the directory is named -C, which does not exist and reports:
tar: Error opening archive: Failed to open '-C'

Approved by:	rpokala@ (src) on IRC
Differential Revision:	https://reviews.freebsd.org/D34649
2022-03-23 21:59:53 +01:00
John Baldwin
b2cb74c22c arm,arm64: Add a NT_ARM_TLS read-only register set.
This register set exposes the per-thread TLS register.  It matches the
layout used by Linux on arm64.  Linux does not implement this note for
32-bit arm.

Reviewed by:	andrew, markj
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34595
2022-03-23 13:33:06 -07:00
John Baldwin
add00c381e Use a regset for NT_ARM_VFP.
This includes adding support for NT_ARM_VFP for 32-bit binaries
running under aarch64 kernels both for ptrace(), and coredumps via the
kernel and gcore.

Reviewed by:	andrew, markj
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34448
2022-03-23 13:33:06 -07:00
John Baldwin
a47fd6929f aarch64: Fix get_fpcontext32() to work on non-curthread.
Similar to fill_fpregs(), only invoke vfp_save_state() for curthread.

While here, zero the buffer if FP hasn't been started to avoid leaking
kernel stack memory.

Reviewed by:	andrew, markj
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34525
2022-03-23 13:33:06 -07:00
John Baldwin
b1cd03dd29 <sys/reg.h>: Add ELF32_REGSET.
This permits adding a register set for FREEBSD32 ABIs.

While here, include <sys/linker_set.h> to make this header more
self-contained in the kernel.

Reviewed by:	andrew, markj
Sponsored by:	The University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34536
2022-03-23 13:33:06 -07:00
Navdeep Parhar
41c4e1c7f7 cxgbe(4): Allow dump_cimla and dump_devlog to sleep.
This has been safe since e9e7bc8250, which moved parts of error
handling from the ithread to a taskqueue.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2022-03-23 11:18:44 -07:00
Bjoern A. Zeeb
67674c1cb1 LinuxKPI: 802.11: fix lkpi_lsta_dump() debugging
Fix two last-minute changes of d9f59799fc:
(1) for consitency name the debugging function lkpi_lsta_dump()
(2) pass in the original node (ni) rather than taking it from the lsta
    to avoid problems realted to bss_update as mentioned in the above
    commit.

No functional changes for users.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
X-MFC with:	d9f59799fc
2022-03-23 17:18:00 +00:00
Bjoern A. Zeeb
6a8973c332 LinuxKPI: skbuff: fix skb_queue_splice_init()
In skb_queue_splice_init() we set a next value and then used that new
value to further update the remaining linking rather than the original
value.  Introduce another temporary variable 'n' to hold the original
value and use that.
While here rename q and h to from and to as otherwise it was too
confusing to read.

Also initialize skb->prev and skb->next to point to skb itself if
for nothing else at least to aid debugging.

Reported by:	phk (panic in iwl_txq_reclaim)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-23 17:18:00 +00:00
Mark Johnston
1babcad6bc elf: Avoid dumping uninitialized bytes in PRSTATUS core dump notes
elf_prstatus_t contains pad space.

Reported by:	KMSAN
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34606
2022-03-23 12:53:49 -04:00
Mark Johnston
7524994da0 callout: Remove the CS_EXECUTING flag
It is now unused.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34626
2022-03-23 12:37:02 -04:00
Mark Johnston
b319171861 setitimer: Fix exit race
We use the p_itcallout callout, interlocked by the proc lock, to
schedule timeouts for the setitimer(2) system call.  When a process
exits, the callout must be stopped before the process struct is
recycled.

Currently we attempt to stop the callout in exit1() with the call
_callout_stop_safe(&p->p_itcallout, CS_EXECUTING).  If this call returns
0, then we sleep in order to drain the callout.  However, this happens
only if the callout is not scheduled at all.  If the callout thread is
blocked on the proc lock, then exit1() will not block and the callout
may execute after the process has fully exited, typically resulting in a
panic.

I cannot see a reason to use the CS_EXECUTING flag here.  Instead, use
the regular callout_stop()/callout_drain() dance to halt the callout.

Reported by:	ler
Tested by:	ler, pho
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34625
2022-03-23 12:36:12 -04:00
Alfonso S. Siciliano
0e5c72c3cc
bsdinstall time: Replace dialog with bsddialog
Replace (LGPL) dialog utility with (BSD-2-Clause) bsddialog utility,
'dialog --calendar' is replaced by 'bsddialog --datebox' with same
features but different User Interface.

Approved by:		bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D34583
2022-03-23 16:56:37 +01:00
Andrew Turner
6e1f7b9b38 Remove L2_BLOCK_MASK from arm64
It's unneeded as it was just used to align KERNBASE to a level 2
block start address. KERNBASE was already aligned correctly.

Sponsored by:	The FreeBSD Foundation
2022-03-23 15:33:05 +00:00
Andrew Turner
863f3220d0 Support EFIRT on arm64 with a non 4k page size
When the page size the kernel is built for is not the same as
EFI_PAGE_SIZE we need to increment the page index at a faster rate.

Add this adjustment to the arm64 EFIRT support in preperation for
experimental 16k PAGE_SIZE support.

Sponsored by:	The FreeBSD Foundation
2022-03-23 15:18:30 +00:00
Andrew Turner
16d5f9a164 Add an implementation of .mcount on arm64
To support cc -pg on arm64 we need to implement .mcount. As clang and
gcc think it is function like it just needs to load the arguments
to _mcount and call it.

On gcc the first argument is passed in x0, however this is missing on
clang so we need to load it from the stack. As it's the caller return
address this will be at a known location.

PR:		262709
Reviewed by:	emaste (earlier version)
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34634
2022-03-23 15:16:59 +00:00
Emmanuel Vadot
f9413897cb linuxkpi: Add down_write_nest_lock
Simply calls down_write like in Linux (when CONFIG_DEBUG_LOCK_ALLOC isn't
specified)
Needed by drm v5.10

MFC after:	1 month
Reviewed by:	hselasky
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D34642
2022-03-23 14:37:53 +01:00
Emmanuel Vadot
8e587a5f13 linuxkpi: Add kstrtouint_from_user
Like kstrtoint_from_user but for uint.
Needed by drm v5.10

MFC after:	1 month
Reviewed by:	hselasky
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D34642
2022-03-23 14:37:32 +01:00
Emmanuel Vadot
9b8016548e linuxkpi: Add cond_resched_lock
If we need to resched it takes the lock, resched, release the lock
and returns 1, otherwise simply returns 0.

Needed by drm v5.9

MFC after:	1 month
Reviewed by:	hselasky
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D34620
2022-03-23 14:36:55 +01:00
Greg Lehey
31e076d70b Add devices and quirks for some Olympus cameras.
Reviewed by:	hps@
Fixes:	   	Problems attaching Olympus cameras.
MFC after:	2 weeks
2022-03-23 12:40:28 +11:00
Alfonso S. Siciliano
4d1ba6febf
bsdinstall hardening: Replace dialog with bsddialog
bsdinstall/scripts/hardening: Replace (LGPL) dialog utility with
(BSD-2-CLAUSE) dialog utility.

Approved by:		bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D34102
2022-03-23 00:58:48 +01:00
Brooks Davis
44b36b80f5 test-includes: improve portability
FreeBSD's shell permits [^bar] to match characters not in [bar] like
common regular expressions. This is non-portable and '!' should be
used in place of '^' for portability.

Reported by:	Nathaniel Wesley Filardo
Issue:		https://github.com/CTSRD-CHERI/cheribsd/issues/1321
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34597
2022-03-22 20:23:22 +00:00
Jens Schweikhardt
8422d54f40 Correct a handful of typos and grammos. 2022-03-22 21:12:42 +01:00
Bjoern A. Zeeb
d9f59799fc LinuxKPI: 802.11: rework sta state machine compatibility
Rework the state machine parts for various reasons:
(1) to add sta tracing to be able to better follow ni and lsta state
(2) factor out/implement lkpi_lsta_remove() to unlink the lsta and
    free the ni reference.
(3) avoid calling lkpi_disassoc() when you would think you should as
    changing BSS_CHANGED_ASSOC setting vif->bss_conf.assoc to false
    triggers a sta removal from firmware in iwlwifi which then triggers
    follow-up errors.  I do not understand why they use flags and state
    and ?? in parallel (too many options and ways to do things?).
(4) when "roaming" (or being disassoc/deauth) from an AP both net80211
    and apparently so mac80211 re-start with a new node/sta.  This
    results in us losing one or the other state in the compat layer
    or not updating firmware appropriately.  To resolve this make use
    of (a) the newly introduced (*iv_update_bss)() and (b) always tear
    a station down to "State 1" (INIT/SCAN/pre-AUTH) and only if needed
    re-create the new one (if we go to AUTH).
    A slightly earlier version has survived a night of wpa_supplicant
    and hostapd fighting each other over disassoc and deauth and
    re-associating/authorizing.

While there update a few comments and typos and do a few minor auxiliary
changes which are hard or not worth to extract.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-22 18:51:43 +00:00
Bjoern A. Zeeb
fa8f007de9 LinuxKPI: 802.11: factor out dtim/tsf updates
Factor out dtim/tsf setting/updates into lkpi_update_dtim_tsf()
with tracing and add an extra update call.
This avoids some code duplication and puts maintainance into a
single place.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-22 18:51:43 +00:00
Bjoern A. Zeeb
4f61ef8b78 LinuxKPI: 802.11: factor out lkpi_lsta_alloc() from lkpi_ic_node_alloc()
Split lkpi_ic_node_alloc() into two functions to make the code simpler
and to allow lkpi_lsta_alloc() to be re-used from another part of the
code related to (*iv_update_bss)().

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-22 18:51:43 +00:00
Bjoern A. Zeeb
bb81db90f7 LinuxKPI: 802.11: implement ieee80211_beacon_loss()
Implement ieee80211_beacon_loss() similar to
ieee80211_connection_loss() with different state handling.
While here leave a comment in connection_loss() about the state
change argument.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-22 18:51:43 +00:00
Bjoern A. Zeeb
91b4225aa1 net80211: introduce (*iv_update_bss)()
Introduce (*iv_update_bss)() with a default implementation to allow
drivers to overload/intercept the time when we swap iv_bss.

This helps firmware based drivers to synchronize state with firmware.
Otherwise, for some state changes, we begin with one ni (and in
LinuxKPI lsta) and try to finish with another ni (and a new lsta
in different state) and may no longer have access to the previous state.
This also saves us from constantly checking for ni changes complicating
code.

No functional changes intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
X-MFC:		move (*iv_update_bss) to spare area
2022-03-22 18:51:43 +00:00
Bjoern A. Zeeb
453d1a90f8 net80211: improve one debug logging
When forcing DEUATH in ieee80211_sta_join1() log the current state
we are coming from as well.  Note this isn't always the state we
are expecting as iv_state was updated already, so contrary to the
comment we usually do not see RUN there.
Leave a comment earlier with regards to this as well.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-22 18:51:43 +00:00
Andrew Turner
83961b7ede Remove the unused arm64 kernel profiling code
It's unused. Remove it in preperation for userspace support.

Sponsored by:	The FreeBSD Foundation
2022-03-22 16:07:54 +00:00
Sebastien Bini
231237bbb0 neta: split fixed and in-band link status configuration
Fixed-link mode requires different handling than the in-band
managed connection. Update interrupt, link-up/down and
autonegotiation settings for the former.

Reviewed by: mw
MFC after: 1 week
Obtained from: Stormshield
Differential Revision: https://reviews.freebsd.org/D34394
2022-03-22 16:52:31 +01:00
Mike Karels
04cd74b4cd IPv4 multicast: fix netstat -g
The vif structure includes fields at the end which are #ifdef KERNEL,
causing a mismatch between the structure sizes between kernel and
user level.  netstat -g failed with an ENOMEM on the sysctl to fetch
the vif table.  Change the vif sysctl code in ip_mroute to copy out
only the user-level-visible portion of each table entry.

Reviewed by:	bz, wma
Differential Revision: https://reviews.freebsd.org/D34627
2022-03-22 07:38:01 -05:00
Mike Karels
2cf1e120c6 Enter epoch when addding IPv4 multicast forwarding cache entry
The code path from the IPv4 multicast setsockopt could call ip_output()
without entering an epoch.  Specifically, the MRT_ADD_MFC setbsocopt
would call add_mfc(), which in turn called ip_mdq() to send queued
packets.  This resulted in an epoch assert failure in ip_output().
Enter an epoch in add_mfc(), and add some epoch asserts to check
for similar failures.

Reviewed by:	kp, bz, wma, cy
Differential Revision: https://reviews.freebsd.org/D34624
2022-03-22 07:28:57 -05:00
Alexander Motin
fd6ca665d2 Fix umtxq_sleep() regression caused by 56070dd2e4.
umtxq_requeue() moves the queue to a different hash chain and different
lock, so we can't rely on msleep_sbt() reacquiring the same old lock.
We have to use PDROP and update the queue chain and so lock pointer.

PR:		262587
MFC after:	2 weeks
2022-03-21 19:55:55 -04:00
Alfredo Dal'Ava Junior
27f56d337b powerpcspe: fix PCI enumeration on ppce500
This fixes PCI devices not being found on QEMU ppce500. This
generic board used to have its first PCI slot at 0x11, like the
mpc8544dsi and some real HW. After commit [1], it was changed to
0x1 and our driver wasn't prepared for that.

[1] 3bb7e02a97

Reviewed by:	jhibbits, bdragon
MFC after:	2 days
Sponsored by:	Institudo de Pesquisas Eldorado (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D34621
2022-03-21 16:11:33 -03:00
Ed Maste
0a4b561f8a Remove unused snd_ds1 file ds1-fw.h
Fixes:		92e6b4712b ("Retire broken snd_ds1 and ...")
Reported by:	joel
2022-03-21 14:21:03 -04:00
Bjoern A. Zeeb
b3b836251f LinuxKPI: pci: implement pci_upstream_bridge()
Allow drivers to query the "upstream PCI bridge".
Currently we point back to ourselves on pdev->bus->self rather than
to the parent PCI bridge.
We keep this as status-quo with an extra comment and only on-demand
allocate a pci_dev for the parent bridge if we are asked for in
pci_upstream_bridge().
When releasing the pci_dev we check if pdev->bus->self has changed
and call pci_dev_put() to release the reference count on the parent
bridge as well.

This code moves pci_is_root_bus() higher up in pci.h but no functional
change there.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	hselasky, (jhb some earlier)
Thanks to:	wulf for handling drm-kmod
Differential Revision: https://reviews.freebsd.org/D34305
2022-03-21 14:35:23 +00:00
firk
bb53dd56c3 kern_tc.c/cputick2usec() (which is used to calculate cputime from
cpu ticks) has some imprecision and, worse, huge timestep (about
20 minutes on 4GHz CPU) near 53.4 days of elapsed time.

kern_time.c/cputick2timespec() (it is used for clock_gettime() for
querying process or thread consumed cpu time) Uses cputick2usec()
and then needlessly converting usec to nsec, obviously losing
precision even with fixed cputick2usec().

kern_time.c/kern_clock_getres() uses some weird (anyway wrong)
formula for getting cputick resolution.

PR:		262215
Reviewed by:	gnn
Differential Revision:	https://reviews.freebsd.org/D34558
2022-03-21 09:33:46 -04:00
Andrew Turner
cab496e16c Make SHMMAXPGS an unsigned long
This is used to calculate sizes that are then stored in unsigned long
fields. Make this unsigned long so the calculations use this type and
not an int that can lead to an integer overflow with a large PAGE_SIZE.

This allows building this on arm64 with PAGE_SIZE of 16k. Further work
will be needed if a 32-bit architecture tries to use a similar sized
page.

Sponsored by:	The FreeBSD Foundation
2022-03-21 10:27:35 +00:00
Dimitry Andric
7819a911ff Merge libcxxrt commit f2e55091e2e878386c9f7974d4922bbdc4faed84
Fix unlock in two-word version and add missing comment.

  Fixes #15
  Fixes #16

This should fix the hangs in __cxa_guard_acquire() reported on i386 (and
possibly other 32-bit platforms).

Obtained from:	https://github.com/libcxxrt/libcxxrt/commit/f2e5509
Fixes:		56aaed388b
MFC after:	2 weeks
2022-03-20 22:34:41 +01:00
Dimitry Andric
bfffb66e7f Reapply libcxxrt atomics cleanup commit, preparing for upstream fix
This reapplies upstream commit fd484be, as there is a follow-up fix for
the possible hangs in __cxa_guard_acquire() on i386:

  Atomics cleanup (#11)

  We need to test exception specifiers but they're gone in C++17 so
  compile the tests with an older version of the standard.

  Rewrite the guard logic to be more idiomatic C++ and more
  comprehensible and make sure that atomics are used where necessary.

Obtained from:	https://github.com/libcxxrt/libcxxrt/commit/fd484be
Fixes:		56aaed388b
MFC after:	2 weeks
2022-03-20 22:25:35 +01:00
Hans Petter Selasky
95e96c00fd mixer.8: Document shorthand syntax for volume setting.
Submitted by:		christos@
Differential Revision:	https://reviews.freebsd.org/D34614
Sponsored by:		NVIDIA Networking
2022-03-20 20:21:07 +01:00
Hans Petter Selasky
bde8460272 mixer.4 and mixer.8: Fix mandoc -Tlint errors.
Submitted by:		christos@
Differential Revision:	https://reviews.freebsd.org/D34603
Sponsored by:		NVIDIA Networking
2022-03-20 20:21:03 +01:00
Hans Petter Selasky
f250ff5ff3 mixer(8): Improve shorthand volume parsing.
The initial patch had a bug where the full volume syntax, floating point values,
:, + and -, wasn't accepted.

While at it move some defines to enum's.

Fixes:			da3d4469ef
Submitted by:		christos@
Differential Revision:	https://reviews.freebsd.org/D34617
Sponsored by:		NVIDIA Networking
2022-03-20 20:19:16 +01:00
Colin Percival
2406867f5b tslog: Add CTLFLAG_SKIP to sysctls
The timestamp logs are quite large (often much larger than all the
other sysctls combined) so it's unlikely anyone will want to have
them displayed by `sysctl -a`.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D34616
2022-03-20 11:31:16 -07:00