]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoLinuxKPI: 802.11 fix locking in lkpi_stop_hw_scan()
Bjoern A. Zeeb [Mon, 10 Jan 2022 22:12:53 +0000 (22:12 +0000)]
LinuxKPI: 802.11 fix locking in lkpi_stop_hw_scan()

In lkpi_stop_hw_scan() we have to unlock around cancelling the
hardware scan and an msleep to wait for the confirmation that the
scan ended.  Otherwise we are sleeping with the non-sleepable
net80211 com lock held.  At the same time we need to hold the lhw
lock for the msleep().
This lock change got lost in the refactoring of lkpi_iv_newstate().

Reported by: ambrisko, delphij
PR: 261075
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

2 years agocxgbe(4): Fix regression in previous attempt to fix FEC selection.
Navdeep Parhar [Mon, 10 Jan 2022 21:54:06 +0000 (13:54 -0800)]
cxgbe(4): Fix regression in previous attempt to fix FEC selection.

Fixes: f3c2987f2f5c91f0801fa8bbf9e1bc09d91aeb46
MFC after: 3 days
Sponsored by: Chelsio Communications

2 years agocxgbe(4): Do not ignore the return value of ifmedia_ioctl.
Navdeep Parhar [Mon, 10 Jan 2022 21:01:51 +0000 (13:01 -0800)]
cxgbe(4): Do not ignore the return value of ifmedia_ioctl.

This ensures that the driver reports an error instead of failing
silently when an invalid media is requested.

Reported by: Suhas Lokesha @ Chelsio
MFC after: 1 week
Sponsored by: Chelsio Communications

2 years agocxgbe(4): Fix build warning for LINT-NOIP.
Navdeep Parhar [Mon, 10 Jan 2022 20:32:39 +0000 (12:32 -0800)]
cxgbe(4): Fix build warning for LINT-NOIP.

MFC after: 1 week
Sponsored by: Chelsio Communications

2 years agocxgbe(4): Fix "set but not used [-Wunused-but-set-variable]" warnings.
Navdeep Parhar [Wed, 5 Jan 2022 20:23:06 +0000 (12:23 -0800)]
cxgbe(4): Fix "set but not used [-Wunused-but-set-variable]" warnings.

MFC after: 1 week
Sponsored by: Chelsio Communications

2 years agocxgb(4): Fix "set but not used [-Wunused-but-set-variable]" warnings.
Navdeep Parhar [Mon, 10 Jan 2022 19:18:38 +0000 (11:18 -0800)]
cxgb(4): Fix "set but not used [-Wunused-but-set-variable]" warnings.

MFC after: 1 week
Sponsored by: Chelsio Communications

2 years agoLinuxKPI: Add sort() wrapper.
Vladimir Kondratyev [Sat, 25 Dec 2021 09:15:07 +0000 (12:15 +0300)]
LinuxKPI: Add sort() wrapper.

swap parameter is not supported as it is rarely used in Linux kernel
and its implementation will add some preprocessor spaghetti to qsort.

Required by drm-kmod.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33675

2 years agoLinuxKPI: Use negative bit field size to trigger BUILD_BUG_ON_ZERO
Vladimir Kondratyev [Sat, 25 Dec 2021 18:42:15 +0000 (21:42 +0300)]
LinuxKPI: Use negative bit field size to trigger BUILD_BUG_ON_ZERO

compile time assertion on non-NULL pointers. Tests conducted show that
_Static_assert, negative array size method and current code does not
handle pointers well enough. Bit field method solves this problem.

This change is derrived from Linux implementation of BUILD_BUG_ON_ZERO.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33674

2 years agoLinuxKPI: Constantly use _LINUXKPI_ prefix in include guards
Vladimir Kondratyev [Sun, 19 Dec 2021 10:42:42 +0000 (13:42 +0300)]
LinuxKPI: Constantly use _LINUXKPI_ prefix in include guards

MFC after: 1 week
Reviewed by: bz, emaste, hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33562

2 years agoLinuxKPI: Import MTRR support functions from drm-kmod
Vladimir Kondratyev [Wed, 8 Dec 2021 21:12:51 +0000 (00:12 +0300)]
LinuxKPI: Import MTRR support functions from drm-kmod

They are superseded by PAT and mostly useless nowadays but still can be
used on Pentium III/IV era processors. Unlike drm-kmod version, this one
ignores MTRR if PAT is available that fixes confusing "Failed to add WC
MTRR for [0xXXXX-0xYYYY]: 22; performance may suffer" message often
appearing during drm-kmod initialization process.

MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33561

2 years agoLinuxKPI: Import linux/ratelimit.h
Vladimir Kondratyev [Wed, 8 Dec 2021 21:05:56 +0000 (00:05 +0300)]
LinuxKPI: Import linux/ratelimit.h

Required by drm-kmod.

Obtained from: OpenBSD
MFC after: 1 week
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D33560

2 years agoLinuxKPI: Add linux/capability.h header
Vladimir Kondratyev [Wed, 8 Dec 2021 21:04:31 +0000 (00:04 +0300)]
LinuxKPI: Add linux/capability.h header

Required by drm-kmod.

Obtained from: DragonflyBSD
MFC after: 1 week
Reviewed by: hselasky, manu

Differential Revision: https://reviews.freebsd.org/D33559

2 years agoLinuxKPI: Add readx_poll_timeout wrapper
Vladimir Kondratyev [Mon, 6 Dec 2021 20:32:51 +0000 (23:32 +0300)]
LinuxKPI: Add readx_poll_timeout wrapper

Required by drm-kmod 5.7

MFC after: 1 week
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D33307

2 years agoLinuxKPI: Add static_cpu_has() implementation
Vladimir Kondratyev [Mon, 6 Dec 2021 10:18:03 +0000 (13:18 +0300)]
LinuxKPI: Add static_cpu_has() implementation

static_cpu_has returns true if CPU supports requested feature.

Obtained from: OpenBSD
MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33301

2 years agoLinuxKPI: Implement efi_enabled(EFI_BOOT)
Vladimir Kondratyev [Mon, 6 Dec 2021 10:14:36 +0000 (13:14 +0300)]
LinuxKPI: Implement efi_enabled(EFI_BOOT)

efi_enabled(EFI_BOOT) returns true if machine was booted from EFI
Used by drm-kmod and some unported drm drivers like hyperv

MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33300

2 years agoLinuxKPI: Import linux/jump_label.h
Vladimir Kondratyev [Mon, 6 Dec 2021 07:59:49 +0000 (10:59 +0300)]
LinuxKPI: Import linux/jump_label.h

Required by drm-kmod

Obtained from: DragonflyBSD
Differential Revision: https://reviews.freebsd.org/D33299

2 years agoLinuxKPI: Move kfree_async() functionality in to kfree()
Vladimir Kondratyev [Mon, 15 Nov 2021 13:53:02 +0000 (16:53 +0300)]
LinuxKPI: Move kfree_async() functionality in to kfree()

Obsolete it usage but keep for a while for drm-kmod 5.4 compatibility

MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33298

2 years agoLinuxKPI: Add stdarg.h proxy header
Vladimir Kondratyev [Sat, 4 Dec 2021 10:00:53 +0000 (13:00 +0300)]
LinuxKPI: Add stdarg.h proxy header

To reduce amount of drm-kmod patching

MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33297

2 years agoLinuxKPI: Add some typical header pollution
Vladimir Kondratyev [Sat, 4 Dec 2021 10:00:53 +0000 (13:00 +0300)]
LinuxKPI: Add some typical header pollution

To reduce amount of drm-kmod patching

MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33297

2 years agoLinuxKPI: Implement smp_*mb barriers with atomic_thread_fence_*
Vladimir Kondratyev [Sun, 4 Jul 2021 14:13:09 +0000 (17:13 +0300)]
LinuxKPI: Implement smp_*mb barriers with atomic_thread_fence_*

for x86 and move them to asm/barrier.h

MFC after: 1 week
Reviewed by: bz, hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33296

2 years agoLinuxKPI: Make lockdep*_pin_lock macros useable for drm-kmod
Vladimir Kondratyev [Fri, 3 Dec 2021 13:38:19 +0000 (16:38 +0300)]
LinuxKPI: Make lockdep*_pin_lock macros useable for drm-kmod

Summary:
- Add dummy struct pin_cookie definition;
- Convert lockdep_pin_lock macro to function;
- Fix 'unused variable' compile-time errors;

MFC after: 1 week
Reviewers: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33295

2 years agoLinuxKPI: Convert schedule() to inlined function
Vladimir Kondratyev [Fri, 3 Dec 2021 15:12:50 +0000 (18:12 +0300)]
LinuxKPI: Convert schedule() to inlined function

to prevent name clashing with drm-kmod

MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33294

2 years agoLinuxKPI: Add support for XA_FLAGS_ALLOC1 xarray flag
Vladimir Kondratyev [Wed, 24 Nov 2021 00:05:40 +0000 (03:05 +0300)]
LinuxKPI: Add support for XA_FLAGS_ALLOC1 xarray flag

XA_FLAGS_ALLOC1 causes allocation of xarray entries starting at 1

Required by drm-kmod 5.7

MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33293

2 years agoLinuxKPI: Implement default sysfs kobject attribute operations
Vladimir Kondratyev [Tue, 23 Nov 2021 09:09:42 +0000 (12:09 +0300)]
LinuxKPI: Implement default sysfs kobject attribute operations

Required by drm-kmod 5.7

MFC after: 1 week
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D33292

2 years agoLinuxKPI: Implement kstrtoull
Vladimir Kondratyev [Tue, 23 Nov 2021 08:32:38 +0000 (11:32 +0300)]
LinuxKPI: Implement kstrtoull

Required by drm-kmod 5.7

MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33291

2 years agoLinuxKPI: Implement dev_driver_string()
Vladimir Kondratyev [Mon, 15 Nov 2021 15:09:14 +0000 (18:09 +0300)]
LinuxKPI: Implement dev_driver_string()

Required by drm-kmod 5.7

MFC after: 1 week
Reviewed by: bz, hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33290

2 years agoLinuxKPI: Implement clflush_cache_range()
Vladimir Kondratyev [Mon, 15 Nov 2021 15:06:50 +0000 (18:06 +0300)]
LinuxKPI: Implement clflush_cache_range()

Required by drm-kmod 5.7

MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33289

2 years agoLinuxKPI: Add clflush argument type conversion wrapper
Vladimir Kondratyev [Mon, 15 Nov 2021 14:48:17 +0000 (17:48 +0300)]
LinuxKPI: Add clflush argument type conversion wrapper

to reduce amount of source patching in drm-kmod.

MFC after: 1 week
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D33288

2 years agoLinuxKPI: Implement interval_tree
Vladimir Kondratyev [Sat, 6 Nov 2021 10:07:02 +0000 (13:07 +0300)]
LinuxKPI: Implement interval_tree

Required by drm-kmod

MFC after: 1 week
Reviewed by: hselasky, manu
Differential Revision: https://reviews.freebsd.org/D32869

2 years agoLinuxKPI: Import some linux/rbtree.h functions from OpenBSD
Vladimir Kondratyev [Fri, 5 Nov 2021 11:43:31 +0000 (14:43 +0300)]
LinuxKPI: Import some linux/rbtree.h functions from OpenBSD

Required by drm-kmod

Obtained from: OpenBSD
MFC after: 1 week

2 years agoLinuxKPI: 802.11 correctly spell queues
Ruslan Makhmatkhanov [Mon, 10 Jan 2022 18:08:17 +0000 (18:08 +0000)]
LinuxKPI: 802.11 correctly spell queues

PR: 261078
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

2 years agoriscv: gdb(4) support
Mitchell Horne [Fri, 11 Sep 2020 17:02:17 +0000 (14:02 -0300)]
riscv: gdb(4) support

Add the MD portion required for the gdb stub.

Reviewed by: jhb (earlier version)
Discussed with: jrtc27
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33734

2 years agolibc: Teak comment about mips
Warner Losh [Mon, 10 Jan 2022 17:14:12 +0000 (10:14 -0700)]
libc: Teak comment about mips

Remove mips from the list of machines using TLS variant I and reformat
paragraph. No functional change intended.

Sponsored by: Netflix

2 years agolinux: Improve debugging by recognizing TIOCGPTPEER
Edward Tomasz Napierala [Thu, 29 Apr 2021 20:26:46 +0000 (21:26 +0100)]
linux: Improve debugging by recognizing TIOCGPTPEER

Sponsored By: EPSRC

2 years agoscript(1): work around slow reading child
Konstantin Belousov [Sat, 8 Jan 2022 13:19:14 +0000 (15:19 +0200)]
script(1): work around slow reading child

If child is slow reading from its input, or even completely stops doing
the read, script(1) hangs in write(2) to the pts master waiting until
there is a space in the terminal discipline buffer.  This also stops
handling any outer io, as well as child output.

Work around the problem by making pts master fd non-blocking, and be
prepared for short writes to it.  The data to be written to master is
buffered in the tailq which is processed when select(2) detects that
master is ready for write.

PR: 260938
Reported by: наб <nabijaczleweli@nabijaczleweli.xyz>
See also: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1003095
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33789

2 years agogpart(8): add minimal reference to glabel(8) to manual page
Eugene Grosbein [Mon, 10 Jan 2022 15:00:30 +0000 (22:00 +0700)]
gpart(8): add minimal reference to glabel(8) to manual page

MFC after: 1 week

2 years agoRevert "iflib: Relax timer period from 0.5 to 0.5-0.75s."
Alexander Motin [Mon, 10 Jan 2022 14:35:01 +0000 (09:35 -0500)]
Revert "iflib: Relax timer period from 0.5 to 0.5-0.75s."

I've noticed relations between iflib_timer() vs ixl_admin_timer().
Both scheduled at the same 2Hz rate, but the second is rescheduling
the first each time, so if the first get any slower, it won't be
executed at all.  Revert this until deeper investigation.

This reverts commit 90bc1cf65778aafb1f226c8fe08218cfed5e40b2.

2 years agohwpmc: Fix amd/arm64/armv7/uncore sampling overflow race
Jessica Clarke [Mon, 10 Jan 2022 14:30:05 +0000 (14:30 +0000)]
hwpmc: Fix amd/arm64/armv7/uncore sampling overflow race

If a counter more than overflows just as we read it on switch out then,
if using sampling mode, we will negate this small value to give a huge
reload count, and if we later switch back in that context we will
validate that value against pm_reloadcount and panic an INVARIANTS
kernel with:

  panic: [pmc,1470] pmcval outside of expected range cpu=2 ri=16 pmcval=fffff292 pm_reloadcount=10000

or similar. Presumably in a non-INVARIANTS kernel we will instead just
use the provided value as the reload count, which would lead to the
overflow not happing for a very long time (e.g. 78 minutes for a 48-bit
counter incrementing at an averate rate of 1GHz).

Instead, clamp the reload count to 0 (which corresponds precisely to the
value we would compute if it had just overflowed and no more), which
will result in hwpmc using the full original reload count again. This is
the approach used by core for Intel (for both fixed and programmable
counters).

As part of this, armv7 and arm64 are made conceptually simpler; rather
than skipping modifying the overflow count for sampling mode counters so
it's always kept as ~0, those special cases are removed so it's always
applicable and the concatentation of it and the hardware counter can
always be viewed as a 64-bit counter, which also makes them look more
like other architectures.

Whilst here, fix an instance of UB (shifting a 1 into the sign bit) for
amd in its sign-extension code.

Reviewed by: andrew, mhorne, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33654

2 years agoFix a typo in an arm64 comment
Andrew Turner [Mon, 10 Jan 2022 13:55:22 +0000 (13:55 +0000)]
Fix a typo in an arm64 comment

This was pointed out by markj in the review, but I missed it and forgot
to fix before pushing.

Reported by: markj
Sponsored by: The FreeBSD Foundation

2 years agoMana: report OS info to PF driver
Wei Hu [Fri, 7 Jan 2022 13:12:31 +0000 (05:12 -0800)]
Mana: report OS info to PF driver

The PF driver might use the OS info for statistical purposes.

MFC after: 2 weeks
Sponsored by: Microsoft

2 years agoMove instructions into the arm64 exception vectors
Andrew Turner [Wed, 5 Jan 2022 15:12:01 +0000 (15:12 +0000)]
Move instructions into the arm64 exception vectors

We have 32 instructions in each exception vector on arm64. Previously
only one was used to branch to the handler function. We can split the
start of these functions and move some of the instructions into the
vectors.

Reviewed by: kib, markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33751

2 years agovm_addr_ok: add power2 invariant check
Doug Moore [Mon, 10 Jan 2022 07:17:25 +0000 (01:17 -0600)]
vm_addr_ok: add power2 invariant check

With INVARIANTS defined, have vm_addr_align_ok and vm_addr_bound_ok
panic when passed an alignment/boundary parameter that is not a power
of two.

Reviewed by: alc
Suggested by: kib, se
Differential Revision: https://reviews.freebsd.org/D33725

2 years agoiflib: Relax timer period from 0.5 to 0.5-0.75s.
Alexander Motin [Mon, 10 Jan 2022 01:32:50 +0000 (20:32 -0500)]
iflib: Relax timer period from 0.5 to 0.5-0.75s.

While there switch it from hardclock ticks to milliseconds.

MFC after: 2 weeks

2 years agoReduce minimum idle hardclock rate from 2Hz to 1Hz.
Alexander Motin [Mon, 10 Jan 2022 00:17:43 +0000 (19:17 -0500)]
Reduce minimum idle hardclock rate from 2Hz to 1Hz.

On idle 80-thread system it allows to improve package-level idle state
residency and so power consumption by several percent.

MFC after: 2 weeks

2 years agoAvoid unnecessary setting of UFS flag requesting fsck(8) be run.
Kirk McKusick [Mon, 10 Jan 2022 00:17:13 +0000 (16:17 -0800)]
Avoid unnecessary setting of UFS flag requesting fsck(8) be run.

When the kernel is requested to mount a filesystem with a bad superblock
check hash, it would set the flag in the superblock requesting that the
fsck(8) program be run. The flag is only written to disk as part of a
superblock update. Since the superblock always has its check hash updated
when it is written to disk, the problem for which the flag has been set
will no longer exist. Hence, it is counter-productive to set the flag
as it will just cause an unnecessary run of fsck if it ever gets written.

Sponsored by: Netflix

2 years agotws: fix "set but not used" in the tws driver
Robert Wing [Sun, 9 Jan 2022 23:28:08 +0000 (14:28 -0900)]
tws: fix "set but not used" in the tws driver

With __diagused, these warnings were still emitted since INVARIANTS was
defined but TWS_DEBUG was not.

Fixes: a21f086a3316 ("Fix "set but not used" in the tws driver")
Differential Revision: https://reviews.freebsd.org/D33784

2 years agonfsd: Reduce callouts rate.
Alexander Motin [Sun, 9 Jan 2022 18:09:29 +0000 (13:09 -0500)]
nfsd: Reduce callouts rate.

Before this callouts were scheduled twice a seconds even if nfsd was
never used.  This reduces the rate to ~1Hz and only after nfsd first
started.

MFC after: 2 weeks

2 years agoLinuxKPI: 802.11 update compat code for driver updates
Bjoern A. Zeeb [Sun, 9 Jan 2022 18:08:47 +0000 (18:08 +0000)]
LinuxKPI: 802.11 update compat code for driver updates

Add more (dummy in case of HE) defines, structs, functions and another
mac80211 function pointer needed to update and support recent drivers.

MFC after: 3 days

2 years agodevd: correct wifi regexp
Warner Losh [Sun, 9 Jan 2022 17:16:31 +0000 (10:16 -0700)]
devd: correct wifi regexp

Correct the wifi regexp to include iwlwifi and remove wi driver that was
has been retired.

Sponsored by: Netflix

2 years agodevd: remove the scsi regexp
Warner Losh [Sun, 9 Jan 2022 17:13:58 +0000 (10:13 -0700)]
devd: remove the scsi regexp

We don't really use the scsi regexp for anything. The rescan was a
workaround that was fixed a long time ago and has been disabled for
ages. And the regexp was incomplete.

Sponsored by: Netflix

2 years agocam: Include more statuses as errors for CAM_IO_STATS
Warner Losh [Sun, 9 Jan 2022 17:13:05 +0000 (10:13 -0700)]
cam: Include more statuses as errors for CAM_IO_STATS

Tag more status return values as an error for the
I/O. CAM_SCSI_STATUS_ERROR is returned for medium errors, for example,
but the counts weren't increased. The added errors all indicate a
problem with the device request.

Sponsored by: Netflix
PR: 260257
Feedback from: ken
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D33783

2 years agoLinuxKPI: bitfields add more *replace_bits()
Bjoern A. Zeeb [Sun, 9 Jan 2022 01:12:05 +0000 (01:12 +0000)]
LinuxKPI: bitfields add more *replace_bits()

Add or extend the already existing *_replace_bits() implementations
using macros as we do for the other parts in the file for
le<n>p_replace_bits(), u<n>p_replace_bits(), and _u<n>_replace_bits().

MFC after: 3 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D33799

2 years agoLinuxKPI: add hex2bin()
Bjoern A. Zeeb [Sun, 9 Jan 2022 01:09:17 +0000 (01:09 +0000)]
LinuxKPI: add hex2bin()

Add a hex2bin() implementation needed by a driver's debugfs code.

MFC after: 3 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D33798

2 years agolinux: More man page tweaks
Edward Tomasz Napierala [Sun, 9 Jan 2022 10:03:44 +0000 (10:03 +0000)]
linux: More man page tweaks

Mention debootstrap(8) and improve the wording.

Reviewed By: debdrup, emaste, Pau Amma
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D33772

2 years agolibc clnt_com_create: relock rpcsoc_lock earlier when port is obtained from portmapper
Konstantin Belousov [Sun, 9 Jan 2022 05:09:22 +0000 (07:09 +0200)]
libc clnt_com_create: relock rpcsoc_lock earlier when port is obtained from portmapper

Otherwise on mapper failure we goto error handler which expect
rpscoc_lock owned, but we do not.

PR: 261051
Reported by: RyanCai <ryancaicse@gmail.com>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoLinuxKPI / iwlwifi: fix spelling of constants
Bjoern A. Zeeb [Sun, 9 Jan 2022 02:21:05 +0000 (02:21 +0000)]
LinuxKPI / iwlwifi: fix spelling of constants

Fix the spelling of IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_*
(was "NOMIMAL").  The original version came from iwlwifi
in iwlwifi-next.  Other drivers (from wireless-testing) already
use the correct spelling and need this change in LinuxKPI.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agosyncache: accept packet with no SA when TCP_MD5SIG is set
Robert Wing [Sun, 9 Jan 2022 01:07:50 +0000 (16:07 -0900)]
syncache: accept packet with no SA when TCP_MD5SIG is set

When TCP_MD5SIG is set on a socket, all packets are dropped that don't
contain an MD5 signature. Relax this behavior to accept a non-signed
packet when a security association doesn't exist with the peer.

This is useful when a listen socket set with TCP_MD5SIG wants to handle
connections protected with and without MD5 signatures.

Reviewed by: bz (previous version)
Sponsored by:   nepustil.net
Sponsored by:   Klara Inc.
Differential Revision: https://reviews.freebsd.org/D33227

2 years agotcpmd5: return ENOENT when security association not found
Robert Wing [Sun, 9 Jan 2022 01:07:10 +0000 (16:07 -0900)]
tcpmd5: return ENOENT when security association not found

Return ENOENT from tcp_ipsec_input() when a security association is not
found. This allows callers of TCP_MD5_INPUT() to differentiate between a
security association not found and receiving a bad signature.

Also return ENOENT from tcp_ipsec_output() for consistency.

Reviewed by: ae
Sponsored by:   nepustil.net
Sponsored by:   Klara Inc.
Differential Revision: https://reviews.freebsd.org/D33226

2 years agoLinuxKPI: 802.11 handle IEEE80211_CONF_IDLE better
Bjoern A. Zeeb [Sun, 9 Jan 2022 00:59:50 +0000 (00:59 +0000)]
LinuxKPI: 802.11 handle IEEE80211_CONF_IDLE better

We never initialized hw->conf.flags for IEEE80211_CONF_IDLE but
on set_channel we would clear it and announce a change.
This lead to a problem that drivers may do some work every time
which was not needed and may lead to unexpected behaviour (for no
better driver code).

Properly initialize conf.flags with IEEE80211_CONF_IDLE.
Factor out the toggling into a function and clear IDLE while
sw scanning and when associated and set again when scan ends
or we are bouncing out of assoc.

MFC after: 3 days

2 years agoLinuxKPI: ip.h add #include
Bjoern A. Zeeb [Sun, 9 Jan 2022 00:57:13 +0000 (00:57 +0000)]
LinuxKPI: ip.h add #include

Also include netinet/in.h so that in_addr in known for ip.h.
Found by compiling a new piece of code which complained.

MFC after: 3 days

2 years agoldconfig: remove two symbols
Konstantin Belousov [Sat, 8 Jan 2022 10:42:36 +0000 (12:42 +0200)]
ldconfig: remove two symbols

_PATH_LD32_HINTS is unused because it is a.out remnant.
_PATH_ELF32_HINTS is provided by rtld_paths.h already.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agostress2: Aded two msdos FS fuzzer tests
Peter Holm [Sat, 8 Jan 2022 06:11:10 +0000 (07:11 +0100)]
stress2: Aded two msdos FS fuzzer tests

2 years agoipfilter: Restore ipfsync
Cy Schubert [Sat, 8 Jan 2022 04:12:50 +0000 (20:12 -0800)]
ipfilter: Restore ipfsync

ipfsync is a WIP sync daemon designed to be used in a failover scenario.
It was removed by 5ee61c7daa511927aae8652d6a3ea78866a50ef8. This commit
restores its three files. ipfsync is in my work queue.

MFC after: 10 days
X-MFC with: 5ee61c7daa511927aae8652d6a3ea78866a50ef8

2 years agoamd64 pmap: preset A and M bits for pmap_qenter() and pmap_kenter() mappings
Konstantin Belousov [Wed, 5 Jan 2022 01:25:41 +0000 (03:25 +0200)]
amd64 pmap: preset A and M bits for pmap_qenter() and pmap_kenter() mappings

This removes one or two atomic update of the pte on access. Also it
makes the pte constant during its lifecycle.

Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33778

2 years agoamd64 pmap: simplify vtopte() and vtopde()
Konstantin Belousov [Wed, 5 Jan 2022 00:26:12 +0000 (02:26 +0200)]
amd64 pmap: simplify vtopte() and vtopde()

Pre-calculate masks and page table/page directory bases, for LA48 and
LA57 cases, trading a conditional for the memory accesses.

This shaves 672 bytes of .text, by the cost of 32 .data bytes.  Note
that eliminated code contained one conditional, and several costly
movabs instructions, which are traded by two memory fetches per
vtop{t,d}e() inlines.

Reviewed by: markj
Discussed with: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33776

2 years agomsdosfs: use mntfs vnode for pm_devvp
Konstantin Belousov [Thu, 6 Jan 2022 01:47:31 +0000 (03:47 +0200)]
msdosfs: use mntfs vnode for pm_devvp

to prevent races with devfs VCHR vnode reclamation, same as it was
done for UFS.

Reported by: pho
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33721

2 years agomsdosfs: on integrity error, fire a task to remount filesystem to ro
Konstantin Belousov [Sat, 25 Dec 2021 19:45:47 +0000 (21:45 +0200)]
msdosfs: on integrity error, fire a task to remount filesystem to ro

In collaboration with: pho
Reviewed by: markj, mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33721

2 years agomsdosfs: add msdosfs_integrity_error()
Konstantin Belousov [Sat, 25 Dec 2021 21:20:56 +0000 (23:20 +0200)]
msdosfs: add msdosfs_integrity_error()

A function to remount the filesystem from rw to ro on integrity error.
The work is performed in taskqueue to allow the call to be done from
almost arbitrary context where erronous state was detected.

Tested by: pho
Reviewed by: markj, mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33721

2 years agoAdd vfs_remount_ro()
Konstantin Belousov [Sat, 25 Dec 2021 19:44:59 +0000 (21:44 +0200)]
Add vfs_remount_ro()

a helper to remount filesystem from rw to ro.

Tested by: pho
Reviewed by: markj, mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33721

2 years agomsdosfs: sanity check sector count from BPB
Konstantin Belousov [Thu, 30 Dec 2021 19:45:40 +0000 (21:45 +0200)]
msdosfs: sanity check sector count from BPB

We use sector count to size the FAT inuse bitset.  If sector count is
corrupted, kernel might be tricked into doing unbound allocation.
Ensure that the sector count does not exceed the actual volume size.

In collaboration with: pho
Reviewed by: markj, mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33721

2 years agomsdosfs: clusterfree() is used only in error handling cases
Konstantin Belousov [Tue, 4 Jan 2022 14:43:02 +0000 (16:43 +0200)]
msdosfs: clusterfree() is used only in error handling cases

Change its return type to void, because its result is ignored in both
call sites.  Remove oldcnp argument as well, it is NULL always.

Suggested and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33721

2 years agomsdosfs: do no allow lookup to return vdp except for dot lookups
Konstantin Belousov [Sun, 26 Dec 2021 21:51:48 +0000 (23:51 +0200)]
msdosfs: do no allow lookup to return vdp except for dot lookups

In collaboaration with: pho
Reviewed by: markj, mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33721

2 years agomsdosfs: handle a case when non-dot lookup returned dvp
Konstantin Belousov [Tue, 28 Dec 2021 13:41:30 +0000 (15:41 +0200)]
msdosfs: handle a case when non-dot lookup returned dvp

This means that filesystem is corrupted, there is a loop.

In collaboration with: pho
Reviewed by: markj, mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33721

2 years agomsdosfs: take inusemap inconsistency as an error, not invariants violation
Konstantin Belousov [Sat, 25 Dec 2021 18:39:15 +0000 (20:39 +0200)]
msdosfs: take inusemap inconsistency as an error, not invariants violation

In other words, stop silently accepting freeing free cluster in
non-debug kernels, but return the error to the caller.  Modify callers
to handle errors from usemap_free().

In collaboration with: pho
Reviewed by: markj, mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33721

2 years agomsdosfs: handle inconsistently hashed denodes
Konstantin Belousov [Thu, 23 Dec 2021 23:21:53 +0000 (01:21 +0200)]
msdosfs: handle inconsistently hashed denodes

It is possible, on the corrupted msdosfs volume, to have file which
denode inode number does not match the one calculated using directory
cluster.  Instead of asserting the condition as impossible, handle it
and return error, after reclaiming the aliased vnode.

In collaboration with: pho
Reviewed by: markj, mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33721

2 years agogeom label msdosfs: sanity check BPB before using it for io request
Konstantin Belousov [Thu, 30 Dec 2021 13:17:59 +0000 (15:17 +0200)]
geom label msdosfs: sanity check BPB before using it for io request

It must be greater than zero, and be multiple of the device block size.

In collaboration with: pho
Reviewed by: markj, mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33721

2 years agomps/mpr: Relax doorbell polling precision.
Alexander Motin [Sat, 8 Jan 2022 02:30:12 +0000 (21:30 -0500)]
mps/mpr: Relax doorbell polling precision.

It does not matter how often do we check firmware for crashes.

MFC after: 2 weeks

2 years agoBuild libclang also if LLDB is enabled
Ed Maste [Fri, 7 Jan 2022 15:34:08 +0000 (10:34 -0500)]
Build libclang also if LLDB is enabled

LLDB depends on libclang as it uses Clang as the expression parser.
Previously setting WITHOUT_CLANG but leaving LLDB enabled (as default)
resulted in a build failure.

Users who set WITHOUT_CLANG in order to reduce build time or size
might want to set WITHOUT_LLDB in addition to WITHOUT_CLANG, or use
WITHOUT_TOOLCHAIN instead.

PR: 260993
Reported by: eugen
Reviewed by: dim
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

2 years agoFix build. Sorry.
Alexander Motin [Fri, 7 Jan 2022 19:33:51 +0000 (14:33 -0500)]
Fix build.  Sorry.

MFC after: 2 weeks

2 years agoCTL: Relax callouts precisions.
Alexander Motin [Fri, 7 Jan 2022 19:30:44 +0000 (14:30 -0500)]
CTL: Relax callouts precisions.

MFC after: 2 weeks

2 years agonvme: Do not rearm timeout for commands without one.
Alexander Motin [Fri, 7 Jan 2022 17:54:49 +0000 (12:54 -0500)]
nvme: Do not rearm timeout for commands without one.

Admin queues almost always have several ASYNC_EVENT_REQUEST outstanding.
They have no timeouts, but their presence in qpair->outstanding_tr caused
useless timeout callout rearming twice a second.

While there, relax timeout callout period from 0.5s to 0.5-1s to improve
aggregation.  Command timeouts are measured in seconds, so we don't need
to be precise here.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D33781

2 years agocam: Relax callouts precisions.
Alexander Motin [Fri, 7 Jan 2022 17:49:21 +0000 (12:49 -0500)]
cam: Relax callouts precisions.

On large systems even relatively rare callouts may fire many times
per second.  This should allow them to aggregate better, since we do
not require any precision when polling for media change, etc.

MFC after: 2 weeks

2 years agonet/if_pfsync.h: Add back to bad files
Warner Losh [Fri, 7 Jan 2022 16:36:25 +0000 (09:36 -0700)]
net/if_pfsync.h: Add back to bad files

This file does not build for WITHOUT_PF sometimes. Looking at various
ways to cope (it exposes other issues too), but in the mean time just
add it back here to unbreak WITHOUT_PF in some scenarios.

Sponsored by: Netflix

2 years agoddb: Remove SOFTWARE_SSTEP support
Warner Losh [Fri, 7 Jan 2022 16:25:33 +0000 (09:25 -0700)]
ddb: Remove SOFTWARE_SSTEP support

It was needed for mips only, and only kinda sorta worked for mips. It
can be brought back if we grow another architecture that need it.

Sponsored by: Netflix

2 years agowbwd: Move set but not used variable test under notyet
Warner Losh [Fri, 7 Jan 2022 16:23:00 +0000 (09:23 -0700)]
wbwd: Move set but not used variable test under notyet

Sponsored by: Netflix

2 years agoRemove mips dtrace.
Warner Losh [Fri, 7 Jan 2022 15:59:15 +0000 (08:59 -0700)]
Remove mips dtrace.

Remove mips dtrace code. It's no longer needed.

Sponsored by: Netflix

2 years agopowerpc/aim: ifdef DDB pmap debugging functions
Warner Losh [Fri, 7 Jan 2022 15:48:08 +0000 (08:48 -0700)]
powerpc/aim: ifdef DDB pmap debugging functions

INVARIANTS and DDB can be enabled independently.

Submitted by: Sterling Jensen
Pull Request: https://github.com/freebsd/freebsd-src/pull/566

2 years agoFix 'make cscope' with ALL_ARCH defined
Mitchell Horne [Fri, 7 Jan 2022 15:53:52 +0000 (11:53 -0400)]
Fix 'make cscope' with ALL_ARCH defined

The sys/mips directory has been removed.

2 years agoFix "Mesurement" typo in usr.sbin/acpi/acpiconf/acpiconf.c
Matt Audesse [Fri, 17 Dec 2021 00:16:40 +0000 (19:16 -0500)]
Fix "Mesurement" typo in usr.sbin/acpi/acpiconf/acpiconf.c

Pull Request: https://github.com/freebsd/freebsd-src/pull/572

2 years agofile: Fix cross-compilation on Darwin/macOS
Jose Luis Duran [Wed, 5 Jan 2022 12:13:22 +0000 (09:13 -0300)]
file: Fix cross-compilation on Darwin/macOS

Darwin/macOS does not have pipe2(2).

Apply a similar guard as in f3d7ace4b235422e5ccff0315f2965ac935241d8
after 43a5ec4eb41567cc92586503212743d89686d78f.

Pull Request: https://github.com/freebsd/freebsd-src/pull/574

2 years agortwn(4): Add new USB ID.
Hans Petter Selasky [Fri, 7 Jan 2022 13:00:36 +0000 (14:00 +0100)]
rtwn(4): Add new USB ID.

Submitted by: arved@
PR: 260952
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agouchcom(4): Add new USB ID.
Hans Petter Selasky [Fri, 7 Jan 2022 12:56:47 +0000 (13:56 +0100)]
uchcom(4): Add new USB ID.

Submitted by: darius@dons.net.au
PR: 260783
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoFix formatting of the usage() output
Scott Long [Fri, 7 Jan 2022 05:59:18 +0000 (22:59 -0700)]
Fix formatting of the usage() output

2 years agolibsoft: Remove
Warner Losh [Fri, 7 Jan 2022 05:34:25 +0000 (22:34 -0700)]
libsoft: Remove

libsoft was a transition from the FreeBSD/armv6 10 (and earlier) with
'softfp' ABI (that is, hardware float, but passed as integer registers)
to the 'hardfp' ABI that was in FreeBSD/armv[67] in FreeBSD 11 and
newer. It's been off by default since it was created.

This was mostly used by people that wanted to do a source upgrade of
their system from FreeBSD 10 to 11 or from 11-current before the cutover
to 11-current after. This should not be confused with the full software
floating point implementation (that doesn't use the hardware floating
point instructions at all) that is used out of tree by at least one
company selling armv7 gear that has no FPU.

There's no longer a need for the transition, so retire it like should
likely have happened sometime before FreeBSD 12 was released 3 years
ago.

Sponsored by: Netflix
Suggestions by: jrtc27, jhb
Reviewed by: manu, mmel
Differential Revision: https://reviews.freebsd.org/D33761

2 years agortld-elf: Remove libsoft support
Warner Losh [Fri, 7 Jan 2022 05:34:21 +0000 (22:34 -0700)]
rtld-elf: Remove libsoft support

Remove support for loading libsoft libraries.

Sponsored by: Netflix

2 years agoldconfig: remove libsoft support
Warner Losh [Fri, 7 Jan 2022 05:41:38 +0000 (22:41 -0700)]
ldconfig: remove libsoft support

Remove support for -soft and its implementation. This arg was never
documented, so no need to remove it from the man page.

Sponsored by: Netflix

2 years agolibsoft: Remove runtime ldconfig support for libsoft
Warner Losh [Fri, 7 Jan 2022 05:34:18 +0000 (22:34 -0700)]
libsoft: Remove runtime ldconfig support for libsoft

Remove the runtime support for running ldconfig at boot to cache lists
of libsoft libbraries.

Sponsored by: Netflix

2 years agolibsoft: Remove targets to generate libsoft
Warner Losh [Fri, 7 Jan 2022 05:34:15 +0000 (22:34 -0700)]
libsoft: Remove targets to generate libsoft

Remove the targets needed to make and install libsoft.

Sponsored by: Netflix

2 years agolibsoft: Remove support for installing libsoft
Warner Losh [Fri, 7 Jan 2022 05:34:10 +0000 (22:34 -0700)]
libsoft: Remove support for installing libsoft

Remove the infrasturcture needed to create the libsoft directories.

Sponsored by: Netflix

2 years agocryptocheck: Add aliases for algs with multiple key sizes.
John Baldwin [Thu, 6 Jan 2022 22:46:50 +0000 (14:46 -0800)]
cryptocheck: Add aliases for algs with multiple key sizes.

Previously algorithms such as AES-CBC would provide an algorithm
without a key size for the smallest key size and additional algorithms
with an explicit key size, e.g. "aes-cbc" (128 bits), "aes-cbc192",
and "aes-cbc256".

Instead, always make the key size name explicit and reuse the
"generic" name to request running tests against all of the key sizes.
For example, for AES-CBC this means "aes-cbc128" is now the name of
the variant with a 128-bit key and "aes-cbc" runs tests of AES-CBC
with all three key sizes.

This makes it easier to run tests on all combinations of ciphers like
AES-GCM or AES-CCM with -z in a single invocation.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33759