]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoifnet: make V_if_index static to if.c
Gleb Smirnoff [Sat, 4 Dec 2021 17:49:36 +0000 (09:49 -0800)]
ifnet: make V_if_index static to if.c

This requires moving net.link.generic sysctl declaration from if_mib.c
to if.c.  Ideally if_mib.c needs just to be merged to if.c, but they
have different license texts.

Differential revision: https://reviews.freebsd.org/D33263

2 years agoifnet_byindex() actually requires network epoch
Gleb Smirnoff [Sat, 4 Dec 2021 17:49:36 +0000 (09:49 -0800)]
ifnet_byindex() actually requires network epoch

Sweep over potentially unsafe calls to ifnet_byindex() and wrap them
in epoch.  Most of the code touched remains unsafe, as the returned
pointer is being used after epoch exit.  Mark that with a comment.

Validate the index argument inside the function, reducing argument
validation requirement from the callers and making V_if_index
private to if.c.

Reviewed by: melifaro
Differential revision: https://reviews.freebsd.org/D33263

2 years agoifnet: merge ifindex_alloc(), ifnet_setbyindex(), if_grow() and call magic
Gleb Smirnoff [Sat, 4 Dec 2021 17:49:35 +0000 (09:49 -0800)]
ifnet: merge ifindex_alloc(), ifnet_setbyindex(), if_grow() and call magic

Now it is possible to just merge all this complexity into single
linear function.  Note that IFNET_WLOCK() is a sleepable lock, so
we can M_WAITOK and epoch_wait_preempt().

Reviewed by: melifaro, bz, kp
Differential revision: https://reviews.freebsd.org/D33262

2 years agoifnet: initial if_grow() shall always succeed
Gleb Smirnoff [Sat, 4 Dec 2021 17:49:35 +0000 (09:49 -0800)]
ifnet: initial if_grow() shall always succeed

So let's just call malloc() directly.  This also avoids hidden
doubling of default V_if_indexlim.

Reviewed by: melifaro, bz, kp
Differential revision: https://reviews.freebsd.org/D33261

2 years agoifnet: use ck_pr(3) store & load setting ifnet pointer in ifindex
Gleb Smirnoff [Sat, 4 Dec 2021 17:49:35 +0000 (09:49 -0800)]
ifnet: use ck_pr(3) store & load setting ifnet pointer in ifindex

The lockless access to the array is protected by the network epoch.

Reviewed by: bz, kp
Differential revision: https://reviews.freebsd.org/D33260

2 years agoifnet: allocate index at the end of if_alloc_domain()
Gleb Smirnoff [Sat, 4 Dec 2021 17:49:35 +0000 (09:49 -0800)]
ifnet: allocate index at the end of if_alloc_domain()

Now that if_alloc_domain() never fails and actually doesn't
expose ifnet to outside we can eliminate IFNET_HOLD and two
step index allocation.

Reviewed by: kp
Differential revision: https://reviews.freebsd.org/D33259

2 years agonvme_sim: Only report PCI related stats when we can
Warner Losh [Mon, 6 Dec 2021 17:23:23 +0000 (10:23 -0700)]
nvme_sim: Only report PCI related stats when we can

For AHCI attached devices, we report the location and identification
information of the AHCI controller that we're attached to. We also
don't reprot link speed in that case, since we can't get to the PCIe
config space registers to find that out.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D33287

2 years agonvd: For AHCI attached devices, report ahci bridge
Warner Losh [Mon, 6 Dec 2021 17:23:14 +0000 (10:23 -0700)]
nvd: For AHCI attached devices, report ahci bridge

When an NVME device is attached via a AHCI controller, we have no access
to its config space. So instead of information about the nvme drive
itself, return info about the AHCI controller as the next best
thing. Since the Intel Hardware RAID support looks at these values, this
likely is best.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D33286

2 years agonvme_ahci: Mark AHCI devices as such in the controller
Warner Losh [Mon, 6 Dec 2021 17:23:06 +0000 (10:23 -0700)]
nvme_ahci: Mark AHCI devices as such in the controller

Add a quirk to flag AHCI attachment to the controller. This is for any
of the strategies for attaching nvme devices as children of the AHCI
device for Intel's RAID devices. This also has a side effect of cleaning
up resource allocation from failed nvme_attach calls now.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D33285

2 years agonvme: Move to a quirk for the Intel alignment data
Warner Losh [Mon, 6 Dec 2021 17:22:50 +0000 (10:22 -0700)]
nvme: Move to a quirk for the Intel alignment data

Prior to NVMe 1.3, Intel produced a series of drives that had
performance alignment data in the vendor specific space since no
standard had been defined. Move testing the versions to a quick so the
NVMe NS code doesn't know about PCI device info.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D33284

2 years agodummynet tests: disable for now
Kristof Provost [Mon, 6 Dec 2021 17:15:24 +0000 (18:15 +0100)]
dummynet tests: disable for now

Disable the dummynet tests when running the ci tests. This avoids
running into the panic described in https://reviews.freebsd.org/D33064
(where an interface is removed but a dummynet queued packet still has a
pointer to it).

These tests can be re-enabled when the work in
https://reviews.freebsd.org/D33267 lands.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agox86: Perform late TSC calibration before LAPIC timer calibration
Mark Johnston [Mon, 6 Dec 2021 15:42:19 +0000 (10:42 -0500)]
x86: Perform late TSC calibration before LAPIC timer calibration

This ensures that LAPIC calibration is done using the correct tsc_freq
value, i.e., the one associated with the TSC timecounter.  It does mean
though that TSC calibration cannot use sbinuptime() to read the
reference timecounter, as timehands are not yet set up.

Reviewed by: kib, jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33209

2 years agox86: Defer LAPIC calibration until after timecounters are available
Mark Johnston [Mon, 6 Dec 2021 15:42:10 +0000 (10:42 -0500)]
x86: Defer LAPIC calibration until after timecounters are available

This ensures that we have a good reference timecounter for performing
calibration.

Change lapic_setup to avoid configuring the timer when booting, and move
calibration and initial configuration to a new lapic routine,
lapic_calibrate_timer.  This calibration will be initiated from
cpu_initclocks(), before an eventtimer is selected.

Reviewed by: kib, jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33206

2 years agox86: Deduplicate clock.h
Mark Johnston [Mon, 6 Dec 2021 15:39:08 +0000 (10:39 -0500)]
x86: Deduplicate clock.h

The headers were mostly identical on amd64 and i386.

No functional change intended.

Reviewed by: cperciva, mav, imp, kib, jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33205

2 years agolibdwarf: Support consumption of compressed ELF sections
Mark Johnston [Mon, 6 Dec 2021 15:37:49 +0000 (10:37 -0500)]
libdwarf: Support consumption of compressed ELF sections

Automatically decompress zlib-compressed debug sections when loading
them.  This lets ctfcovert work on userland code after commit
c910570e7573 ("Use compressed debug in standalone userland debug files
by default").

Reported by: avg
Reviewed by: avg, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33139

2 years agotcp: rack fails to send out a TLP after a MTU change
Randall Stewart [Mon, 6 Dec 2021 14:56:09 +0000 (09:56 -0500)]
tcp: rack fails to send out a TLP after a MTU change

When rack sends out a TLP it sets up various state to make sure
it avoids the cwnd (its been more than 1 RTT since our last send) and
it may at times send new data. If an MTU change as occurred
and our cwnd has collapsed we can have a situation where must_retran
flag is set and we obey the cwnd thus never sending the TLP and then
sitting stuck.

This one line fix addresses that problem
Reviewed by: Michael Tuexen
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D33231

2 years agoucom: s/sio/ucom/
Mitchell Horne [Mon, 6 Dec 2021 14:09:54 +0000 (10:09 -0400)]
ucom: s/sio/ucom/

Seems like a copy-paste error, or at least this made more sense when the
sio(4) driver still existed. This modifies the debug port name displayed
at boot, but otherwise has no functional change.

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

2 years agokbdmap: adapt to the new bsddialog api
Baptiste Daroussin [Mon, 6 Dec 2021 12:58:09 +0000 (13:58 +0100)]
kbdmap: adapt to the new bsddialog api

2 years agopf tests: more thorough pfsync defer test
Kristof Provost [Thu, 2 Dec 2021 17:47:40 +0000 (18:47 +0100)]
pf tests: more thorough pfsync defer test

Add a somewhat more extensive pfsync defer mode test. Ensure that pfsync
actually delays the state creating packet until after it has sent the
pfsync update and given the peer time to create the state.

Ideally the test should validate the pfsync state update and generate an
ack message, but to keep the test simple we rely on the timeout of the
deferred packet instead.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33245

2 years agopfsync: fix incorrect enabling of defer mode
Kristof Provost [Thu, 2 Dec 2021 17:39:23 +0000 (18:39 +0100)]
pfsync: fix incorrect enabling of defer mode

When we exposed the PFSYNCF_OK flag to userspace in 5f5bf88949d we
unintentionally caused defer mode to always be enabled.
The ioctl check only looked for nonzero, not for the PFSYNCF_DEFER flag.

Fix this check and ensure ifconfig sets the flag.

Reviewed by: glebius
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33244

2 years agopfsync: locking fixes
Kristof Provost [Thu, 2 Dec 2021 16:42:56 +0000 (17:42 +0100)]
pfsync: locking fixes

 * Ensure we unlock the pfsync lock in pfsync_defer()
 * We must hold the bucket lock when calling pfsync_push()
 * The pfsync_defer_tmo() callout locks the bucket lock, not the pfsync
   lock

Reviewed by: glebius
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33243

2 years agopfsync: fix defer timeout
Kristof Provost [Thu, 2 Dec 2021 16:30:36 +0000 (17:30 +0100)]
pfsync: fix defer timeout

Don't use a fixed number of ticks, but take hz into account so we have a
consistent timeout, regardless of what hz is set up.
Use a 20ms timeout, becaues that's what OpenBSD uses.

Reviewed by: glebius
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33242

2 years agopfsync: check IFF_DRV_RUNNING in the correct field
Kristof Provost [Thu, 2 Dec 2021 13:36:12 +0000 (14:36 +0100)]
pfsync: check IFF_DRV_RUNNING in the correct field

This flag is stored in if_drv_flags, not if_flags.

Reviewed by: glebius
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33241

2 years agopfsync: NULL check sc before using it
Kristof Provost [Thu, 2 Dec 2021 13:32:21 +0000 (14:32 +0100)]
pfsync: NULL check sc before using it

In pfsync_defer() we must wait to lock sc until we've ensured it's not
NULL.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33240

2 years agobsddialog: import snapshot 2021-12-05
Baptiste Daroussin [Mon, 6 Dec 2021 10:42:36 +0000 (11:42 +0100)]
bsddialog: import snapshot 2021-12-05

2 years agoObsoleteFiles: Don't remove if_stf.h
Kristof Provost [Fri, 3 Dec 2021 13:29:25 +0000 (14:29 +0100)]
ObsoleteFiles: Don't remove if_stf.h

19dc644511 added if_stf.h, which had previously been removed.

We have to remove it from ObsoleteFiles.inc to ensure that it's not
unintentionally uninstalled again.

Reported by: Herbert J. Skuhra <herbert@gojira.at>
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33247

2 years agobsddialog: vendor import 2021-12-05
Baptiste Daroussin [Mon, 6 Dec 2021 10:35:28 +0000 (11:35 +0100)]
bsddialog: vendor import 2021-12-05

2 years agofb: Add new FBTYPE_EFIFB
Emmanuel Vadot [Wed, 1 Dec 2021 15:13:09 +0000 (16:13 +0100)]
fb: Add new FBTYPE_EFIFB

Currently the type isn't set in the fbtype struct so any userland
program that call the FBIOGTYPE ioctl will think it's a FBTYPE_SUN1BW
which is far from the truth.
No app that I found find checks the type but at least now it's correct.

Reviewed by: emaste, tsoome
MFC after: 2 weeks
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33221

2 years agofb: Remove some unused ioctls
Emmanuel Vadot [Wed, 1 Dec 2021 10:57:42 +0000 (11:57 +0100)]
fb: Remove some unused ioctls

6d1699583d7e added the FBIOGXINFO,FBIOMONINFO and FBIOPUTCMAPI/FBIOGETCMAPI
ioctls and said that implementation in driver will come later.
Since it was in 2001 I think we can remove this.

Reviewed by: emaste, imp, tsoome
MFC after:      2 weeks
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33218
Differential Revision: https://reviews.freebsd.org/D33219
Differential Revision: https://reviews.freebsd.org/D33220

2 years agofb: Remove unused cursors ioctls
Emmanuel Vadot [Wed, 1 Dec 2021 10:56:26 +0000 (11:56 +0100)]
fb: Remove unused cursors ioctls

The cursors related ioctls were added in 1994 with the 4.4 Lite import
but were never implemented in either sc(4), fb(4) or vt(4).
Remove it.

Reviewed by: emaste, tsoome
MFC after:      2 weeks
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33217

2 years agofb: Remove unused FBIOVERTICAL ioctl
Emmanuel Vadot [Wed, 1 Dec 2021 10:53:03 +0000 (11:53 +0100)]
fb: Remove unused FBIOVERTICAL ioctl

Commit 6d1699583d7e added the FBIOVERTICAL ioctl and said that implementation
in driver will come later.
Since it was in 2001 I think we can remove this.

MFC after:      2 weeks
Sponsored by:   Beckhoff Automation GmbH & Co. KG

2 years agofb: Remove unused FBIOSVIDEO/FBIOGVIDEO ioctls
Emmanuel Vadot [Wed, 1 Dec 2021 10:51:17 +0000 (11:51 +0100)]
fb: Remove unused FBIOSVIDEO/FBIOGVIDEO ioctls

The FBIOSVIDEO/FBIOGVIDEO ioctls were added in 1994 with the 4.4 Lite import
but were never implemented in either sc(4), fb(4) or vt(4).
Remove it.

Reviewed by: emaste, tsoome
MFC after:      2 weeks
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33216

2 years agofb: Remove unused FBIOSATTR/FBIOGATTR ioctls
Emmanuel Vadot [Wed, 1 Dec 2021 10:49:57 +0000 (11:49 +0100)]
fb: Remove unused FBIOSATTR/FBIOGATTR ioctls

The FBIOSATTR/FBIOGATTR ioctls were added in 1994 with the 4.4 Lite import
but were never implemented in either sc(4), fb(4) or vt(4).
Remove it.

Reviewed by: emaste, tsoome
MFC after:      2 weeks
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33215

2 years agofb: Remove unused code
Emmanuel Vadot [Wed, 1 Dec 2021 10:43:46 +0000 (11:43 +0100)]
fb: Remove unused code

The FBIOGINFO ioctl was added in 1994 with the 4.4 Lite import but was commented.
Remove it.

Reviewed by: emaste
MFC after:      2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33211

2 years agovmxnet3: skip zero-length descriptor in the middle of a packet
Andriy Gapon [Mon, 6 Dec 2021 07:59:28 +0000 (09:59 +0200)]
vmxnet3: skip zero-length descriptor in the middle of a packet

Passing up such descriptors to iflib is obviously wasteful.
But the main conern is that we may overrun iri_frags array because of
them.  That's been observed in practice.

Also, assert that the number of fragments / descriptors / segments is
less than IFLIB_MAX_RX_SEGS.

Reviewed by: gallatin, pkelsey
MFC after: 3 weeks
Sponsored by: Panzura LLC
Differential Revision: https://reviews.freebsd.org/D33189

2 years agortwn/usb: add product ID for Asus USB N10 Nano Rev. B1
Andreas Wetzel [Mon, 6 Dec 2021 07:21:38 +0000 (09:21 +0200)]
rtwn/usb: add product ID for Asus USB N10 Nano Rev. B1

According to information found on the internet the following products
use exactly the same hardware but probably different USB IDs:
- Edimax EW-7811Un V2 (v2)
- Edimax EW-7811GLN 2.0A (v2)
I am not adding them as I cannot verify.

PR: 254280
MFC after: 1 week

2 years agocam/iosched: fix off by one error
Warner Losh [Mon, 6 Dec 2021 05:57:50 +0000 (22:57 -0700)]
cam/iosched: fix off by one error

Set the bucket size to be SBT_1US/50000 + 1 to be the first number >
20us. I had this uncommitted in my three when I pushed 2283206935b8
since kern.cam.iosched.bucket_base_us was reporting 19us.

Fixes: 2283206935b8
Sponsored by: Netflix

2 years agocam-iosched: Publish parameters of the latency buckets
Warner Losh [Mon, 6 Dec 2021 04:54:42 +0000 (21:54 -0700)]
cam-iosched: Publish parameters of the latency buckets

Add sysctls to publish the latency bucket size, number, and stride. Move
to putting all the iosched stuff under kern.cam.iosched as well and move
kern.cam.do_dynamic_iosched to kern.cam.iosched.dynamic. In addition, move
kern.cam.io_sched_alpha_bits to kern.cam.iosched.alpha_bits. Publish
kern.cam.iosched.bucket_base (the smallest bucket time), .bucket_ratio
(the geometric progression factor * 100), and .buckets (the total number
of buckets).

Move to publishing 20 buckets, starting at 20us. This allows us to get
better resolution on the short end and detect preformance degredation of
the NVMe drives I've tested on, even with the uncertainty of bucketing.

Sponsored by: Netflix

2 years agosysctl: Small style fix
Warner Losh [Mon, 6 Dec 2021 04:36:43 +0000 (21:36 -0700)]
sysctl: Small style fix

Slightly reorder to make this look better. No functional change.

Sponsored by: Netflix

2 years agoamd64/pmap: fix user page table page accounting
Alan Cox [Sun, 5 Dec 2021 23:40:53 +0000 (17:40 -0600)]
amd64/pmap: fix user page table page accounting

When a superpage mapping is destroyed and the original page table page
containing 4KB mappings that was being held in reserve is deallocated,
the recently introduced user page table page count was not being
decremented.  Consequentially, the count was wrong and would grow over
time.  For example, after multiple iterations of "buildworld", I was
seeing implausible counts, like the following:

vm.pmap.kernel_pt_page_count: 2184
vm.pmap.user_pt_page_count: 2280849
vm.pmap.pv_page_count: 106

With this change, I now see:

vm.pmap.kernel_pt_page_count: 2183
vm.pmap.user_pt_page_count: 344
vm.pmap.pv_page_count: 105

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D33276

2 years agoSet uninitialized popmap bits in vm_reserv_init
Doug Moore [Sun, 5 Dec 2021 23:17:25 +0000 (17:17 -0600)]
Set uninitialized popmap bits in vm_reserv_init

In vm_reserv_init, set all the marker popmap bits in vm_reserv_init,
and not just the bits of the first popmap entry.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33258

2 years agoFix "set but not used" in kern_cpu.c
Scott Long [Sun, 5 Dec 2021 22:33:04 +0000 (15:33 -0700)]
Fix "set but not used" in kern_cpu.c

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoFix "set but not used" in opencrypto, with a correction for the previous
Scott Long [Sun, 5 Dec 2021 22:30:36 +0000 (15:30 -0700)]
Fix "set but not used" in opencrypto, with a correction for the previous
commit.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoFix "set but not used" in opencrypto
Scott Long [Sun, 5 Dec 2021 22:23:47 +0000 (15:23 -0700)]
Fix "set but not used" in opencrypto

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoFIx "set but not used" in the isp driver.
Scott Long [Sun, 5 Dec 2021 22:19:56 +0000 (15:19 -0700)]
FIx "set but not used" in the isp driver.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoFix "set but not used" in cardbus
Scott Long [Sun, 5 Dec 2021 22:14:35 +0000 (15:14 -0700)]
Fix "set but not used" in cardbus

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoFix "set but not used" in the x86 pci driver.
Scott Long [Sun, 5 Dec 2021 22:09:24 +0000 (15:09 -0700)]
Fix "set but not used" in the x86 pci driver.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agosys/bitset.h: reduce visibility of BIT_* macros
Stefan Eßer [Sun, 5 Dec 2021 21:27:33 +0000 (22:27 +0100)]
sys/bitset.h: reduce visibility of BIT_* macros

Add two underscore characters "__" to names of BIT_* and BITSET_*
macros to move them to the implementation name space and to prevent
a name space pollution due to BIT_* macros in 3rd party programs with
conflicting parameter signatures.

These prefixed macro names are used in kernel header files to define
macros in e.g. sched.h, sys/cpuset.h and sys/domainset.h.

If C programs are built with either -D_KERNEL (automatically passed
when building a kernel or kernel modules) or -D_WANT_FREENBSD_BITSET
(or this macros is defined in the source code before including the
bitset macros), then all macros are made visible with their previous
names, too. E.g., both __BIT_SET() and BIT_SET() are visible with
either of _KERNEL or _WANT_FREEBSD_BITSET defined.

The main reason for this change is that some 3rd party sources
including sched.h have been found to contain conflicting BIT_*
macros.

As a work-around, parts of shed.h have been made conditional and
depend on _WITH_CPU_SET_T being set when sched.h is included.
Ports that expect the full functionality provided by sched.h need
to be built with -D_WITH_CPU_SET_T. But this leads to conflicts if
BIT_* macros are defined in that program, too.

This patch set makes all of sched.h visible again without this
parameter being passed and without any name space pollution due
to BIT_* macros becoming visible when sched.h is included.

This patch set will be backported to the STABLE branches, but ports
will need to use -D_WITH_CPU_SET_T as long as there are supported
releases that do not contain these patches.

Reviewed by: kib, markj
MFC after: 1 month
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D33235

2 years agoahci: Add Intel Comet Lake RAID/RST controller PCI ID
Adrian Chadd [Sun, 5 Dec 2021 21:28:39 +0000 (21:28 +0000)]
ahci: Add Intel Comet Lake RAID/RST controller PCI ID

This is needed on my ASUS motherboard / Intel Comet Lake i5-10500
desktop machine.

This with some work arounds for nvme behind the RST controller
boots and works.

Reviewed by: cognet

2 years agoin_pcb: delay crfree() down into UMA dtor
Gleb Smirnoff [Sun, 5 Dec 2021 16:47:24 +0000 (08:47 -0800)]
in_pcb: delay crfree() down into UMA dtor

inpcb lookups, which check inp_cred, work with pcbs that potentially went
through in_pcbfree().  So inp_cred should stay valid until SMR guarantees
its invisibility to lookups.

While here, put the whole inpcb destruction sequence of in_pcbfree(),
inpcb_dtor() and inpcb_fini() sequentially.

Submitted by: markj
Differential revision: https://reviews.freebsd.org/D33273

2 years agouma: remove unused *item argument from cache_free()
Gleb Smirnoff [Sun, 5 Dec 2021 16:37:56 +0000 (08:37 -0800)]
uma: remove unused *item argument from cache_free()

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

2 years agoApply fix for clang crashing on invalid -Wa,-march= values
Dimitry Andric [Sun, 5 Dec 2021 17:54:13 +0000 (18:54 +0100)]
Apply fix for clang crashing on invalid -Wa,-march= values

Merge commit df08b2fe8b35 from llvm git (by Dimitry Andric):

  [AArch64] Avoid crashing on invalid -Wa,-march= values

  As reported in https://bugs.freebsd.org/260078, the gnutls Makefiles
  pass -Wa,-march=all to compile a number of assembly files. Clang does
  not support this -march value, but because of a mistake in handling
  the arguments, an unitialized Arg pointer is dereferenced, which can
  cause a segfault.

  Work around this by adding a check if the local WaMArch variable is
  initialized, and if so, using its value in the diagnostic message.

  Reviewed By: tschuett

  Differential Revision: https://reviews.llvm.org/D114677

PR: 260078
Reported by: bz
MFC after: 3 days

2 years agong_ubt: Avoid attaching to several newer Intel controllers
Mark Johnston [Sun, 5 Dec 2021 15:45:12 +0000 (10:45 -0500)]
ng_ubt: Avoid attaching to several newer Intel controllers

Like other Intel controllers, these require firmware to be loaded, and
generic ng_ubt attach causes them to lock up until a power cycle.
However, their firmware interface for querying version info and loading
operational firmware is different from that implemented by ng_ubt_intel
and iwmbtfw, so they are not usable yet.  Just disable attach for now to
avoid stalls during USB device enumeration.

PR: 260161
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agovm_page: Tighten the object lock assertion in vm_page_invalid()
Mark Johnston [Sun, 5 Dec 2021 15:39:58 +0000 (10:39 -0500)]
vm_page: Tighten the object lock assertion in vm_page_invalid()

A page must not become invalid while vm_fault_soft_fast() is attempting
to map unbusied pages for reading.

Note that all callers hold the object write lock already, and
vm_page_set_invalid() asserts the object write lock.

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

2 years agox86: remove unused T_USER flag
Mitchell Horne [Sun, 5 Dec 2021 15:11:55 +0000 (11:11 -0400)]
x86: remove unused T_USER flag

It stopped being used in 3c256f5395aa, when trap() was reorganized to
have separate switch statements for user and kernel traps. Remove the
two leftover references and the flag itself.

Reviewed by: kib
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D33253

2 years agoRemove riscv workaround in sys.netgraph.hub.loop test
Mitchell Horne [Fri, 3 Dec 2021 18:26:35 +0000 (14:26 -0400)]
Remove riscv workaround in sys.netgraph.hub.loop test

The test case now passes on this architecture. This reverts commits
d5fd5cdc0638 and 168b579a4884.

Reviewed by: lwhsu, imp
Differential Revision: https://reviews.freebsd.org/D33252

2 years agoRevert "ffs(3): Fix a typo in a sysctl description"
Gordon Bergling [Sun, 5 Dec 2021 12:45:47 +0000 (13:45 +0100)]
Revert "ffs(3): Fix a typo in a sysctl description"

It should be

- s/contigous/contiguous/ not continuous

Reported by: tuexen@

This reverts commit 42efe994ece337929b6f9937829f7970e620db9b.

2 years agostress2: This test runs for hours with ASLR enabled
Peter Holm [Sun, 5 Dec 2021 05:43:29 +0000 (05:43 +0000)]
stress2: This test runs for hours with ASLR enabled

2 years agox86: Make AMD elvtX dump more compact.
Alexander Motin [Sun, 5 Dec 2021 02:45:20 +0000 (21:45 -0500)]
x86: Make AMD elvtX dump more compact.

MFC after: 2 weeks

2 years agonfsd: Fix Verify for attributes like FilesAvail
Rick Macklem [Sat, 4 Dec 2021 22:38:55 +0000 (14:38 -0800)]
nfsd: Fix Verify for attributes like FilesAvail

When the Verify operation calls nfsv4_loadattr(), it provides
the "struct statfs" information that can be used for doing a
compare for FilesAvail, FilesFree, FilesTotal, SpaceAvail,
SpaceFree and SpaceTotal.  However, the code erroneously
used the "struct nfsstatfs *" argument that is NULL.
This patch fixes these cases to use the correct argument
structure.  For the case of FilesAvail, the code in
nfsv4_fillattr() was factored out into a separate function
called nfsv4_filesavail(), so that it can be called from
nfsv4_loadattr() as well as nfsv4_fillattr().

In fact, most of the code in nfsv4_filesavail() is old
OpenBSD code that does not build/run on FreeBSD, but I
left it in place, in case it is of some use someday.

I am not aware of any extant NFSv4 client that does Verify
on these attributes.

Reported by: rtm@lcs.mit.edu
Tested by: rtm@lcs.mit.edu
PR: 260176
MFC after: 2 weeks

2 years agonfsd: Sanity check the Layouttype count
Rick Macklem [Sat, 4 Dec 2021 22:18:48 +0000 (14:18 -0800)]
nfsd: Sanity check the Layouttype count

Reported by: rtm@lcs.mit.edu
Tested by: rtm@lcs.mit.edu
PR: 260155
MFC after: 2 weeks

2 years agoswapoff(8): add -f flag
Konstantin Belousov [Mon, 29 Nov 2021 16:30:09 +0000 (18:30 +0200)]
swapoff(8): add -f flag

to force swapout by ignoring the heuristic that calculates amount of
allocated memory against total of RAM plus remaining swap.

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

2 years agoswapoff(2): document extended syscall arguments
Konstantin Belousov [Thu, 2 Dec 2021 03:17:40 +0000 (05:17 +0200)]
swapoff(2): document extended syscall arguments

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

2 years agoswapoff(2): add a SWAPOFF_FORCE flag
Konstantin Belousov [Mon, 29 Nov 2021 16:28:19 +0000 (18:28 +0200)]
swapoff(2): add a SWAPOFF_FORCE flag

The flag requests skipping the heuristic which tries to avoid leaving
system with more allocated memory than available from RAM and remanining
swap.

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

2 years agoswapoff(2): replace special device name argument with a structure
Konstantin Belousov [Mon, 29 Nov 2021 16:26:31 +0000 (18:26 +0200)]
swapoff(2): replace special device name argument with a structure

For compatibility, add a placeholder pointer to the start of the
added struct swapoff_new_args, and use it to distinguish old vs. new
style of syscall invocation.

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

2 years agoswap_pager.c: Remove MPSAFE and ARGSUSED annotations
Konstantin Belousov [Fri, 3 Dec 2021 08:45:42 +0000 (10:45 +0200)]
swap_pager.c: Remove MPSAFE and ARGSUSED annotations

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

2 years agoMove _p.a profiling archives under MK_INSTALLLIB
Ed Maste [Thu, 2 Dec 2021 15:27:12 +0000 (10:27 -0500)]
Move _p.a profiling archives under MK_INSTALLLIB

_p.a are just a special case of .a archives, and should not be installed
if WITHOUT_INSTALLLIB is set.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoMAC/priority module for realtime privilege group
Florian Walpen [Sat, 4 Dec 2021 16:17:29 +0000 (18:17 +0200)]
MAC/priority module for realtime privilege group

This is a MAC policy module that grants scheduling privileges based on
group membership.  Users or processes in the group realtime (gid 47) are
allowed to run threads and processes with realtime scheduling priority.
For timing-sensitive, low-latency software like audio/jack, running with
realtime priority helps to avoid stutter and gaps.

PR: 239125
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D33191

2 years agosctp: unbreak NOINET6 builds.
Michael Tuexen [Sat, 4 Dec 2021 18:13:28 +0000 (19:13 +0100)]
sctp: unbreak NOINET6 builds.

PR: 260119
Reported by: kostikbel
MFC after: 1 week

2 years agoFix "set but not used" for hptmv
Scott Long [Sat, 4 Dec 2021 18:06:33 +0000 (11:06 -0700)]
Fix "set but not used" for hptmv

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoFix "set but not used" for hptiop
Scott Long [Sat, 4 Dec 2021 18:05:45 +0000 (11:05 -0700)]
Fix "set but not used" for hptiop

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agonhop: hash ifnet pointer instead of if_index
Gleb Smirnoff [Sat, 4 Dec 2021 18:05:46 +0000 (10:05 -0800)]
nhop: hash ifnet pointer instead of if_index

Yet another problem created by VIMAGE/if_vmove/epair design that
relocates ifnet between vnets and changes if_index.  Since if_index
changes, nhop hash values also changes, unlink_nhop() isn't able to
find entry in hash and leaks the nhop.  Since nhop references ifnet,
the latter is also leaked.  As result running network tests leaks
memory on every single test that creates vnet jail.

While here, rewrite whole hash_priv() to use static initializer,
per Alexander's suggestion.

Reviewed by: melifaro

2 years agotcpdrop: tweak comments
Michael Tuexen [Sat, 4 Dec 2021 14:08:01 +0000 (15:08 +0100)]
tcpdrop: tweak comments

MFC after: 1 week
Sponsored by: Netflix, Inc.

2 years agotcpdrop: explicitly choose TCP as the transport protocol
Michael Tuexen [Sat, 4 Dec 2021 14:03:29 +0000 (15:03 +0100)]
tcpdrop: explicitly choose TCP as the transport protocol

MFC after: 1 week
Sponsored by: Netflix, Inc.

2 years agotcpdrop: allow TCP connections to be filtered by cc-algo
Michael Tuexen [Sat, 4 Dec 2021 14:00:05 +0000 (15:00 +0100)]
tcpdrop: allow TCP connections to be filtered by cc-algo

In addition to filtering by stack and state, allow filtering
by the congestion control module used.  Choose the command line
options to be consistent with the ones of sockstat.

MFC after: 1 week
Sponsored by: Netflix, Inc.

2 years agoipfilter: Avoid more null if-then-else blocks
Cy Schubert [Wed, 20 Oct 2021 03:11:40 +0000 (20:11 -0700)]
ipfilter: Avoid more null if-then-else blocks

As in 73db3b64f167, when WITHOUT_INET6 is selected, null if-then-else
blocks are generated because #if statements are incorrectly placed.
Moving the #if statements reduces unnecessary runtime comparisons or
compiler optimizations.

MFC after: 3 days

2 years agoipfilter: Correct a comment and add notation
Cy Schubert [Wed, 20 Oct 2021 02:33:02 +0000 (19:33 -0700)]
ipfilter: Correct a comment and add notation

Correct a comment to accurately reflect what is being done. While
we're at it document the next step in the process.

MFC after: 3 days

2 years agoipfilter: Correct function description
Cy Schubert [Tue, 19 Oct 2021 00:14:43 +0000 (17:14 -0700)]
ipfilter: Correct function description

As of 874b1a35486b, ip_proxy_check() return codes have been simplified.
The original comment was also incorrect in the first place.

MFC after: 3 days

2 years agoipfilter: Add DTrace SDT probe
Cy Schubert [Tue, 5 Oct 2021 04:26:58 +0000 (21:26 -0700)]
ipfilter: Add DTrace SDT probe

Add an SDT probe, using the newly created DT5 macro, in similar vein
to DEBUG_PARSE printf for when FTP junk is anticipated and ok. This
will assist in debugging port (active) FTP proxy issues.

MFC after: 3 days

2 years agoipfilter: New DT5 DTrace macro
Cy Schubert [Tue, 5 Oct 2021 04:18:42 +0000 (21:18 -0700)]
ipfilter: New DT5 DTrace macro

Define a new DT5 DTrace macro used to call DTRACE_PROBE5, for use with
SDT probes with five arguments.

MFC after: 3 days

2 years agoipfilter: Whitespace cleanup
Cy Schubert [Tue, 5 Oct 2021 04:16:16 +0000 (21:16 -0700)]
ipfilter: Whitespace cleanup

Clean up whitespace from compaction of DTn macro definitions.

MFC after: 3 days

2 years agoipfilter: Compat and simplify DTrace macro definitions
Cy Schubert [Tue, 5 Oct 2021 04:13:47 +0000 (21:13 -0700)]
ipfilter: Compat and simplify DTrace macro definitions

Use a compound #if to simplify and compact DTn DTRACE_PROBEn macros
used by ipfilter.

MFC after: 3 days

2 years agoipfilter: Save a word of stack space
Cy Schubert [Mon, 4 Oct 2021 18:36:15 +0000 (11:36 -0700)]
ipfilter: Save a word of stack space

Rather than save the return code into an intermediate variable, which BTW
is optimized out anyway, explicitly remove the return code from the stack.

MFC after: 3 days

2 years agotcpdrop: update man page, since the fastack stack has been removed
Michael Tuexen [Sat, 4 Dec 2021 13:27:46 +0000 (14:27 +0100)]
tcpdrop: update man page, since the fastack stack has been removed

MFC after: 1 week
Sponsored by: Netflix, Inc.

2 years agotcpdrop: use a better name of a variable.
Michael Tuexen [Sat, 4 Dec 2021 12:46:43 +0000 (13:46 +0100)]
tcpdrop: use a better name of a variable.

No functional change intended.

MFC after: 1 week
Sponsored by: Netflix, Inc.

2 years agoffs(3): Fix a typo in a sysctl description
Gordon Bergling [Sat, 4 Dec 2021 11:15:34 +0000 (12:15 +0100)]
ffs(3): Fix a typo in a sysctl description

- s/contigous/continuous/

MFC after: 3 days

2 years agoomap4: Fix a few typos in source code comments
Gordon Bergling [Sat, 4 Dec 2021 11:13:27 +0000 (12:13 +0100)]
omap4: Fix a few typos in source code comments

- s/addresss/address/

MFC after: 3 days

2 years agoipfilter(4): Fix a typo in an error message
Gordon Bergling [Sat, 4 Dec 2021 11:10:39 +0000 (12:10 +0100)]
ipfilter(4): Fix a typo in an error message

- s/addresss/address/

This is a direct commit to contrib since the upstream is
no longer active.

MFC after: 3 days

2 years agonet80211(4): Fix a typo in a sysctl description
Gordon Bergling [Sat, 4 Dec 2021 11:09:17 +0000 (12:09 +0100)]
net80211(4): Fix a typo in a sysctl description

- s/travelse/traversal/

MFC after: 3 days

2 years agoif_pflog: fix packet length
Kristof Provost [Thu, 2 Dec 2021 07:22:34 +0000 (08:22 +0100)]
if_pflog: fix packet length

There were two issues with the new pflog packet length.
The first is that the length is expected to be a multiple of
sizeof(long), but we'd assumed it had to be a multiple of
sizeof(uint32_t).

The second is that there's some broken software out there (such as
Wireshark) that makes incorrect assumptions about the amount of padding.
That is, Wireshark assumes there's always three bytes of padding, rather
than however much is needed to get to a multiple of sizeof(long).

Fix this by adding extra padding, and a fake field to maintain
Wireshark's assumption.

Reported by: Ozkan KIRIK <ozkan.kirik@gmail.com>
Tested by: Ozkan KIRIK <ozkan.kirik@gmail.com>
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33236

2 years agoFix "set but not used" in mrsas. This includes removing unnecessary cdevsw
Scott Long [Sat, 4 Dec 2021 07:08:27 +0000 (00:08 -0700)]
Fix "set but not used" in mrsas.  This includes removing unnecessary cdevsw
methods.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoFix "set but not used" for geom
Scott Long [Sat, 4 Dec 2021 06:40:24 +0000 (23:40 -0700)]
Fix "set but not used" for geom

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoFix "set but not used" for bge
Scott Long [Sat, 4 Dec 2021 06:29:51 +0000 (23:29 -0700)]
Fix "set but not used" for bge

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoipsec: fix a panic with INVARIANTS
Robert Wing [Fri, 3 Dec 2021 23:22:23 +0000 (14:22 -0900)]
ipsec: fix a panic with INVARIANTS

When adding an SPD entry that already exists, a refcount wraparound
panic is encountered. This was caused from dropping a reference on the
wrong security policy.

Fixes: 4920e38fecc3 ("ipsec: fix race condition in key.c")
Reviewed by: wma
Sponsored by:   Klara Inc.
Differential Revision: https://reviews.freebsd.org/D33100

2 years agoFix "set but not used" in the tws driver
Scott Long [Fri, 3 Dec 2021 22:40:29 +0000 (15:40 -0700)]
Fix "set but not used" in the tws driver

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoFix "set but not used" for the ti driver
Scott Long [Fri, 3 Dec 2021 22:31:14 +0000 (15:31 -0700)]
Fix "set but not used" for the ti driver

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoFix "set but not used" in arcmsr
Scott Long [Fri, 3 Dec 2021 22:22:47 +0000 (15:22 -0700)]
Fix "set but not used" in arcmsr

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoFix "set but not used" in busdma_bounce.
Scott Long [Fri, 3 Dec 2021 22:20:42 +0000 (15:20 -0700)]
Fix "set but not used" in busdma_bounce.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoFix "set but not used" for the sym driver.
Scott Long [Fri, 3 Dec 2021 22:18:39 +0000 (15:18 -0700)]
Fix "set but not used" for the sym driver.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agosctp: inherit IP level socket options from listening socket
Michael Tuexen [Fri, 3 Dec 2021 21:40:52 +0000 (22:40 +0100)]
sctp: inherit IP level socket options from listening socket

Ensure that TTL and TOS values set on a listener get inheritet
to the accepted sockets.

PR: 260119
MFC after: 1 week