]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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

(cherry picked from commit 5e04571cf3cf4024be926976a6abf19626df30be)

2 years agoRegen
Konstantin Belousov [Wed, 10 Nov 2021 19:44:25 +0000 (21:44 +0200)]
Regen

2 years agosched.h: Use pid_t type for pid argument
David CARLIER [Fri, 17 Dec 2021 06:22:21 +0000 (08:22 +0200)]
sched.h: Use pid_t type for pid argument

(cherry picked from commit 65dd321054cbbbcca192375b08843e860fc3b3c5)

2 years agosched_get/setaffinity(3): pid 0 should designate current process
Math Ieu [Fri, 17 Dec 2021 05:31:09 +0000 (07:31 +0200)]
sched_get/setaffinity(3): pid 0 should designate current process

PR: 260487

(cherry picked from commit caacda7a3e898a8b142d27732a9f13a525b08ea7)

2 years agosched.h: Hide all Linux compat sched_* functions under _WITH_CPU_SET_T
Konstantin Belousov [Thu, 11 Nov 2021 08:01:54 +0000 (10:01 +0200)]
sched.h: Hide all Linux compat sched_* functions under _WITH_CPU_SET_T

(cherry picked from commit 90fa9705d5cd29cf11c5dc7319299788dec2546a)

2 years agosched.h: add CPU_EQUAL() for better compatibility with Linux
Konstantin Belousov [Sat, 30 Oct 2021 07:36:24 +0000 (10:36 +0300)]
sched.h: add CPU_EQUAL() for better compatibility with Linux

(cherry picked from commit 43e6f07b06e05cd36c22b204be5be94c2807aec8)

2 years agox86: provide userspace implementation of sched_getcpu() where possible
Konstantin Belousov [Sun, 31 Oct 2021 01:39:31 +0000 (03:39 +0200)]
x86: provide userspace implementation of sched_getcpu() where possible

(cherry picked from commit f239545591a821386f9bdb84c02044884ad415b5)

2 years agoAdd sched_getcpu()
Konstantin Belousov [Fri, 22 Oct 2021 15:35:53 +0000 (18:35 +0300)]
Add sched_getcpu()

(cherry picked from commit 77b2c2f81451db8119e4ea6398fe76813db790de)

2 years agoAdd sched_get/setaffinity(3)
Konstantin Belousov [Fri, 22 Oct 2021 15:21:33 +0000 (18:21 +0300)]
Add sched_get/setaffinity(3)

(cherry picked from commit 43736b71dd051212d5c55be9fa21c45993017fbb)

2 years agoAdd real sched.h
Konstantin Belousov [Fri, 22 Oct 2021 15:17:21 +0000 (18:17 +0300)]
Add real sched.h

(cherry picked from commit 160b4b922b6021848b6b48afc894d16b879b7af2)

2 years agoefifb,vbefb: implement vd_fini
Greg V [Tue, 30 Mar 2021 15:46:17 +0000 (17:46 +0200)]
efifb,vbefb: implement vd_fini

This removes the pmap entry when switching away to e.g. drm fb.

Differential Revision: https://reviews.freebsd.org/D29020
MFC After: 1 month

(cherry picked from commit 8ebda6e44bb6ac9113e2a7fe65889811d894dd63)

2 years agobhyve: emulate reads of MSI-X capabilities for passthru devices
Corvin Köhne [Mon, 22 Nov 2021 15:27:33 +0000 (16:27 +0100)]
bhyve: emulate reads of MSI-X capabilities for passthru devices

Reads of the MSI-X capabilites aren't emulated by passthru devices
yet. The guest will read the host MSI-X capabilites which could
cause issues.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D32686
Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit fe66bcf9ff8623bf69a183c9eb8c5ce72cce7db6)

2 years agobhyve: keep physical and virtual COMMAND reg in sync
Corvin Köhne [Mon, 22 Nov 2021 15:26:03 +0000 (16:26 +0100)]
bhyve: keep physical and virtual COMMAND reg in sync

On startup all virtual BARs are registered.
Additionally, the encoding bit in the virtual cmd register is set.
After that, the passthru emulation overwrites the virtual cmd register with
the physical one.
This could lead to a mismatch between registered BARs and the encoding
bits in the cmd register.
Instead of writing the physical to the virtual cmd register,
write the virtual to the physical cmd register to solve this issue.

Reviewed by:   markj
Differential Revision: https://reviews.freebsd.org/D32687
Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 2eb2079554f4d54c4283410b4ee1aca549b29616)

2 years agobhyve: use a fixed 32 bit BAR base address
Corvin Köhne [Mon, 22 Nov 2021 15:24:47 +0000 (16:24 +0100)]
bhyve: use a fixed 32 bit BAR base address

OVMF always uses 0xC0000000 as base address for 32 bit PCI MMIO space.
For that reason, we should use that address too.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D31051
Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 5cf21e48ccf114928da9c6564c7e5dec7d6119c5)

bhyve: Fix compile

We need err.h

Fixes: 5cf21e48ccf11 ("bhyve: use a fixed 32 bit BAR base address")
Sponsored by: Bechoff Automation GmbH & Co. KG

(cherry picked from commit fc7207c87795da4533dc7f97287638f6da85b3b0)

2 years agobhyve: move 64 bit BAR location to match OVMF assumptions
Corvin Köhne [Mon, 22 Nov 2021 15:22:48 +0000 (16:22 +0100)]
bhyve: move 64 bit BAR location to match OVMF assumptions

OVMF will fail, if large 64 bit BARs are used. GCD-Map doesn't cover
64 bit addresses of BARs.
OVMF assumes that 64 bit addresses of BARS are located on next 32 GB
boundary behind Top of High RAM.

This patch moves 64 bit BARs on next 32 GB boundary behind Top of High
RAM to match OVMF assumptions.

Differential Revision: https://reviews.freebsd.org/D27970
Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 4a4053e1b053e840cf167a629f8d2b8ae76e6da7)

2 years agobhyve: do not explicitly map fbuf framebuffer
Corvin Köhne [Thu, 18 Nov 2021 15:26:34 +0000 (16:26 +0100)]
bhyve: do not explicitly map fbuf framebuffer

Allocating a BAR will call baraddr which maps the framebuffer. No need
to allocate it explicitly on init.

Reviewed by:     grehan
Sponsored by:    Beckhoff Autmation GmbH & Co. KG
Differential Revision:    https://reviews.freebsd.org/D32596

(cherry picked from commit 5085153ae4d55692415716e0ed03204bdf96d34a)

2 years agobhyve: use physical lobits for BARs of passthru devices
Corvin Köhne [Thu, 18 Nov 2021 15:25:09 +0000 (16:25 +0100)]
bhyve: use physical lobits for BARs of passthru devices

Tell the guest whether a BAR uses prefetched memory or not for
passthru devices by using the same lobits as the physical device.

Reviewed by:  grehan
Sponsored by:  Beckhoff Autmation GmbH & Co. KG
Differential Revision:   https://reviews.freebsd.org/D32685

(cherry picked from commit e87a6f3ef284593c01e0fd3f8b5bfc1f645e5b18)

2 years agobhyve: ignore low bits of CFGADR
Corvin Köhne [Fri, 15 Oct 2021 07:25:54 +0000 (09:25 +0200)]
bhyve: ignore low bits of CFGADR

Bhyve could emulate wrong PCI registers.
In the best case, the guest reads wrong registers and the device driver would
report some errors.
In the worst case, the guest writes to wrong PCI registers and could brick
hardware when using PCI passthrough.

According to Intels specification, low bits of CFGADR should be
ignored. Some OS like linux may rely on it. Otherwise, bhyve could
emulate a wrong PCI register.

E.g.
If linux would like to read 2 bytes from offset 0x02, following would
happen.
linux:
outl 0x80000002 at CFGADR
inw  at CFGDAT + 2
bhyve:
cfgoff = 0x80000002 & 0xFF = 0x02
coff   = cfgoff + (port - CFGDAT) = 0x02 + 0x02 = 0x04
Bhyve would emulate the register at offset 0x04 not 0x02.

Reviewed By: #bhyve, grehan
Differential Revision: https://reviews.freebsd.org/D31819
Sponsored by:        Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 1b0e2f0b607e88feb57accc9521e9623b56ab7e2)

2 years agopkgbase: Track pkg 1.17
Emmanuel Vadot [Tue, 4 May 2021 13:39:55 +0000 (15:39 +0200)]
pkgbase: Track pkg 1.17

With pkg 1.17 the extention is always .pkg, packing_format is also now deprecated.

(cherry picked from commit 6cafdee71d2b23e8ec95d1f128b0e11f103491bb)

2 years agoexec: Simplify sv_copyout_strings implementations a bit
Mark Johnston [Fri, 31 Dec 2021 17:50:15 +0000 (12:50 -0500)]
exec: Simplify sv_copyout_strings implementations a bit

Simplify control flow around handling of the execpath length and signal
trampoline.  Cache the sysentvec pointer in a local variable.

No functional change intended.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit f04a096049382637178b54ffb45089f5f9fb3db9)

2 years agoloader: Fix dtb loading
Emmanuel Vadot [Mon, 5 Jul 2021 13:50:39 +0000 (15:50 +0200)]
loader: Fix dtb loading

When calling file_findfile with only a type it returns
the first file matching the type. But in fdt_apply_overlays we
then iterate on the next files and try loading them as dtb overlays.
Fix this by checking the type one more time.

Sponsored by: Diablotin Systems
Reported by: Mark Millard <marklmi@yahoo.com>

(cherry picked from commit b464c459eaf4e63a3abaaa1ecf51c9d6e9f7521e)

2 years agoFix gssd rc.d installation
Emmanuel Vadot [Mon, 27 Sep 2021 16:31:20 +0000 (18:31 +0200)]
Fix gssd rc.d installation

CONFGROUPS needs to be in CAPS

Fixes: a30235a4c360 ("pkgbase: Create a FreeBSD-kerberos package")
Reported by:     kp

(cherry picked from commit 860ee1792a6b37cc531fcae94c2144c8d62e8fc2)

2 years agoloader: Do not force comconsole for arm and arm64
Emmanuel Vadot [Mon, 15 Nov 2021 11:17:43 +0000 (12:17 +0100)]
loader: Do not force comconsole for arm and arm64

This makes GOP not probed on some situation (AMD Card on PCIe slot
with EDK2 as we have a SERIAL_IO_PROTOCOL compatible uart).

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D32992
Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 123b5b8763778e83b6816ad9db62a9b956055c32)

2 years agoloader: lsefi: Print more information
Emmanuel Vadot [Mon, 15 Nov 2021 11:12:50 +0000 (12:12 +0100)]
loader: lsefi: Print more information

Printing the EFI_HANDLE pointer isn't very useful.
If the handle have a IMAGE_DEVICE_PATH or a DEVICE_PATH protocol print it.
This makes it easier to see which devices are present and what protocol they
expose.

Reviewed by: imp, tsoome
Differential Revision: https://reviews.freebsd.org/D32991
Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 2e0d67c3ed7ec760b2d54f8258304b2e6359418b)

2 years agoloader: Add more bus name to pnpautoload
Emmanuel Vadot [Sun, 14 Nov 2021 14:32:00 +0000 (15:32 +0100)]
loader: Add more bus name to pnpautoload

Add ofwbus, iicbus and spibus to pnpautoload so modules under those
buses will be loaded.
On my rockpro64 now :
OK pnpautoload -v
Autoloading modules for simplebus
Using DTB provided by EFI at 0x8100000.
Autoloading modules for ofwbus
/boot/kernel/rk_spi.ko text=0x14b2 text=0xd4c data=0x4d0+0x8 syms=[0x8+0xa98+0x8+0x807]
/boot/kernel/dwwdt.ko text=0x12e2 text=0x78c data=0x4c8+0x10 syms=[0x8+0x990+0x8+0x6e1]
Autoloading modules for iicbus
Autoloading modules for spibus
/boot/kernel/mx25l.ko text=0x1613 text=0x114c data=0x6e8+0x8 syms=[0x8+0xa08+0x8+0x665]
loading required module 'fdt_slicer'
/boot/kernel/fdt_slicer.ko text=0x95e text=0x340 data=0x290 syms=[0x8+0x6c0+0x8+0x4a0]

(cherry picked from commit 4c0c353d0e48d06f82cae16aba02e5923794ba98)

2 years agoloader: Fix pnpload and add some usage
Emmanuel Vadot [Sun, 14 Nov 2021 14:22:14 +0000 (15:22 +0100)]
loader: Fix pnpload and add some usage

pnpload needs a busname and a compat data.

(cherry picked from commit d4874307fd5dc825e8a80adf7a531ed4bc43f235)

2 years agoloader: Fix pnpmatch and add some usage
Emmanuel Vadot [Sun, 14 Nov 2021 14:11:24 +0000 (15:11 +0100)]
loader: Fix pnpmatch and add some usage

pnpmatch needs a busname and a compat data.

(cherry picked from commit 544af629a4906be1873983dfa129e65bc5d0c3df)

2 years agoAdd ETHER_ALIGN support to ng_device(4).
Ian Lepore [Tue, 9 Nov 2021 14:34:06 +0000 (15:34 +0100)]
Add ETHER_ALIGN support to ng_device(4).

This adds a new ng_device command, NGM_DEVICE_ETHERALIGN, which has no
associated args.  After the command arrives, the device begins adjusting all
packets sent out its hook to have ETHER_ALIGN bytes of padding at the
beginning of the packet.  The ETHER_ALIGN padding is added only when
running on an architecture that requires strict alignment of IP headers
(based on the __NO_STRICT_ALIGNMENT macro, which is only #define'd on
x86 as of this writing).

This also adds ascii <-> binary command translation to ng_device, both for
the existing NGM_DEVICE_GET_DEVNAME and the new ETHERALIGN command.

This also gives a name to every ng_device node when it is constructed, using
the cdev device name (ngd0, ngd1, etc).  This makes it easier to address
command msgs to the device using ngctl(8).

Reviewed by: donner, ray, adrian
Differential Revision: https://reviews.freebsd.org/D32905
MFC after:   1 week

(cherry picked from commit 44aae623ab858387301358b9b054cd229ce41068)

2 years agotcptw: count how many times a tcptw was actually useful
Gleb Smirnoff [Thu, 13 Jan 2022 21:19:40 +0000 (13:19 -0800)]
tcptw: count how many times a tcptw was actually useful

This will allow a sysadmin to lower net.inet.tcp.msl and
see how long tcptw are actually useful.

(cherry picked from commit 71d2d5adfe18e80e5f8afeb4f86ef69be1aaad81)

2 years agostand: Don't build readtest command on mips
Emmanuel Vadot [Thu, 13 Jan 2022 13:38:24 +0000 (14:38 +0100)]
stand: Don't build readtest command on mips

MIPS doesn't have getsecs which is used in this command.
Simply don't include it for this arch.

This is a direct commit to stable/13.

Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agoloader: tftp: Copy the first block into the cache
Emmanuel Vadot [Thu, 30 Dec 2021 08:47:06 +0000 (09:47 +0100)]
loader: tftp: Copy the first block into the cache

tftp_open reads the first block so copy it in the cached data.
If we have more than one block (i.e. we called tftp_read before
tftp_preload) simply just reset the transfer.

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

(cherry picked from commit dfc9c1d4937d0e2eab2910665069faba814bca1e)

2 years agoloader: lua: test that /boot exists first
Emmanuel Vadot [Mon, 13 Dec 2021 13:18:12 +0000 (14:18 +0100)]
loader: lua: test that /boot exists first

Otherwise on fs like tftp where no directory listing is possible we fail
on the .dir method.

Reviewed by: imp, kevans
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33414

(cherry picked from commit c4dc907254a4275d8f3ecd9a6b615c6e2a2438e9)

2 years agoloader: bcache: Fix debug printf
Emmanuel Vadot [Mon, 13 Dec 2021 08:23:19 +0000 (09:23 +0100)]
loader: bcache: Fix debug printf

Use %j to it works on 64 and 32 bits system.

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

(cherry picked from commit 8ed8b4203a2f9b1bd337b8af26021ae2240a0ee8)

2 years agoloader: tftp: Add preload method
Emmanuel Vadot [Fri, 10 Dec 2021 09:37:01 +0000 (10:37 +0100)]
loader: tftp: Add preload method

The preload method will transfer the whole file in a buffer and cache it
so read/lseek operations are faster.

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

(cherry picked from commit 3eb019000c9eba6dafad6741a88f627b4d4fcd8a)

2 years agoloader: Add preload operation to fs_ops
Emmanuel Vadot [Fri, 10 Dec 2021 09:33:43 +0000 (10:33 +0100)]
loader: Add preload operation to fs_ops

When we load an ELF file (kernel or module) we do seek(2) a lot to
parse/load the different sections of the ELF file.
Protocol like TFTP suffers a lot from this as there is no resume or
a way to start the tranfer from a specified offset in the file.
fs_preload is added to help those protocol.
Call preload just after opening the ELF file that we need to load so
the underlying method can cache the hole file and then read/lseek operations
are faster.

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

(cherry picked from commit c25d9aff4607e7f1c378b0b7853e49c07c0af91a)

2 years agoloader: implement mount/unmount rootfs
Toomas Soome [Thu, 12 Aug 2021 05:45:52 +0000 (08:45 +0300)]
loader: implement mount/unmount rootfs

We want to keep our root file system open to preserve bcache segment
between file accesses, thus reducing physical disk IO.

Reviewed by: imp, allanjude, kevans (previous version)
Differential Revision: https://reviews.freebsd.org/D30848
MFC after: 1 month

(cherry picked from commit b4cb3fe0e39a31e60292018dc9fb7510b3de92bf)

2 years agoloader: ip: Do not call getsecs so much
Emmanuel Vadot [Thu, 9 Dec 2021 14:46:39 +0000 (15:46 +0100)]
loader: ip: Do not call getsecs so much

getsecs is very costly, reuse the values we got before.

Fetching a ~30MB kernel with the tftp command use to take ~26 seconds
and now it's ~18 seconds.

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

(cherry picked from commit c5f24f5e0db24c8e33e6278a4fbb7e68364ca18d)

2 years agoloader: tftp: Don't let tftp timeout
Emmanuel Vadot [Mon, 13 Dec 2021 09:35:23 +0000 (10:35 +0100)]
loader: tftp: Don't let tftp timeout

When we load a kernel or module we open/close it a few times.
Since we're using the same port number each time and that we requested
the same file the ACK that we send are valid on the server side and the
server send us the file multiple times.
This makes tftp loading time very inconsistant due to the UDP "flood" that
we have to process.

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

(cherry picked from commit 4f36ed513cc8fc3fe780b23ecda8cb1fdc6edf7d)

2 years agoloader: Add a readtest command
Emmanuel Vadot [Thu, 9 Dec 2021 13:54:58 +0000 (14:54 +0100)]
loader: Add a readtest command

readtest will simply load the file in memory, useful for timing
loading on some filesystems.

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

(cherry picked from commit 70661eaafa069062317ae2c6012cc2bc303da0cc)

2 years agoloader: tftp: Don't error on tftp error 0
Emmanuel Vadot [Wed, 8 Dec 2021 15:18:49 +0000 (16:18 +0100)]
loader: tftp: Don't error on tftp error 0

tftp-hpa sends NAK with tftp error set to 0 when trying to get
a directory and this is the first thing that loader tries to do
and this make it hangs.

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

(cherry picked from commit bf07f2f8623d5e29e814b9dc49a0cdff920778c3)

2 years agoCTL: Allow I/Os up to 8MB, depending on maxphys value.
Alexander Motin [Thu, 30 Dec 2021 03:58:52 +0000 (22:58 -0500)]
CTL: Allow I/Os up to 8MB, depending on maxphys value.

For years CTL block backend limited I/O size to 1MB, splitting larger
requests into sequentially processed chunks.  It is sufficient for
most of use cases, since typical initiators rarely use bigger I/Os.

One of known exceptions is VMWare VAAI offload, by default sending up
to 8 4MB EXTENDED COPY requests same time.  CTL internally converted
those into 32 1MB READ/WRITE requests, that could overwhelm the block
backend, having finite number of processing threads and making more
important interactive I/Os to wait in its queue.  Previously it was
partially covered by CTL core serializing sequential reads to help
ZFS speculative prefetcher, but that serialization was significantly
relaxed after recent ZFS improvements.

With the new settings block backend receives 8 4MB requests, that
should be easier for both CTL itself and the underlying storage.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

(cherry picked from commit b06771aa667dadeffa0b0ec840af13b74d55e186)

2 years agovfs_mountroot: Check for root dev before waiting
Colin Percival [Mon, 20 Dec 2021 17:55:36 +0000 (09:55 -0800)]
vfs_mountroot: Check for root dev before waiting

If GEOM is idle but the root device is not yet present when we enter
vfs_mountroot_wait_if_necessary, we call vfs_mountroot_wait to wait
for root holds (e.g. CAM or USB initialization).  Upon returning from
vfs_mountroot_wait, we wait 100 ms at a time until the root device
shows up.

Since the root device most likely appeared during vfs_mountroot_wait
-- waiting for subsystems which may be responsible for the root
device is the whole purpose of that function -- it makes sense to
check if the device is now present rather than printing a warning
and pausing for 100 ms before checking.

Reviewed by: trasz
Fixes: a3ba3d09c248 Make root mount wait mechanism smarter
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D33593

(cherry picked from commit 33812d60b9601d7ef8a7222c063696bfd6a77f41)

2 years agovfs_mountroot: Wait for GEOM idle post root holds
Colin Percival [Mon, 20 Dec 2021 17:51:34 +0000 (09:51 -0800)]
vfs_mountroot: Wait for GEOM idle post root holds

In the case of a root hold related to the initialization of a disk
device, a flurry of GEOM tasting is likely to take place as soon as
the device is initialized and the root hold is released.  If we
don't wait for GEOM idle it's easy for vfs_mountroot to "win" the
race and proceed before the root filesystem GEOM is ready.

Reviewed by: imp
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D33592

(cherry picked from commit 19a172158cc12b3bdd848fead732f2151c36e526)

2 years agovfs_mountroot: Skip 'Root mount waiting' < 1 s
Colin Percival [Mon, 20 Dec 2021 15:17:25 +0000 (07:17 -0800)]
vfs_mountroot: Skip 'Root mount waiting' < 1 s

While the message is technically correct, it's not particularly
helpful in the case where we're only waiting a few ms; this case
occurs frequently on EC2 arm64 instances with CAM initialization
racing to release its root hold before vfs_mountroot reaches this
point.  Only print the message if we end up waiting for more than
one second.

Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D33591

(cherry picked from commit e6db5eb9ec7ba9edfc564fd5ade5fb40df9acebb)

2 years agolibsysdecode: Decode sendmsg/recvmsg flags containing an underscore
Mark Johnston [Tue, 4 Jan 2022 14:40:26 +0000 (09:40 -0500)]
libsysdecode: Decode sendmsg/recvmsg flags containing an underscore

Otherwise MSG_CMSG_CLOEXEC is not decoded.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit e2576591b9bdccc187bcd509be760c18c96a7790)

2 years agomvneta: Unconditionally print an error message if mii_attach() fails
Mark Johnston [Tue, 4 Jan 2022 14:42:34 +0000 (09:42 -0500)]
mvneta: Unconditionally print an error message if mii_attach() fails

The error message is useful for diagnosing mvneta_attach() failures.

(cherry picked from commit ed166a0173247e267c507ebd0ec03cb04aaf49ee)

2 years agoadd exuberant ctags tags file to gitignore
Andriy Gapon [Sun, 26 Dec 2021 10:16:23 +0000 (12:16 +0200)]
add exuberant ctags tags file to gitignore

(cherry picked from commit ace3370392f8cf874dafece4a9f558840b688e01)

2 years agoGEOM: Minor polishing in geom_event.
Alexander Motin [Tue, 28 Dec 2021 01:52:59 +0000 (20:52 -0500)]
GEOM: Minor polishing in geom_event.

 - Remove timeouts from msleep()'s.  Those should always be woken up.
 - Move wakeup() under the lock to not call on possibly freed pointer.
 - Remove some dead code.

MFC after: 2 weeks

(cherry picked from commit f4bf48c25c3a8de3fbfd49b45b2d59026df13a6a)

2 years agoipfilter: Add SDT probe frb_natv6in
Cy Schubert [Wed, 29 Dec 2021 01:45:21 +0000 (17:45 -0800)]
ipfilter: Add SDT probe frb_natv6in

Like IPv4 NAT frb_natv4in, add a corresponding IPv6 NAT SDT probe called
frb_natv6in.

(cherry picked from commit 6b54d2f4c52985b2e48c7ece6f0bdbc396bcc23f)

2 years agoipfilter: Unconditionally expose SDT probe frb_natv4in
Cy Schubert [Wed, 29 Dec 2021 01:41:03 +0000 (17:41 -0800)]
ipfilter: Unconditionally expose SDT probe frb_natv4in

SDT probe frb_natv4in is only available when an error is encountered.
Make it also available when no error is encountered, i.e. NATed and
not translated.

(cherry picked from commit b6f072f767c58aca8d9440f9c1785731f58e815c)

2 years agopowerpc64: fix the calculation of Maxmem
Leandro Lupori [Wed, 15 Dec 2021 11:49:47 +0000 (08:49 -0300)]
powerpc64: fix the calculation of Maxmem

The calculation of Maxmem was skipping the last phys_avail segment,
because of a wrong stop condition.

This was detected when using QEMU/PowerNV with Radix MMU and low
memory (2G). In this case opal_pci would allocate a DMA window that
was too small to cover all physical memory, resulting in reading all
zeroes from disk when using memory that was not inside the allocated
window.

Reviewed by: jhibbits
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D33449

(cherry picked from commit a076e2060c07307e7416759075db71f23de722c0)

2 years agoRemove an obsolete warning from NOTES
Mark Johnston [Mon, 3 Jan 2022 15:13:56 +0000 (10:13 -0500)]
Remove an obsolete warning from NOTES

The PREEMPTION option is enabled in all GENERIC kernel configurations.

(cherry picked from commit 5ba4192565c353b11999332c0b9e85edddc657db)

2 years agoposixshm tests: Fix occasional largepage_mprotect failures
Mark Johnston [Mon, 3 Jan 2022 16:15:46 +0000 (11:15 -0500)]
posixshm tests: Fix occasional largepage_mprotect failures

largepage_mprotect maps a superpage and later extends the mapping.  This
occasionally fails with ASLR disabled.  To fix this, first try to
reserve a sufficiently large virtual address region.

Reported by: Jenkins
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 321e586e46115c69e7e833d592703d997a4ec477)

2 years agoloader.efi: to preserve heap space, use AllocatePages() for shadow_fb
Toomas Soome [Fri, 17 Dec 2021 13:10:05 +0000 (15:10 +0200)]
loader.efi: to preserve heap space, use AllocatePages() for shadow_fb

shadow FB size could be rather large and depends on resolution,
instead of using heap, allocate dedicated space outside of heap.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D33600

(cherry-picked from 221376db0cb77035e325baf8b54d6224925b41f8)

2 years agoloader: framebuffer should only be written into
Toomas Soome [Mon, 6 Dec 2021 17:21:58 +0000 (19:21 +0200)]
loader: framebuffer should only be written into

Reading from Write Combining memory can be very-very slow. Try to use
shadow buffer to avoid such reads.

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

(cherry-picked from 6102f43cf060a592894dcd591c2dfced14581983)

2 years agoAdd the missing terminator to the bcm_xhci methods
Andrew Turner [Wed, 29 Dec 2021 12:18:10 +0000 (12:18 +0000)]
Add the missing terminator to the bcm_xhci methods

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6e1be96fd24748fe5d77ad3ac767e3b1b0ab0701)

2 years agoExtract the arm64 signal code to a new file
Andrew Turner [Tue, 14 Dec 2021 18:05:29 +0000 (18:05 +0000)]
Extract the arm64 signal code to a new file

This will be used by the vdso signal trampoline on arm64.

While here fix the license as this part of locore.S to correct the
copyright owner.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 8ddb4b9b6668f88acc70042923384383247340dc)

2 years agoarm64: Fix COMPAT_FREEBSD32.
Olivier Houchard [Wed, 10 Mar 2021 18:01:41 +0000 (19:01 +0100)]
arm64: Fix COMPAT_FREEBSD32.

The ENTRY() macro was modified by commit
28d945204ea1014d7de6906af8470ed8b3311335 to add an optional NOP instruction
at the beginning of the function. It is of course an arm64 instruction, so
unsuitable for the 32bits sigcode. So just use EENTRY() instead for
aarch32_sigcode. This should fix receiving signals when running 32bits
binaries on FreeBSD/arm64.

MFC After: 1 week

(cherry picked from commit c328f64d81079bad5064c8a387883df50ab5aaed)

2 years agoacpi_support: Remove CTLFLAG_NEEDGIANT from sysctls.
Alexander Motin [Mon, 27 Dec 2021 00:37:08 +0000 (19:37 -0500)]
acpi_support: Remove CTLFLAG_NEEDGIANT from sysctls.

MFC after: 2 weeks

(cherry picked from commit 6237a1cc2d2e3280b16cdc2d0d322fb8eedf1345)

2 years agokern: Remove CTLFLAG_NEEDGIANT from some more sysctls.
Alexander Motin [Mon, 27 Dec 2021 04:07:33 +0000 (23:07 -0500)]
kern: Remove CTLFLAG_NEEDGIANT from some more sysctls.

MFC after: 2 weeks

(cherry picked from commit c6c52d8e39b2dbee573bc80f32b5b7019cef1973)

2 years agonetgraph: Remove CTLFLAG_NEEDGIANT from sysctl.
Alexander Motin [Mon, 27 Dec 2021 00:42:53 +0000 (19:42 -0500)]
netgraph: Remove CTLFLAG_NEEDGIANT from sysctl.

MFC after: 2 weeks

(cherry picked from commit 2f1a46d12b035084cf2836043f8c1f3f23ede9c5)

2 years agosound: Remove CTLFLAG_NEEDGIANT from some sysctls.
Alexander Motin [Mon, 27 Dec 2021 01:37:55 +0000 (20:37 -0500)]
sound: Remove CTLFLAG_NEEDGIANT from some sysctls.

While there, remove some dead code.

MFC after: 2 weeks

(cherry picked from commit 3b4c5433229ac912929b77edee0b4dc001d70fe5)

2 years agoacpica: Remove CTLFLAG_NEEDGIANT from most sysctls.
Alexander Motin [Mon, 27 Dec 2021 00:17:52 +0000 (19:17 -0500)]
acpica: Remove CTLFLAG_NEEDGIANT from most sysctls.

MFC after: 2 weeks

(cherry picked from commit 3e68d2c52b4e4b0aafce2c7f6bcb8f063c6a8d55)

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

(cherry picked from commit adc88b9c01b5d7a51c896091b291afbdae42b02a)

2 years agoFix fragmented UDP packets handling since rev.360967.
Maxim Sobolev [Thu, 7 Oct 2021 20:41:40 +0000 (13:41 -0700)]
Fix fragmented UDP packets handling since rev.360967.

Consider IP_MF flag when checking length of the UDP packet to
match the declared value.

Sponsored by: Sippy Software, Inc.
Differential Revision: https://reviews.freebsd.org/D32363
MFC after: 2 weeks

(cherry picked from commit 461e6f23db3b9794e6af88b381b066a2c0463d1c)

2 years agoiwlwifi: clarifying man page update
Bjoern A. Zeeb [Sat, 1 Jan 2022 18:08:31 +0000 (18:08 +0000)]
iwlwifi: clarifying man page update

Based on some feedback clarify the man page for
- how to load the driver currently
- status of the driver with respect to iwm(4)
and leave a comment to (automatically) add a full list of chipsets
to the man page.

Sponsored by: The FreeBSD Foundation
Reviewed by: debdrup
Differential Revision: https://reviews.freebsd.org/D33713

(cherry picked from commit e9016c0be83f9b1d9cf7c2460ee3b041967bb75f)

2 years agobhyve: passthru: enable BARs before possibly mmap(2)ing them
Bjoern A. Zeeb [Thu, 23 Dec 2021 14:59:49 +0000 (14:59 +0000)]
bhyve: passthru: enable BARs before possibly mmap(2)ing them

The first time we start bhyve with a passthru device everything is fine
as on boot we do enable BARs.  If a driver (unload) inside bhyve disables
the BAR(s) as some Linux drivers do, we need to make sure we re-enable
them on next bhyve start.

If we are trying to mmap a disabled BAR for MSI-X (PCIOCBARMMAP)
the kernel will give us an EBUSY.
While we were re-enabling the BAR(s) in the current code loop
cfginit() was writing the changes out too late to the real hardware.

Move the call to init_msix_table() after the register on the real
hardware was updated.  That way the kernel will be happy and the
mmap will succeed and bhyve will start.
Also simplify the code given the last argument to init_msix_table()
is unused we do not need to do checks for each bar. [1]

Some passthru devices only support MSI instead of MSI-X. For those
devices the initialization of MSI-X table will fail. Re-add (or in
the MFC case keep) the check erroneously removed in the initial commit. [2]

PR: 260148
Pointed out by: markj [1]
Sponsored by: The FreeBSD Foundation
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D33628
Submitted by: (C.Koehne beckhoff.com) [2]
Reviewed by: manu, bz
Differential Revision: https://reviews.freebsd.org/D33728

(cherry picked from commit f1442847c9404d4bc5f5524a0c3362dd39cb14f9)
(cherry picked from commit 338a1be836308f6d807f8bfe9b335463d537abc4)

2 years agoLinuxKPI: 802.11 fix queue wait
Bjoern A. Zeeb [Fri, 31 Dec 2021 11:47:14 +0000 (11:47 +0000)]
LinuxKPI: 802.11 fix queue wait

We are using a bandaid to wait for queues after station creation
looping and pausing.
The abort condition was looping in the wrong direction so we were
potentially waiting forever if queues never became ready.
From initial user test data we also found that the wait time was
too low in some cases so increase the length.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 500be2e803377e6fe3aa1600e6d55326bbbb4ae4)

2 years agoiwlwifi: import correct firmware versions for select Intel iwlwifi/mvm
Bjoern A. Zeeb [Fri, 31 Dec 2021 11:51:18 +0000 (11:51 +0000)]
iwlwifi: import correct firmware versions for select Intel iwlwifi/mvm

The firmware files for 3160, 7260, and 7265 imported contain old versions
no longer supported by the driver.
Replace with latest versions from linux-firmware to possibly also
support these chip revisions.

Reported by: FreeBSD User (freebsd walstatt-de.de) on wireless (2021-12-30)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 58101517cb3be0c47dba3696327e15f627765f02)

2 years agopccbb: Remove Giant mention in comments.
Alexander Motin [Sun, 26 Dec 2021 02:51:48 +0000 (21:51 -0500)]
pccbb: Remove Giant mention in comments.

MFC after: 2 weeks

(cherry picked from commit 22405bb2e45e1168d547b9238bf026b66f2d7543)

2 years agokern: Remove CTLFLAG_NEEDGIANT from some sysctls.
Alexander Motin [Sun, 26 Dec 2021 17:02:28 +0000 (12:02 -0500)]
kern: Remove CTLFLAG_NEEDGIANT from some sysctls.

MFC after: 2 weeks

(cherry picked from commit fe27f1db5f0b67ad2681a35253f7c1a4dc9874f8)

2 years agoamdtemp: Remove CTLFLAG_NEEDGIANT from sysctls.
Alexander Motin [Sun, 26 Dec 2021 02:03:54 +0000 (21:03 -0500)]
amdtemp: Remove CTLFLAG_NEEDGIANT from sysctls.

It seems to be needed only to serialize very old K8 registers access.
Introduce separate lock for that and remove Giant dependency.

MFC after: 2 weeks

(cherry picked from commit 6c101ed7a3f7cb47d6ac5c9e5fd33580ac8fa699)

2 years agox86: Remove CTLFLAG_NEEDGIANT from sysctls.
Alexander Motin [Sun, 26 Dec 2021 03:24:20 +0000 (22:24 -0500)]
x86: Remove CTLFLAG_NEEDGIANT from sysctls.

MFC after: 2 weeks

(cherry picked from commit 1d6fb900ed90d1fd6547e2d79da9d0259f450c2c)

2 years agouart: Remove CTLFLAG_NEEDGIANT from sysctl.
Alexander Motin [Sun, 26 Dec 2021 02:30:02 +0000 (21:30 -0500)]
uart: Remove CTLFLAG_NEEDGIANT from sysctl.

MFC after: 2 weeks

(cherry picked from commit c214c2c0049444f5ba22bc9f93546153f4a2f1d8)

2 years agohwpmc: Remove CTLFLAG_NEEDGIANT from sysctl.
Alexander Motin [Sun, 26 Dec 2021 02:40:14 +0000 (21:40 -0500)]
hwpmc: Remove CTLFLAG_NEEDGIANT from sysctl.

MFC after: 2 weeks

(cherry picked from commit 1886cef69bf270bbbe7e9a0fd2a212fc17b76204)

2 years agomountmsdosfs(): some style
Konstantin Belousov [Thu, 30 Dec 2021 19:33:41 +0000 (21:33 +0200)]
mountmsdosfs(): some style

(cherry picked from commit 04fd468da0d0baea535da418b92df74101a9659d)

2 years agoSilent some warnings for i386 kernel build
Konstantin Belousov [Thu, 6 Jan 2022 04:45:49 +0000 (06:45 +0200)]
Silent some warnings for i386 kernel build

(cherry picked from commit 3c94280825c78c0ed00e1dcc704fac8a04f933e3)

2 years agoipfilter: Make LARGE_NAT a tunable.
Cy Schubert [Tue, 16 Feb 2021 15:44:07 +0000 (07:44 -0800)]
ipfilter: Make LARGE_NAT a tunable.

LARGE_NAT is a C macro that increases
NAT_SIZE from 127 to 2047,
RDR_SIZE from 127 to 2047,
HOSTMAP_SIZE from 2047 to 8191,
NAT_TABLE_MAX from 30000 to 180000, and
NAT_TABLE_SZ from 2047 to 16383.

These values can be altered at runtime using the ipf -T command however
some adminstrators of large firewalls rebuild the kernel to enable
LARGE_NAT at boot. This revision adds the tunable net.inet.ipf.large_nat
which allows an administrator to set this option at boot instead of build
time. Setting the LARGE_NAT macro to 1 is unaffected allowing build-time
users to continue using the old way.

(cherry picked from commit a805ffbcbce85872e71d825fd405a4a30e2ab4bc)

2 years agobhyve: Map the right BAR in init_msix_table()
Mark Johnston [Tue, 4 Jan 2022 19:02:55 +0000 (14:02 -0500)]
bhyve: Map the right BAR in init_msix_table()

The PBA and MSI-X table can reside in different BARs.

Reported by: Andy Fiddaman <andy@omniosce.org>
Reviewed by: jhb
Fixes: 7fa233534736 ("bhyve: Map the MSI-X table unconditionally for passthrough")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 76b45e688ae84a701f52039c4d0abf8e21a3f59c)

2 years agobhyve: Correct unmapping of the MSI-X table BAR
Mark Johnston [Wed, 5 Jan 2022 15:08:13 +0000 (10:08 -0500)]
bhyve: Correct unmapping of the MSI-X table BAR

The starting address passed to mprotect was wrong, so in the case where
the last page containing the table is not the last page of the BAR, the
wrong region would be unmapped.

Reported by: Andy Fiddaman <andy@omniosce.org>
Reviewed by: jhb
Fixes: 7fa233534736 ("bhyve: Map the MSI-X table unconditionally for passthrough")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 4558c11f1b4dfd7fd505d70b79467eb7f1193f07)

2 years agoCirrus-CI: build with LLVM 13 package
Ed Maste [Wed, 17 Nov 2021 02:42:51 +0000 (21:42 -0500)]
Cirrus-CI: build with LLVM 13 package

As of 28a41182c08e the base system uses Clang/LLVM 13.  Follow along in
Cirrus-CI (which uses a packaged toolchain for speed).

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 63f44132810d2b15178503cb738866f6e8533aee)

2 years agoCirrus-CI: switch to Clang/LLVM 12
Ed Maste [Tue, 4 May 2021 19:22:25 +0000 (15:22 -0400)]
Cirrus-CI: switch to Clang/LLVM 12

dim@ is preparing to import Clang/LLVM 12 into the base system as the
system compiler / toolchain.  Apply the same change to the Cirrus-CI
config.

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

(cherry picked from commit 15c0aaf51703cc102940aa647d623ec8ffbe9259)

2 years agoCirrus-CI: report pkg version
Ed Maste [Mon, 26 Jul 2021 17:27:16 +0000 (13:27 -0400)]
Cirrus-CI: report pkg version

PR: 257422
(cherry picked from commit a077a4e3b41bb676be1237fb0af78d6814393fe7)

2 years agoctfconvert: Handle arrays of empty structs
Mark Johnston [Fri, 31 Dec 2021 17:55:01 +0000 (12:55 -0500)]
ctfconvert: Handle arrays of empty structs

Members with such a type will legitimately have a size of zero, so don't
emit a warning.

PR: 260818
Reviewed by: bz
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 963f5dc7a30624e95d72fb7f87b8892651164e46)

2 years agomips: Implement suword16
Hans Petter Selasky [Fri, 7 Jan 2022 13:30:18 +0000 (14:30 +0100)]
mips: Implement suword16

(cherry picked from commit ac672e747ff15e24ffa99f11c11f27ae305e988f)

2 years agoImplement suword16() for the 32-bit ARMv6/v7 architecture.
Hans Petter Selasky [Sun, 19 Dec 2021 11:12:58 +0000 (12:12 +0100)]
Implement suword16() for the 32-bit ARMv6/v7 architecture.

Sponsored by: NVIDIA Networking

(cherry picked from commit 516df155820471dd333a9cbc35bca3680d7b0051)
(cherry picked from commit 48014c6679024f5f1b8217508915fbcd69c2041b)

2 years agoImplement suword16() for the 32/64-bit PowerPC architecture.
Hans Petter Selasky [Sun, 19 Dec 2021 11:19:53 +0000 (12:19 +0100)]
Implement suword16() for the 32/64-bit PowerPC architecture.

Sponsored by: NVIDIA Networking

(cherry picked from commit e98efdd973560e66557f3ab46ca10376acb3c583)
(cherry picked from commit eb771bf6f496538d2f621780702200f5390ff435)

2 years agosnd_uaudio(4): Loosen up the USB MIDI permissions.
Hans Petter Selasky [Fri, 17 Dec 2021 10:52:00 +0000 (11:52 +0100)]
snd_uaudio(4): Loosen up the USB MIDI permissions.

This makes USB MIDI more userfriendly for desktop users.

PR: 260489
Sponsored by: NVIDIA Networking

(cherry picked from commit 2fcd7d380ba103060d43d6d01c1af6bb95819504)

2 years agong_ubt(4): Introduce net.bluetooth.usb_isoc_enable loader tunable to disable
Hans Petter Selasky [Tue, 7 Dec 2021 10:28:21 +0000 (11:28 +0100)]
ng_ubt(4): Introduce net.bluetooth.usb_isoc_enable loader tunable to disable
isochronous transfers.

If users want to disable isochronous transfers, which cause high
frequency periodic interrupts from the USB host controller, then
net.bluetooth.usb_isoc_enable can be set to zero, either as a
sysctl(8) or as a loader.conf(5) tunable.

Differential Revision: https://reviews.freebsd.org/D33282
Submitted by: naito.yuichiro@gmail.com
PR: 238235
Sponsored by: NVIDIA Networking

(cherry picked from commit 67cbbf19595da4565d3c8603030fdb8d33ed571e)
(cherry picked from commit 03f0393477db4c11f8dc4166fadc2628b2c15ae9)
(cherry picked from commit 8fa952937bbe44a0fdd17348adfbbfd44aef6004)

2 years agokldstat(8): style(9) fixes.
Hans Petter Selasky [Tue, 9 Nov 2021 21:09:59 +0000 (22:09 +0100)]
kldstat(8): style(9) fixes.

No functional change intended.

Differential revision:  https://reviews.freebsd.org/D32506
Submitted by:   christos@
Sponsored by:   NVIDIA Networking

(cherry picked from commit 83237efcdbc183e14a27a93579e53bb571756d6a)

2 years agokldstat(8): Fix indentation, whitespace to tabs.
Hans Petter Selasky [Tue, 9 Nov 2021 21:09:54 +0000 (22:09 +0100)]
kldstat(8): Fix indentation, whitespace to tabs.

No functional change intended.

Differential revision:  https://reviews.freebsd.org/D32502
Submitted by:   christos@
Sponsored by:   NVIDIA Networking

(cherry picked from commit 337c814316ef11437649cb43027468693555a5dd)

2 years agoservice(8): Fix typo in man page.
Hans Petter Selasky [Tue, 9 Nov 2021 21:09:57 +0000 (22:09 +0100)]
service(8): Fix typo in man page.

Differential revision:  https://reviews.freebsd.org/D32582
Submitted by:   christos@
Sponsored by:   NVIDIA Networking

(cherry picked from commit 66d795ec191b994f317b0ad812bb6e7943347c1f)
(cherry picked from commit 808108da324eee5d777134317c3492058d0fe964)

2 years agoecho(1): Replace errexit() with err(3)
Hans Petter Selasky [Tue, 9 Nov 2021 21:09:46 +0000 (22:09 +0100)]
echo(1): Replace errexit() with err(3)

Differential revision: https://reviews.freebsd.org/D32501
Submitted by: christos@
Sponsored by: NVIDIA Networking

(cherry picked from commit 4c537df51a16ce004b184010d306e550716f49ea)

2 years agoifconfig(8): Don't set network interface capabilities when there is no change.
Hans Petter Selasky [Tue, 9 Nov 2021 21:07:43 +0000 (22:07 +0100)]
ifconfig(8): Don't set network interface capabilities when there is no change.

A quick grep through the kernel code shows network drivers compute the
changed bits of network capabilities after a SIOCSIFCAP IOCTL(2) by
using the bitwise exclusive or operation. When the set capabilities
are equal to the already read capabilities, no action will be taken.

Let ifconfig(8) predict this case and skip the SIOCSIFCAP IOCTL(2)
system call.

Discussed with: kib@ (revert change in case of issues)
Sponsored by: NVIDIA Networking

(cherry picked from commit ad8f078f66e51212cdccd91fe8b22fb81235018e)

2 years agoRemove dead code.
Hans Petter Selasky [Mon, 20 Dec 2021 16:21:49 +0000 (17:21 +0100)]
Remove dead code.

The variable orig_resid is always set to zero right after the while loop
where it is cleared.

Reviewed by: gallatin@ and glebius@
Differential Revision: https://reviews.freebsd.org/D33589
Sponsored by: NVIDIA Networking

(cherry picked from commit f9978339d13c077975c8dce405c574ae88cbc148)

2 years agoCAM: List few missed opcodes.
Alexander Motin [Fri, 31 Dec 2021 16:46:58 +0000 (11:46 -0500)]
CAM: List few missed opcodes.

MFC after: 1 weeks

(cherry picked from commit 757089f01e3f5386d134443047fae363a8da9809)

2 years agoFix "set but not used" warnings in the mpr driver. This fixes a minor
Scott Long [Thu, 25 Nov 2021 03:28:29 +0000 (03:28 +0000)]
Fix "set but not used" warnings in the mpr driver.  This fixes a minor
bug in error handling.

(cherry picked from commit 61f17c5fd6cfaaf4fa9f543965997022488a29d5)

2 years agompr: Minor formatting changes to match mps.
Warner Losh [Tue, 16 Nov 2021 03:35:58 +0000 (20:35 -0700)]
mpr: Minor formatting changes to match mps.

Minor reformatting nits to make mprsas_scsiio_timeout match
mpssas_scsiio_timeout more closely. The differences aren't necessary and
are distracting when comparing the routines. No functional changes.

Sponsored by: Netflix

(cherry picked from commit 2bbaed4d7fcace17c619536f4119b89058ed4392)

2 years agomps(4): Fix unmatched devq release.
Warner Losh [Thu, 2 Dec 2021 20:53:44 +0000 (13:53 -0700)]
mps(4): Fix unmatched devq release.

Port 9781c28c6d63 and a8837c77efd0 to the mps driver.  Before this
change devq was frozen only if some command was sent to the target after
reset started, but release was called always.  This change freezes the
devq immediately, leaving mprsas_action_scsiio() check only to cover
race condition due to different lock devq use.

This should also avoid unnecessary requeue of the commands, creating
additional log noise and confusing some broken apps. It also avoids a
'busy' requeue of I/Os failing when we're doing recovery that takes
longer than the normal busy timeout. These I/Os failing can lead to
filesystems being unmounted in the force unmount case for I/O errors.

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

(cherry picked from commit a10253cffea84c0c980a36ba6776b00ed96c3e3b)

2 years agoFix "set but not used" warnings in the mps driver.
Scott Long [Thu, 25 Nov 2021 03:23:02 +0000 (03:23 +0000)]
Fix "set but not used" warnings in the mps driver.

(cherry picked from commit bcce9c5bedfafd6f0f76c022c8a1e45fa8e9fd0a)