]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agonewfs_msdos: fix type of kern.maxphys
Eric van Gyzen [Mon, 31 Jan 2022 20:34:17 +0000 (14:34 -0600)]
newfs_msdos: fix type of kern.maxphys

The type of the kern.maxphys sysctl OID is now ulong.  Change the
local variable type to match.

Reviewed by: delphij, emaste
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D34116

2 years agonetinet: allow UDP tunnels to be removed
Kristof Provost [Tue, 15 Feb 2022 10:49:39 +0000 (11:49 +0100)]
netinet: allow UDP tunnels to be removed

udp_set_kernel_tunneling() rejects new callbacks if one is already set.
Allow callbacks to be cleared. The use case for this is OpenVPN DCO,
where the socket is opened by userspace and then adopted by the kernel
to run the tunnel. If the DCO interface is removed but userspace does
not close the socket (something the kernel cannot prevent) the installed
callbacks could be called with an invalidated context.

Allow new functions to be set, but only if they're NULL (i.e. allow the
callback functions to be cleared).

Reviewed by: tuexen
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34288

2 years agoLinuxKPI: pci.h add more defines
Bjoern A. Zeeb [Tue, 15 Feb 2022 23:51:40 +0000 (23:51 +0000)]
LinuxKPI: pci.h add more defines

Add and sort in more defines needed by newer drivers.

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

2 years agostress2: Finish work on two gunion(8) test scenarios
Peter Holm [Wed, 16 Feb 2022 09:20:39 +0000 (10:20 +0100)]
stress2: Finish work on two gunion(8) test scenarios

2 years agoaw_mmc: add crash dumping support in MMCCAM mode
Andriy Gapon [Wed, 16 Feb 2022 07:56:06 +0000 (09:56 +0200)]
aw_mmc: add crash dumping support in MMCCAM mode

MFC after: 1 week

2 years agoliberate wdog_kern_pat call from SW_WATCHDOG in arm minimdump code
Andriy Gapon [Wed, 16 Feb 2022 07:53:42 +0000 (09:53 +0200)]
liberate wdog_kern_pat call from SW_WATCHDOG in arm minimdump code

Obviosuly, there are hardware watchdogs on arm.

MFC after: 1 week

2 years agocrypto: hide crypto_destroyreq behind a tunable
Mateusz Guzik [Wed, 16 Feb 2022 07:45:12 +0000 (07:45 +0000)]
crypto: hide crypto_destroyreq behind a tunable

Reviewed by: jhb, markj
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32084

2 years agoLinuxKPI: 802.11 enahnce linuxkpi_ieee80211_iterate_interfaces()
Bjoern A. Zeeb [Wed, 16 Feb 2022 03:56:54 +0000 (03:56 +0000)]
LinuxKPI: 802.11 enahnce linuxkpi_ieee80211_iterate_interfaces()

Add support for IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER in
linuxkpi_ieee80211_iterate_interfaces() needed by a driver.

MFC after: 3 days

2 years agoLinuxKPI: 802.11 assign an(y) early chandef
Bjoern A. Zeeb [Wed, 16 Feb 2022 03:48:54 +0000 (03:48 +0000)]
LinuxKPI: 802.11 assign an(y) early chandef

The Realtek driver assumes an early chandef to be set.  At the time
of linuxkpi_ieee80211_ifattach() we do not really know one yet so
try to find the first one which is available and set that.
This prevents a NULL-deref panic.

MFC after: 3 days

2 years agoLinuxKPI: 802.11: defer workq allocation until we have a name
Bjoern A. Zeeb [Wed, 16 Feb 2022 03:20:29 +0000 (03:20 +0000)]
LinuxKPI: 802.11: defer workq allocation until we have a name

Turned out all the workq's taskqueues were named "wlanNA" if you had
more then one card in a machine as by the time we called wiphy_name()
the device name was not set yet and we returned the fallback.

Move the alloc_ordered_workqueue() from linuxkpi_ieee80211_alloc_hw()
to linuxkpi_ieee80211_ifattach() at which time the device name has
to be set to give us a unique name.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoLinuxKPI: 802.11 scan update
Bjoern A. Zeeb [Wed, 16 Feb 2022 03:00:34 +0000 (03:00 +0000)]
LinuxKPI: 802.11 scan update

Realtek's rtw88 is returning a hard-coded 1 in case they cannot
hw_scan (fw not advertising it).  In that case if we want any scan
to run we need to fall-back to sw scan.  Start dealing with this.
Long-term we probably need to keep internal state.

MFC after: 3 days

2 years agoarmv8crypto: Use cursors to access crypto buffer data
Mark Johnston [Wed, 16 Feb 2022 02:50:41 +0000 (21:50 -0500)]
armv8crypto: Use cursors to access crypto buffer data

Currently armv8crypto copies the scheme used in aesni(9), where payload
data and output buffers are allocated on the fly if the crypto buffer is
not virtually contiguous.  This scheme is simple but incurs a lot of
overhead: for an encryption request with a separate output buffer we
have to
- allocate a temporary buffer to hold the payload
- copy input data into the buffer
- copy the encrypted payload to the output buffer
- zero the temporary buffer before freeing it

We have a handy crypto buffer cursor abstraction now, so reimplement the
armv8crypto routines using that instead of temporary buffers.  This
introduces some extra complexity, but gallatin@ reports a 10% throughput
improvement with a KTLS workload without additional CPU usage.  The
driver still allocates an AAD buffer for AES-GCM if necessary.

Reviewed by: jhb
Tested by: gallatin
Sponsored by: Ampere Computing LLC
Submitted by: Klara Inc.
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D28950

2 years agoarmv8crypto: Factor out some duplicated GCM code
Mark Johnston [Wed, 16 Feb 2022 02:45:59 +0000 (21:45 -0500)]
armv8crypto: Factor out some duplicated GCM code

This is in preparation for using buffer cursors.  No functional change
intended.

Reviewed by: jhb
Sponsored by: Ampere Computing LLC
Submitted by: Klara Inc.
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D28948

2 years agoopencrypto: Add a routine to copy a crypto buffer cursor
Mark Johnston [Wed, 16 Feb 2022 02:45:32 +0000 (21:45 -0500)]
opencrypto: Add a routine to copy a crypto buffer cursor

This was useful in converting armv8crypto to use buffer cursors.  There
are some cases where one wants to make two passes over data, and this
provides a way to "reset" a cursor.

Reviewed by: jhb
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D28949

2 years agoLinuxKPI: skbuff updates
Bjoern A. Zeeb [Wed, 16 Feb 2022 02:10:10 +0000 (02:10 +0000)]
LinuxKPI: skbuff updates

Various updates to skbuff for new/updated drivers and some housekeeping:
- update types and struct members, add new (stub) functions
- improve freeing of frags.
- fix an issue with sleeping during alloc for dev_alloc_skb().
- Adjust a KASSERT for skb_reserve() which apparently can be called
  multiple times if no data was put into the skb yet.
- move the sysctl from linux_8022.c (which may be in a different module)
  to linux_skbuff.c so in case we turn debugging on we do not run into
  unresolved symbols.  Rename the sysctl variable to be less conflicting
  and update debugging macros along with that; also add IMPROVE().
- add DDB support to show an skbuff.
- adjust comments/whitespace.

No functional changes intended for iwlwifi.

Sponsored by: The FreeBSD Foundation (partially)
MFC after: 3 days

2 years agoLinuxKPI: 802.11 header updates and add/adjust source dependencies.
Bjoern A. Zeeb [Tue, 15 Feb 2022 23:45:15 +0000 (23:45 +0000)]
LinuxKPI: 802.11 header updates and add/adjust source dependencies.

This update is for more/newer versions of drivers:
- add and properly place more structs, enums, defines needed by drivers.
- correct types of struct fields.
- make various function arguments const.
- move REG_RULE() macro to its own file regulatory.h and
  use macros for calculations.
- add linuxkpi_ieee80211_get_channel() implementation.
- change linuxkpi_ieee80211_ifattach() to return int for error checking.

No intended functional changes for iwlwifi.

Sponsored by: The FreeBSD Foundation (partially)
MFC after: 3 days

2 years agoLinuxKPI: lockdep add lockdep_assert_not_held()
Bjoern A. Zeeb [Wed, 9 Feb 2022 12:01:32 +0000 (12:01 +0000)]
LinuxKPI: lockdep add lockdep_assert_not_held()

Add lockdep_assert_not_held() asserting LA_UNLOCKED as needed by a
driver.

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

2 years agogssd: Modify /etc/rc.d/gssd so that it starts after NETWORKING
Rick Macklem [Tue, 15 Feb 2022 22:18:23 +0000 (14:18 -0800)]
gssd: Modify /etc/rc.d/gssd so that it starts after NETWORKING

Arno Tuber reported via email that he needed to restart the gssd daemon
after booting, to get his Kerberized NFS mount to work.

Without this patch, rcorder shows that the gssd starts before NETWORKING
and kdc. The gssd will need NETWORKING to connect to the KDC and, if
the kdc is running on the same system, it does not make sense to start it
before the kdc.  This fixed the problem for Arno.

While here, I also added a "# BEFORE: mountcritremote".
It does not affect ordering at this time, but I felt
it should be added, since the gssd needs to be running
when remote NFS mounts are done.

PR: 261939
Reported by: anothatuber@gmail.com
Tested by: anothatuber@gmail.com
Reviewed by: rew
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34265

2 years agoCirrus-CI: add a manual amd64-gcc9 build and smoketest job
Ed Maste [Mon, 14 Feb 2022 20:02:08 +0000 (15:02 -0500)]
Cirrus-CI: add a manual amd64-gcc9 build and smoketest job

Allow users to test changes and find GCC-specific issues using Cirrus-CI
against their own GitHub forks.

Reviewed by: lwhsu, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34289

2 years agofd: add fde_copy
Mateusz Guzik [Mon, 14 Feb 2022 15:43:19 +0000 (16:43 +0100)]
fd: add fde_copy

To dedup handrolled memcpy. This will be used later to make fd code
atomic-clean.

2 years agofd: add missing seqc to dupfdopen
Mateusz Guzik [Mon, 14 Feb 2022 15:33:24 +0000 (16:33 +0100)]
fd: add missing seqc to dupfdopen

2 years agoseqc: rename seqc_consistent_nomb to seqc_consistent_no_fence
Mateusz Guzik [Mon, 14 Feb 2022 18:50:37 +0000 (19:50 +0100)]
seqc: rename seqc_consistent_nomb to seqc_consistent_no_fence

For more consistency with other primitives.

2 years agoiscsi: Use calloutng instead of ticks in iscsi initiator
Richard Scheffenegger [Tue, 15 Feb 2022 16:35:47 +0000 (17:35 +0100)]
iscsi: Use calloutng instead of ticks in iscsi initiator

callout *_sbt functions are used to reduce ping/timeout scheduling
overhead, while allowing later improvments in the functionality.
Keep similar 1000ms callouts while adding a 10 ms window, to allow
some kernel scheduling improvements.

Reviewed By: jhb
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34222

2 years agobhyve/snapshot: use a string for cmd element in the nvlist
Robert Wing [Tue, 15 Feb 2022 17:12:15 +0000 (08:12 -0900)]
bhyve/snapshot: use a string for cmd element in the nvlist

The nvlist for a checkpoint request will now look like:

    { cmd="checkpoint", suspend="true/false", filename="afilename" }

Reviewed by: jhb
Suggested by:   jhb
Differential Revision: https://reviews.freebsd.org/D34237

2 years agolibpmc: Allow specifying explicit EVENT_xxH events on armv7 and arm64
Jessica Clarke [Tue, 15 Feb 2022 16:10:34 +0000 (16:10 +0000)]
libpmc: Allow specifying explicit EVENT_xxH events on armv7 and arm64

This is useful for processors where we don't have an event table; in
those cases we default to a Cortex A8 (armv7) or Cortex A53 (arm64) in
order to attempt to provide something useful, but you're then limited to
the counters in those tables, some of which may also not be implemented
(e.g. LD/ST_RETIRED are no longer implemented in more recent cores,
replaced by LD/ST_SPEC).

Adding the raw EVENT_xxH event lists to each table ensures that you can
always request the exact events you want, regardless of what has been
detected or is known.

Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33805

2 years agomlx5e: Make TLS tag zones unmanaged
Mark Johnston [Tue, 15 Feb 2022 14:03:31 +0000 (09:03 -0500)]
mlx5e: Make TLS tag zones unmanaged

These zones are cache zones used to allocate TLS offload contexts from
firmware.  Releasing items from the cache is a sleepable operation due
to the need to await a response from the firmware command freeing the
tag, so items cannot be reclaimed from the zone in non-sleepable
contexts.  Since the cache size is limited by firmware limits, avoid
this by setting UMA_ZONE_UNMANAGED to avoid reclamation by uma_timeout()
and the low memory handler.

Reviewed by: hselasky, kib
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34142

2 years agouma: Add UMA_ZONE_UNMANAGED
Mark Johnston [Tue, 15 Feb 2022 13:57:22 +0000 (08:57 -0500)]
uma: Add UMA_ZONE_UNMANAGED

Allow a zone to opt out of cache size management.  In particular,
uma_reclaim() and uma_reclaim_domain() will not reclaim any memory from
the zone, nor will uma_timeout() purge cached items if the zone is idle.
This effectively means that the zone consumer has control over when
items are reclaimed from the cache.  In particular, uma_zone_reclaim()
will still reclaim cached items from an unmanaged zone.

Reviewed by: hselasky, kib
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34142

2 years agoelfctl: whitespace cleanup
Ed Maste [Tue, 15 Feb 2022 13:45:05 +0000 (08:45 -0500)]
elfctl: whitespace cleanup

Reported by: jrm (in review D34283)

2 years agoif_epair: Use ANSI C definition
Li-Wen Hsu [Tue, 15 Feb 2022 13:45:22 +0000 (21:45 +0800)]
if_epair: Use ANSI C definition

This fixes -Werror=strict-prototypes from gcc9

Sponsored by: The FreeBSD Foundation

2 years agoelfctl: fix operations with multiple features on multiple files
Ed Maste [Tue, 15 Feb 2022 03:44:01 +0000 (22:44 -0500)]
elfctl: fix operations with multiple features on multiple files

Previously an invocation like

  elfctl -e +feature1,feature2 file1 file2

would set both feature flags in file 1 but only feature1 in file2 (due
to the string being modified by strsep()).

Reported by: jrm
Tested by: jrm
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34283

2 years agotcp: Restore 6 tcps padding entries in HEAD
Richard Scheffenegger [Tue, 15 Feb 2022 07:56:49 +0000 (08:56 +0100)]
tcp: Restore 6 tcps padding entries in HEAD

The padding in CURRENT shall not shrink. It is
designed that in CURRENT at always stays
the same, and then when a new stable is branched, it
inherits 6 pointer placeholders that can be used
withing this stable/X lifetime to extend the structure.

Reviewed By: tuexen, #transport
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34269

2 years agoif_epair: implement fanout
Kristof Provost [Thu, 9 Dec 2021 13:24:13 +0000 (14:24 +0100)]
if_epair: implement fanout

Allow multiple cores to be used to process if_epair traffic. We do this
(if RSS is enabled) based on the RSS hash of the incoming packet. This
allows us to distribute the load over multiple cores, rather than
sending everything to the same one.

We also switch from swi_sched() to taskqueues, which also contributes to
better throughput.

Benchmark results:
With net.isr.maxthreads=-1

Setup A: (cc0 - bridge0 - epair0a) (epair0b - bridge1 - cc1)

Before          627 Kpps
After (no RSS)  1.198 Mpps
After (RSS)     3.148 Mpps

Setup B: (cc0 - bridge0 - epaira0) (epair0b - vnet jail - epair1a) (epair1b - bridge1 - cc1)

Before          7.705 Kpps
After (no RSS)  1.017 Mpps
After (RSS)     2.083 Mpps

MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D33731

2 years agovlan tests: fix bpf_pcp test
Kristof Provost [Tue, 15 Feb 2022 06:52:45 +0000 (07:52 +0100)]
vlan tests: fix bpf_pcp test

We now allow net.link.vlan.mtag_pcp to be set per-vnet, so we must set
it in the correct vnet, not on the host.

2 years agomana: Add handling of CQE_RX_TRUNCATED
Wei Hu [Tue, 15 Feb 2022 07:07:31 +0000 (23:07 -0800)]
mana: Add handling of CQE_RX_TRUNCATED

The proper way to drop this kind of CQE is advancing rxq tail
without indicating the packet to the upper network layer.

MFC after: 2 weeks
Sponsored by: Microsoft

2 years agoelfctl: fix -e invalid operation error handling
Ed Maste [Tue, 15 Feb 2022 03:30:29 +0000 (22:30 -0500)]
elfctl: fix -e invalid operation error handling

Validate the operation prior to parsing the feature string, so that e.g.
-e 0x1 reports invalid operation '0' rather than invalid feature 'x11'.
Also make it an error rather than a warning, so that it is not repeated
if multiple files are specified.

(Previously an invalid operation resulted in a segfault.)

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

2 years agoelfctl: error if -e is specified multiple times
Ed Maste [Tue, 15 Feb 2022 03:04:29 +0000 (22:04 -0500)]
elfctl: error if -e is specified multiple times

Reported by: jrm
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

2 years agoBump __FreeBSD_version to 1400052 for LinuxKPI changes.
Bjoern A. Zeeb [Mon, 14 Feb 2022 23:55:16 +0000 (23:55 +0000)]
Bump __FreeBSD_version to 1400052 for LinuxKPI changes.

Add a marker after GUID_INIT() and linux/pm_qos.h were added, so
that future version of drm-kmod can selectively remove these bits.
The latest port version does not require user updates for this so
no UPDATING entry.

2 years agoLinuxKPI: add linux/pm_qos.h
Bjoern A. Zeeb [Wed, 9 Feb 2022 12:07:44 +0000 (12:07 +0000)]
LinuxKPI: add linux/pm_qos.h

Add a linux/pm_qos.h with three dummy functions and a struct as needed
by a driver and drm-kmod [1] with no intend to support this for the moment.

Submitted by: wulf (drm-kmod bits) [1]
Sponsored by: The FreeBSD Foundation (drm-kmod requested updates)
MFC after: 3 days
Reviewed by: hselasky (earlier version), wulf
Differential Revision: https://reviews.freebsd.org/D34234

2 years agoLinuxKPI: add UUID_STRING_LEN and GUID_INIT to uuid.h
Bjoern A. Zeeb [Wed, 9 Feb 2022 12:10:59 +0000 (12:10 +0000)]
LinuxKPI: add UUID_STRING_LEN and GUID_INIT to uuid.h

Add a definition for UUID_STRING_LEN to uuid.h as needed by a driver.
Also add GUID_INIT for drm-kmod [1].

Submitted by: wulf [1]
MFC after: 3 days
Reviewed by: hselasky (earlier), wulf
Differential Revision: https://reviews.freebsd.org/D34235

2 years agoLinuxKPI: 802.11: get rid of lkpi_ic_getradiocaps warnings
Bjoern A. Zeeb [Mon, 14 Feb 2022 22:29:38 +0000 (22:29 +0000)]
LinuxKPI: 802.11: get rid of lkpi_ic_getradiocaps warnings

Users are seeing warnings about 2 channels (1 per band)
triggered by an ioctl from wpa_supplicant usually:
lkpi_ic_getradiocaps: Adding chan ... returned error 55
This was an early FAQ.

Check the current number of channels against maxchans and the return
code from net80211. In case net80211 reports that we reached the limit
do not print the warning and do not try to add further channels.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agopf tests: Basic 'set prio' test
Kristof Provost [Mon, 14 Feb 2022 17:44:15 +0000 (18:44 +0100)]
pf tests: Basic 'set prio' test

The ability to set VLAN PCP from pf was introduced in 3e248e0fb4, but
never had a test added.

Create a basic setup to set the PCP to an arbitrary value and use
tcpdump to check it's actually set.

MFC after: 1 week

2 years agovlan: allow net.link.vlan.mtag_pcp to be set per vnet
Kristof Provost [Mon, 14 Feb 2022 19:09:54 +0000 (20:09 +0100)]
vlan: allow net.link.vlan.mtag_pcp to be set per vnet

The primary reason for this change is to facilitate testing.

MFC after: 1 week

2 years agopf: fix set_prio after nv conversion
Franco Fichtner [Mon, 14 Feb 2022 19:26:39 +0000 (20:26 +0100)]
pf: fix set_prio after nv conversion

Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34266

2 years agonet80211: enhance (disabled) debugging
Bjoern A. Zeeb [Mon, 14 Feb 2022 22:16:59 +0000 (22:16 +0000)]
net80211: enhance (disabled) debugging

Add maxchans to the disabled debugging in addchan() and copychan_prev()
to aid debugging possible errors rreturned due to reaching maxchans
limits.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoveriexec(8): explain that only a unique prefix is required
Simon J. Gerraty [Mon, 14 Feb 2022 21:52:40 +0000 (13:52 -0800)]
veriexec(8): explain that only a unique prefix is required

When setting or querying state it is sufficient to
provide only enough of the state name to be unambiguous.

2 years agoCirrus-CI: use qemu-nox11
Ed Maste [Mon, 14 Feb 2022 20:14:02 +0000 (15:14 -0500)]
Cirrus-CI: use qemu-nox11

We use -nographic for the smoke test and there is no need to pull in all
of the x11 deps.  This saves some time and bandwidth during package
installation.

When I originally added Cirrus-CI support the -nox11 package was not
available.

Sponsored by: The FreeBSD Foundation

2 years agoDisable -Wreturn-type on GCC.
John Baldwin [Mon, 14 Feb 2022 19:48:47 +0000 (11:48 -0800)]
Disable -Wreturn-type on GCC.

GCC is more pedantic than clang about warning when a function doesn't
handle undefined enum values (see GCC bug 87950).  Clang's warning
gives a more pragmatic coverage and should find any real bugs, so
disable the warning for GCC rather than adding __unreachable
annotations to appease GCC.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D34147

2 years agoimprove c style
Wolfram Schneider [Mon, 14 Feb 2022 19:30:09 +0000 (19:30 +0000)]
improve c style

- BSD KNF: return is a native statement and we use
  a space before the parenthesis
- remove superfluous empty lines

Reported by:    jrtc27

2 years agovt.4: clarify that a KMS driver switches to graphics mode
Ed Maste [Mon, 14 Feb 2022 19:03:52 +0000 (14:03 -0500)]
vt.4: clarify that a KMS driver switches to graphics mode

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

2 years agoUse vmspace->vm_stacktop in place of sv_usrstack in more places.
John Baldwin [Mon, 14 Feb 2022 18:57:30 +0000 (10:57 -0800)]
Use vmspace->vm_stacktop in place of sv_usrstack in more places.

Reviewed by: markj
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D34174

2 years agomodule_verbose should also affect non-ELF modules.
Simon J. Gerraty [Mon, 14 Feb 2022 18:44:46 +0000 (10:44 -0800)]
module_verbose should also affect non-ELF modules.

2 years agogrammar
Wolfram Schneider [Mon, 14 Feb 2022 18:16:43 +0000 (18:16 +0000)]
grammar

Reported by: jrtc27

2 years agounix/dgram: return EAGAIN instead of ENOBUFS when O_NONBLOCK set
Gleb Smirnoff [Mon, 14 Feb 2022 17:21:55 +0000 (09:21 -0800)]
unix/dgram: return EAGAIN instead of ENOBUFS when O_NONBLOCK set

This is behavior what some programs expect and what Linux does.  For
example nginx expects EAGAIN when sending messages to /var/run/log,
which it connects to with O_NONBLOCK.  Particularly with nginx the
problem is magnified by the fact that a ENOBUFS on send(2) is also
logged, so situation creates a log-bomb - a failed log message
triggers another log message.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D34187

2 years agodhclient: support VID 0 (no vlan) decapsulation
Franco Fichtner [Mon, 14 Feb 2022 14:43:29 +0000 (09:43 -0500)]
dhclient: support VID 0 (no vlan) decapsulation

VLAN ID 0 is supposed to be interpreted as having no VLAN with a bit of
priority on the side, but the kernel is not able to decapsulate this on
the fly so dhclient needs to take care of it.

Reviewed by: markj
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D31515

2 years agogit-arc: Fix review title matching
Mark Johnston [Mon, 14 Feb 2022 14:41:49 +0000 (09:41 -0500)]
git-arc: Fix review title matching

Properly handle the case where the title of one commit is a suffix or
prefix of the title of a second commit, and one wishes to create reviews
for both.

Reported by: chuck

2 years agomsdosfs: Fix mounting when the device sector size is >512B
Mark Johnston [Mon, 14 Feb 2022 14:41:32 +0000 (09:41 -0500)]
msdosfs: Fix mounting when the device sector size is >512B

HugeSectors * BytesPerSec should be computed before converting
HugeSectors to a DEV_BSIZE-based count.

Fixes: ba2c98389b78 ("msdosfs: sanity check sector count from BPB")
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34264

2 years agosleepqueue: Annotate sleepq_max_depth as static
Mark Johnston [Mon, 14 Feb 2022 14:41:07 +0000 (09:41 -0500)]
sleepqueue: Annotate sleepq_max_depth as static

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agosleepqueue: Address a lock order reversal
Mark Johnston [Mon, 14 Feb 2022 14:38:53 +0000 (09:38 -0500)]
sleepqueue: Address a lock order reversal

After commit 74cf7cae4d22 ("softclock: Use dedicated ithreads for
running callouts."), there is a lock order reversal between the per-CPU
callout lock and the scheduler lock.  softclock_thread() locks callout
lock then the scheduler lock, when preparing to switch off-CPU, and
sleepq_remove_thread() stops the timed sleep callout while potentially
holding a scheduler lock.  In the latter case, it's the thread itself
that's locked, and if the thread is sleeping then its lock will be a
sleepqueue lock, but if it's still in the process of going to sleep
it'll be a scheduler lock.

We could perhaps change softclock_thread() to try to acquire locks in
the opposite order, but that'd require dropping and re-acquiring the
callout lock, which seems expensive for an operation that will happen
quite frequently.  We can instead perhaps avoid stopping the
td_slpcallout callout if the thread is still going to sleep, which is
what this patch does.  This will result in a spurious call to
sleepq_timeout(), but some counters suggest that this is very rare.

PR: 261198
Fixes: 74cf7cae4d22 ("softclock: Use dedicated ithreads for running callouts.")
Reported and tested by: thj
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34204

2 years agocpuset.9: add description of CPU_ISSET()
Stefan Eßer [Mon, 14 Feb 2022 14:59:37 +0000 (15:59 +0100)]
cpuset.9: add description of CPU_ISSET()

PR: 261947
Reported by: thmu7 at freenet.de (Thomas Mueller)
MFC after: 3 days

2 years agoLinuxKPI; add the beginning of a tracepoint.h implementation
Bjoern A. Zeeb [Wed, 9 Feb 2022 12:13:19 +0000 (12:13 +0000)]
LinuxKPI; add the beginning of a tracepoint.h implementation

Add a beginning of a tracepoint.h implementation to ease porting drivers
making use of this Linux facility.

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

2 years agoLinuxKPI: add NETIF_F_HW_CSUM to netdev_features.h
Bjoern A. Zeeb [Wed, 9 Feb 2022 12:05:13 +0000 (12:05 +0000)]
LinuxKPI: add NETIF_F_HW_CSUM to netdev_features.h

Add NETIF_F_HW_CSUM to netdev_features.h as needed by a driver.

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

2 years agoLinuxKPI: add kstrtoint_from_user() and DECLARE_FLEX_ARRAY()
Bjoern A. Zeeb [Wed, 9 Feb 2022 11:58:40 +0000 (11:58 +0000)]
LinuxKPI: add kstrtoint_from_user() and DECLARE_FLEX_ARRAY()

Add an implementation of kstrtoint_from_user() based on the other
implementations and an attempt at DECLARE_FLEX_ARRAY() which works
for the driver needing it.

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

2 years agoLinuxKPI: add an initial ethtool.h
Bjoern A. Zeeb [Wed, 9 Feb 2022 11:53:27 +0000 (11:53 +0000)]
LinuxKPI: add an initial ethtool.h

Add an initial ethtool.h for a define and a dummy struct for now
needed by drivers.

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

2 years agoLinuxKPI: add eth_random_addr() and device_get_mac_address()
Bjoern A. Zeeb [Wed, 9 Feb 2022 11:50:27 +0000 (11:50 +0000)]
LinuxKPI: add eth_random_addr() and device_get_mac_address()

Add eth_random_addr() and a dummy of device_get_mac_address()
pending OF (FDT) support needed by drivers.

While here remove a white space in random_ether_addr().

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

2 years agoLinuxKPI: add more errno
Bjoern A. Zeeb [Wed, 9 Feb 2022 11:48:37 +0000 (11:48 +0000)]
LinuxKPI: add more errno

Add ENOMEDIUM, ENOSR, and ELNRNG to linux/errno.h needed by drivers.

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

2 years agoLinuxKPI: add sizeof_field()
Bjoern A. Zeeb [Wed, 9 Feb 2022 11:46:15 +0000 (11:46 +0000)]
LinuxKPI: add sizeof_field()

Add sizeof_field() to linux/compiler.h needed by a driver.

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

2 years agoLinuxKPI: add __ffs64()
Bjoern A. Zeeb [Wed, 9 Feb 2022 11:43:33 +0000 (11:43 +0000)]
LinuxKPI: add __ffs64()

Add __ffs64() to linux/bitops.h needed by a driver.

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

2 years agoLinuxKPI: add get_unaligned_le16()
Bjoern A. Zeeb [Wed, 9 Feb 2022 11:37:37 +0000 (11:37 +0000)]
LinuxKPI: add get_unaligned_le16()

Add get_unaligned_le16() to asm/unaligned.h needed by a driver.

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

2 years agoTCP syncache: enhance KASSERT output
Bjoern A. Zeeb [Tue, 8 Feb 2022 23:47:15 +0000 (23:47 +0000)]
TCP syncache: enhance KASSERT output

Improve the "syncache: mbuf too small" assertion message with various
variables (some not actually needed) but enough that it will be obvious
if (a) we use IPv4 or IPv6, (b) if UDP tunneling is on, (c) what
max_linkhdr is, and (d) what MHLEN is.

This should help diagnostics in the future.
The case was hit with wireless drivers setting a large ic_headroom
and using IPv6.

Reviewed by: gallatin, tuexen, rscheff
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D34217

2 years agoAdd support for module_verbose
Simon J. Gerraty [Sun, 13 Feb 2022 20:45:57 +0000 (12:45 -0800)]
Add support for module_verbose

Set module_verbose to control the printing of information
about loaded modules and kernel:

0 MODULE_VERBOSE_SILENT None
1 MODULE_VERBOSE_SIZE Pathname and size
2 MODULE_VERBOSE_TWIDDLE as for 1 but also twiddle for progress
3 MODULE_VERBOSE_FULL extra detail

When the loader is verifying modules we already have a
running indication of progress and module_verbose=0 makes sense.

Reviewed by: rpokala
Differential Revision: https://reviews.freebsd.org/D34245

2 years agoBetter help message if locate database does not exists
Wolfram Schneider [Sun, 13 Feb 2022 17:00:22 +0000 (17:00 +0000)]
Better help message if locate database does not exists

PR: 211501
Reported by: Oliver Peter
Reviewed by: Pau Amma
Differential Revision: https://reviews.freebsd.org/D34243

2 years agobwi: Fix clang 14 warning about possible unaligned access
Dimitry Andric [Mon, 7 Feb 2022 20:59:46 +0000 (21:59 +0100)]
bwi: Fix clang 14 warning about possible unaligned access

On architectures with strict alignment requirements (e.g. arm), clang 14
warns about a packed struct which encloses a non-packed union:

In file included from sys/dev/bwi/bwimac.c:79:
sys/dev/bwi/if_bwivar.h:308:7: error: field iv_val within 'struct bwi_fw_iv' is less aligned than 'union (unnamed union at sys/dev/bwi/if_bwivar.h:305:2)' and is usually due to 'struct bwi_fw_iv' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]
} iv_val;
^

It appears to help if you also add __packed to the inner union (i.e.
iv_val). No change to the layout is intended.

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D34196

2 years agovfs: convert vnsz2log to a macro
Mateusz Guzik [Sat, 12 Feb 2022 20:26:34 +0000 (20:26 +0000)]
vfs: convert vnsz2log to a macro

2 years agofd: use FILEDESC_FOREACH_{FDE,FP} where appropriate
Mateusz Guzik [Sat, 29 Jan 2022 22:30:33 +0000 (23:30 +0100)]
fd: use FILEDESC_FOREACH_{FDE,FP} where appropriate

2 years agofd: add FILEDESC_FOREACH_{FDE,FP}
Mateusz Guzik [Sat, 29 Jan 2022 22:19:18 +0000 (23:19 +0100)]
fd: add FILEDESC_FOREACH_{FDE,FP}

Right now they naively walk the fd table just like all the other code,
but that's going to change.

2 years agofd: assign fd_freefile early when copying
Mateusz Guzik [Sat, 29 Jan 2022 22:12:42 +0000 (23:12 +0100)]
fd: assign fd_freefile early when copying

This is to simplify an upcomming change.

2 years agofd: move fd table sizing out of fdinit
Mateusz Guzik [Sat, 29 Jan 2022 22:07:06 +0000 (23:07 +0100)]
fd: move fd table sizing out of fdinit

now it is placed with the rest of actual initialisation

2 years agofd: drop volatile keyword from refcounts
Mateusz Guzik [Sat, 29 Jan 2022 22:02:01 +0000 (23:02 +0100)]
fd: drop volatile keyword from refcounts

While here move a comment where it belongs and do small whitespace clean up.

2 years agoproc: load/store p_cowgen using atomic primitives
Mateusz Guzik [Sat, 12 Feb 2022 19:33:34 +0000 (19:33 +0000)]
proc: load/store p_cowgen using atomic primitives

2 years agothread: remove dead store from thread_cow_update
Mateusz Guzik [Sat, 12 Feb 2022 19:28:57 +0000 (19:28 +0000)]
thread: remove dead store from thread_cow_update

2 years agostress2: Add a fsck_ffs regression test scenario
Peter Holm [Sun, 13 Feb 2022 09:49:58 +0000 (10:49 +0100)]
stress2: Add a fsck_ffs regression test scenario

2 years agostress2: Added a tool to zero out a superblock check hash.
Kirk McKusick [Sun, 13 Feb 2022 09:47:20 +0000 (10:47 +0100)]
stress2: Added a tool to zero out a superblock check hash.

2 years agoiscsi: address unused-but-set-variable warning
Richard Scheffenegger [Sat, 12 Feb 2022 05:11:28 +0000 (06:11 +0100)]
iscsi: address unused-but-set-variable warning

remove "interrupted" in icl_soft_proxy_connect()

Reviewed By: hselasky
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34223

2 years agofreebsd-update: improve BE creation feature
Kyle Evans [Sat, 12 Feb 2022 21:36:24 +0000 (15:36 -0600)]
freebsd-update: improve BE creation feature

This addresses one nit and one bug in the BE creation feature of
freebsd-update:

The nit addressed is that it currently only names the BEs after the
userland version, but the kernel version may be higher.  After this
change, we request both and pass them through sort(1) to choose the
highest.  This is especially helpful if a freebsd-update patch touched
one but not the other.

The bug fixed is that roots updated that are not located at '/', e.g.,
by using -b or -j, will no longer create boot environments
automatically.  There's a very low chance these will actually change the
BE in any meaningful way, anyways.  It could make sense in the future
to allow an argument-override to create the BE anyways if someone comes
up with a non-standard setup, e.g., where a jail is an important part of
their boot environment on an appliance or some such setup.

Half of this patch is submitted by delphij@, the other half kevans@.

PR: 261446
MFC after: 3 days
Reviewed by: delphij, emaste, Dave Fullard <dave_fullard.ca>
Differential Revision: https://reviews.freebsd.org/D34257

2 years agocxgbe(4): Fix illegal hardware access in cxgbe_refresh_stats.
Navdeep Parhar [Sat, 12 Feb 2022 00:58:46 +0000 (16:58 -0800)]
cxgbe(4): Fix illegal hardware access in cxgbe_refresh_stats.

cxgbe_refresh_stats takes into account VI_SKIP_STATS but not
VI_INIT_DONE when deciding whether to read the hardware stats.  But
before this change VI_SKIP_STATS was set only for VIs with VI_INIT_DONE.
That meant that cxgbe_refresh_stats always accessed the hardware for
uninitialized VIs, and this is a problem if the adapter is suspended or
in the middle of a reset.

Fix this by setting VI_SKIP_STATS on all VIs during suspend.  While
here, ignore VI_INIT_DONE in vi_refresh_stats too to be consistent with
cxgbe_refresh_stats.

MFC after: 1 week
Sponsored by: Chelsio Communications

2 years ago[skip ci] fusefs: delete a stray comment from 91972cfcddf
Alan Somers [Sat, 12 Feb 2022 16:27:56 +0000 (09:27 -0700)]
[skip ci] fusefs: delete a stray comment from 91972cfcddf

MFC after: 3 days

2 years agonewvers.sh: allow multiple -V args in one invocation
Ed Maste [Fri, 11 Feb 2022 17:55:46 +0000 (12:55 -0500)]
newvers.sh: allow multiple -V args in one invocation

Reviewed by: imp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34253

2 years agobetter unique file names
Wolfram Schneider [Sat, 12 Feb 2022 11:35:51 +0000 (11:35 +0000)]
better unique file names

Our mktemp(1) implementation uses 8-X for a temp file by default.
That's ok, but we should increase the value from 8 to 10 as
many other OS already did.

PR: 261438

2 years agocxgbe(4): Avoid unsafe hardware access in the ifmedia ioctls.
Navdeep Parhar [Fri, 11 Feb 2022 23:37:17 +0000 (15:37 -0800)]
cxgbe(4): Avoid unsafe hardware access in the ifmedia ioctls.

The hardware is unavailable when the device is suspended or in the
middle of a reset.

MFC after: 1 week
Sponsored by: Chelsio Communications

2 years agoCast pointer to uintptr_t to avoid alignment warnings.
John Baldwin [Sat, 12 Feb 2022 00:04:52 +0000 (16:04 -0800)]
Cast pointer to uintptr_t to avoid alignment warnings.

Both struct ip and struct udphdr both have an aligment of 2, but the
cast from struct ip to a uint32_t pointer confused GCC 9 into raising
the required alignment to 4 and then raising a
-Waddress-of-packed-member error when casting to struct udphdr.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D31941

2 years agoktls: Write-lock the INP when changing a transmit TLS session.
John Baldwin [Fri, 11 Feb 2022 23:16:25 +0000 (15:16 -0800)]
ktls: Write-lock the INP when changing a transmit TLS session.

The TCP rate pacing code relies on being able to read this pointer
safely while holding an INP lock.  The initial TLS session pointer is
set while holding the write lock already.

Reviewed by: gallatin, hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34086

2 years agovdso linker scripts: explicitly specify output arch and target
Konstantin Belousov [Thu, 3 Feb 2022 14:38:15 +0000 (16:38 +0200)]
vdso linker scripts: explicitly specify output arch and target

Requested by: jhb
Reviewed by: emaste, imp, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34157

2 years agolinuxkpi xarray: Correct expression in assertion.
John Baldwin [Fri, 11 Feb 2022 21:59:27 +0000 (13:59 -0800)]
linuxkpi xarray: Correct expression in assertion.

Reported by: GCC -Wparantheses
Reviewed by: wulf, hselasky
Differential Revision: https://reviews.freebsd.org/D34197

2 years agorescue: Link with -lncursesw instead of -lncursesw_real.
John Baldwin [Fri, 11 Feb 2022 21:58:59 +0000 (13:58 -0800)]
rescue: Link with -lncursesw instead of -lncursesw_real.

ld.bfd fails to link rescue with undefined symbol errors otherwise.

This reverts commit b158d4d7a12fad8e9c4509466d5f1ebd15862d9f.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D34123

2 years agocleankernel: A target to delete the kernel compile file
Warner Losh [Fri, 11 Feb 2022 19:50:51 +0000 (12:50 -0700)]
cleankernel: A target to delete the kernel compile file

With the meta-build, it's always a NO_CLEAN build. Provide a way to
remove so one can rebuild from scratch. 'cleankernel' will delete the
kernel and modules object directories. Document this in build(7).

Sponsored by: Netflix
Reviewed by: debdrup, markj
Differential Revision: https://reviews.freebsd.org/D32978

2 years agoucred.9: fix typo
Johan Jansson [Fri, 11 Feb 2022 16:46:37 +0000 (18:46 +0200)]
ucred.9: fix typo

PR: 261889
MFC after: 3 days

2 years agortld: Add ${TOKEN} aliases to $TOKEN
Konstantin Belousov [Fri, 11 Feb 2022 13:46:05 +0000 (15:46 +0200)]
rtld: Add ${TOKEN} aliases to $TOKEN

it seems that glibc supports them, and such spelling is mentioned in the
ld.bfd manual. Idea seems to auto-correct some quoting/makefile sytnax
errors on linker command line.

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

2 years agortld: make token substitution table-driven
Konstantin Belousov [Fri, 11 Feb 2022 13:44:36 +0000 (15:44 +0200)]
rtld: make token substitution table-driven

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

2 years agoMakefile.inc1: synthesize PKG_ABI from newvers.sh variables
Ed Maste [Thu, 10 Feb 2022 20:42:05 +0000 (15:42 -0500)]
Makefile.inc1: synthesize PKG_ABI from newvers.sh variables

Previously we inspected ${WSTAGEDIR}/usr/bin/uname to determine PKG_ABI,
but the file will not exist in some cases - for example, if building
only kernel packages.  We can instead synthesize the PKG_ABI from
information already provided by newvers.sh.

Reviewed by: kevans, manu (both earlier rev)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34249

2 years agocache: improve vnode vs name assertion in cache_enter_time
Mateusz Guzik [Wed, 9 Feb 2022 20:41:24 +0000 (21:41 +0100)]
cache: improve vnode vs name assertion in cache_enter_time