Commit Graph

136617 Commits

Author SHA1 Message Date
Alexander V. Chernikov
c00e2f573b Fix build for non-vnet non-multipath kernels broken by
a0308e48ec.
2021-03-23 23:35:23 +00:00
Alexander V. Chernikov
a0308e48ec Fix panic when destroying interface with ECMP routes.
Reported by:	Zhenlei Huang <zlei.huang at gmail.com>
PR:		254496
MFC after:	immediately
2021-03-23 22:03:20 +00:00
Rick Macklem
82ee386c2a nfsv4 client: fix forced dismount when sleeping in the renew thread
During a recent NFSv4 testing event a test server caused a hang
where "umount -N" failed.  The renew thread was sleeping on "nfsv4lck"
and the "umount" was sleeping, waiting for the renew thread to
terminate.

This is the second of two patches that is hoped to fix the renew thread
so that it will terminate when "umount -N" is done on the mount.

This patch adds a 5second timeout on the msleep()s and checks for
the forced dismount flag so that the renew thread will
wake up and see the forced dismount flag.  Normally a wakeup()
will occur in less than 5seconds, but if a premature return from
msleep() does occur, it will simply loop around and msleep() again.
The patch also adds the "mp" argument to nfsv4_lock() so that it
will return when the forced dismount flag is set.

While here, replace the nfsmsleep() wrapper that was used for portability
with the actual msleep() call.

MFC after:	2 weeks
2021-03-23 13:04:37 -07:00
Kristof Provost
320bed3c00 dummynet: Move timekeeping information into dn_cfg
Just like with the packet counters move the timekeeping information into
dn_cfg. This reduces the global name space use for dummynet and will
make subsequent work to add vnet support and re-use in pf easier.

Reviewed by:	donner
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Different Revision:	https://reviews.freebsd.org/D29246
2021-03-23 18:01:58 +01:00
Kristof Provost
cd5671efc0 dummynet: Move packet counters into dn_cfg
Move the packets counters into the dn_cfg struct. This reduces the
global name space use for dummynet and will make future work for things
like vnet support and re-use in pf easier.

Reviewed by:	donner
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29245
2021-03-23 18:01:58 +01:00
Andrew Turner
df7549775c Replace the arm64 initial_fpcr with a macro
This value was never changed from its default value. Replace it with a
macro.

Sponsored by:	Innovate UK
2021-03-23 17:12:43 +00:00
Emmanuel Vadot
6bcba8dac9 arm64: Only check for freebsd,dts-version if we are booted in FDT mode.
Reported by:	  andrew
2021-03-23 16:37:25 +01:00
Emmanuel Vadot
63f344024a arm64: Check dtb version against the one we're expecting to find
Do for arm64 what was done for armv7 in e63faa9ba8
2021-03-23 15:24:53 +01:00
Mark Johnston
b93a796b06 pf: Handle unmapped mbufs when computing checksums
PR:		254419
Reviewed by:	gallatin, kp
Tested by:	Igor A. Valkov <viaprog@gmail.com>
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29378
2021-03-23 10:04:31 -04:00
Emmanuel Vadot
1240fba44d dts: Bump the freebsd branding version to 5.10 2021-03-23 15:02:21 +01:00
Emmanuel Vadot
6be3386466 Update DTS files from Linux v5.10 2021-03-23 15:00:35 +01:00
Andriy Gapon
3c6b59567f gpioc_detach: fix freeing of wrong pointers
MFC after:	1 week
2021-03-23 12:45:18 +02:00
Roger Pau Monné
4489124c04 xen/netback: do not attempt to connect in the Initialised state
Only attempt to fetch the configuration data and connect the shared
ring once the frontend has switched to the 'Connected' state. This
seems to be inline with what Linux netback does, and is required to
make newer versions of NetBSD netfront work, since NetBSD only
publishes the required configuration before switching to the Connected
state.

MFC after:	1 week
Sponsored by:	Citrix Systems R&D
2021-03-23 11:07:09 +01:00
Ka Ho Ng
be97fc8dce bhyve amd: Small cleanups in amdvi_dump_cmds
Bump offset with MOD_INC instead in amdvi_dump_cmds.

Reviewed by:	jhb
Approved by:	philip (mentor)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D28862
2021-03-23 16:12:41 +08:00
Mark Johnston
3ead60236f Generalize bus_space(9) and atomic(9) sanitizer interceptors
Make it easy to define interceptors for new sanitizer runtimes, rather
than assuming KCSAN.  Lay a bit of groundwork for KASAN and KMSAN.

When a sanitizer is compiled in, atomic(9) and bus_space(9) definitions
in atomic_san.h are used by default instead of the inline
implementations in the platform's atomic.h.  These definitions are
implemented in the sanitizer runtime, which includes
machine/{atomic,bus}.h with SAN_RUNTIME defined to pull in the actual
implementations.

No functional change intended.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2021-03-22 22:21:53 -04:00
Robert Watson
fb581531c1 Teach DTrace that unaligned accesses are OK on aarch64, not just x86.
MFC after:	3 days
Reviewed:	andrew
Differential Revision:	https://reviews.freebsd.org/D29369
2021-03-22 23:57:19 +00:00
Robert Watson
599fb1d198 Tune DTrace 'aframes' for the FBT and profile providers on arm64.
In both cases, too few frames were trimmed, leading to exception handling
or DTrace internals being exposed in stack traces exposed by D's stack()
primitive.

MFC after:	3 days
Reviewed by:	emaste, andrew
2021-03-22 23:49:41 +00:00
Ed Maste
0cff00ae68 retire obsolete mn(4) sync serial driver
Approved by:	phk
Relnotes:	yes
2021-03-22 15:06:51 -04:00
Ed Maste
453d8a7ee2 rsu: add KASSERT to document maximum mbuf size in rsu_tx_start
PR:		254479
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
2021-03-22 14:34:44 -04:00
Ed Maste
54399caa2f Correct "Fondation" typo (missing "u") 2021-03-22 13:06:31 -04:00
John Baldwin
90c74b2b60 cxgbei: Enter network epoch and set vnet around t4_push_pdus().
Reviewed by:	np
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29302
2021-03-22 10:05:02 -07:00
John Baldwin
017902fc5f cxgbe ddp: Use CPL_COOKIE_DDP* instead of DDP_BUF*_INVALIDATED.
This avoids mixing the use of two different enums which modern C
compilers warn about.

Reviewed by:	np
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29301
2021-03-22 10:05:02 -07:00
John Baldwin
8855ed61b5 cxgbei: Pass ULP submode directly to set_ulp_mode_iscsi().
Reviewed by:	np
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29300
2021-03-22 10:05:02 -07:00
John Baldwin
45eed2331e cxgbei: Move some function prototypes to cxgbei.h.
Reviewed by:	np
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29299
2021-03-22 10:05:02 -07:00
John Baldwin
52c11c3f74 cxgbei: Set vnet around tcp_drop() in do_rx_iscsi_ddp().
Reviewed by:	np
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29298
2021-03-22 10:05:02 -07:00
John Baldwin
71ba16a0a0 xnb: Don't pass SIOC{ADD,DEL}MULTI to ifmedia_ioctl().
ifmedia_ioctl() doesn't handle these requests, and this matches what
xn does.

Reviewed by:	royger
MFC after:	1 week
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D29296
2021-03-22 09:55:49 -07:00
Michael Tuexen
d995cc7e54 sctp: fix handling of RTO.initial of 1 ms
MFC after:	3 days
Reported by:	syzbot+5eb0e009147050056ce9@syzkaller.appspotmail.com
2021-03-22 16:44:18 +01:00
Michael Tuexen
40f41ece76 tcp: improve handling of SYN segments in SYN-SENT state
Ensure that the stack does not generate a DSACK block for user
data received on a SYN segment in SYN-SENT state.

Reviewed by:		rscheff
MFC after:		3 days
Differential Revision:	https://reviews.freebsd.org/D29376
Sponsored by:		Netflix, Inc.
2021-03-22 15:58:49 +01:00
Ed Maste
64a790d264 DTrace: remove sparc64 remnants in non-contrib code
Sponsored by:	The FreeBSD Foundation
2021-03-22 09:34:57 -04:00
Alex Richardson
c8c62548bf Don't add -Winline for WARNS=6
This warning is very rarely useful (inline is a hint and not mandatory).
This flag results in many warnings being printed when compiling C++
code that uses the standard library with GCC.

This flag was originally added in back in r94332 but the flag is a no-op
in Clang ("This diagnostic flag exists for GCC compatibility, and has no
effect in Clang"). Removing it should make the GCC build output slightly
more readable.

Reviewed By:	jrtc27, imp
Differential Revision: https://reviews.freebsd.org/D29235
2021-03-22 11:55:45 +00:00
Ka Ho Ng
74ada297e8 AMD-vi: Fix IOMMU device interrupts being overridden
Currently, AMD-vi PCI-e passthrough will lead to the following lines in
dmesg:
"kernel: CPU0: local APIC error 0x40
ivhd0: Error: completion failed tail:0x720, head:0x0."

After some tracing, the problem is due to the interaction with
amdvi_alloc_intr_resources() and pci_driver_added(). In ivrs_drv, the
identification of AMD-vi IVHD is done by walking over the ACPI IVRS
table and ivhdX device_ts are added under the acpi bus, while there are
no driver handling the corresponding IOMMU PCI function. In
amdvi_alloc_intr_resources(), the MSI intr are allocated with the ivhdX
device_t instead of the IOMMU PCI function device_t. bus_setup_intr() is
called on ivhdX. the IOMMU pci function device_t is only used for
pci_enable_msi(). Since bus_setup_intr() is not called on IOMMU pci
function, the IOMMU PCI function device_t's dinfo->cfg.msi is never
updated to reflect the supposed msi_data and msi_addr. So the msi_data
and msi_addr stay in the value 0. When pci_driver_added() tried to loop
over the children of a pci bus, and do pci_cfg_restore() on each of
them, msi_addr and msi_data with value 0 will be written to the MSI
capability of the IOMMU pci function, thus explaining the errors in
dmesg.

This change includes an amdiommu driver which currently does attaching,
detaching and providing DEVMETHODs for setting up and tearing down
interrupt. The purpose of the driver is to prevent pci_driver_added()
from calling pci_cfg_restore() on the IOMMU PCI function device_t.
The introduction of the amdiommu driver handles allocation of an IRQ
resource within the IOMMU PCI function, so that the dinfo->cfg.msi is
populated.

This has been tested on EPYC Rome 7282 with Radeon 5700XT GPU.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	jhb
Approved by:	philip (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D28984
2021-03-22 17:33:43 +08:00
Ka Ho Ng
ede14736fd ivrs_drv: Fix IVHDs with duplicated BaseAddress
Reviewed by:	jhb
Approved by:	philip (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D28945
2021-03-22 17:33:43 +08:00
Adrian Chadd
25bfa44860 Add device and ifnet logging methods, similar to device_printf / if_printf
* device_printf() is effectively a printf
* if_printf() is effectively a LOG_INFO

This allows subsystems to log device/netif stuff using different log levels,
rather than having to invent their own way to prefix unit/netif  names.

Differential Revision: https://reviews.freebsd.org/D29320
Reviewed by: imp
2021-03-22 00:02:34 +00:00
Kevin Bowling
2595d78f3d sys/ck.h: Add an include guard
Approved by:	cognet
MFC after:	1 week
Sponsored by:	BBOX.io
Differential Revision:	https://reviews.freebsd.org/D29357
2021-03-21 11:55:52 -07:00
Alexander V. Chernikov
2476178e6b Fix kassert panic when inserting multipath routes from multiple threads.
Reported by:	Marco Zec <zec at fer.hr>
MFC after:	immediately
2021-03-21 18:15:29 +00:00
Jason A. Harmening
d22883d715 Remove PCPU_INC
e4b8deb222 removed the last in-tree uses of PCPU_INC().  Its
potential benefit is also practically nonexistent.  Non-x86
platforms already implement it as PCPU_ADD(..., 1), and according
to [0] there are no recent x86 processors for which the 'inc'
instruction provides a performance benefit over the equivalent
memory-operand form of the 'add' instruction.  The only remaining
benefit of 'inc' is smaller instruction size, which in this case
is inconsequential given the limited number of per-CPU data consumers.

[0]: https://www.agner.org/optimize/instruction_tables.pdf

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D29308
2021-03-20 19:23:59 -07:00
Martin Matuska
f9693bef8d zfs: merge OpenZFS master-891568c99
Notable upstream pull request merges:
  #11652 Split dmu_zfetch() speculation and execution parts
  #11682 Fix zfs_get_data access to files with wrong generation
  #11735 Clean up RAIDZ/DRAID ereport code
  #11737 Initialize metaslab range trees in metaslab_init
  #11739 FreeBSD: make seqc asserts conditional on replay
  #11763 Allow setting bootfs property on pools with indirect vdevs
  #11767 FreeBSD: Fix memory leaks in kstats

Obtained from:	OpenZFS
MFC after:	2 weeks
2021-03-21 02:17:59 +01:00
Vincenzo Maffione
ee7ffaa2e6 netmap: fix issues in nm_os_extmem_create()
- Call vm_object_reference() before vm_map_lookup_done().
- Use vm_mmap_to_errno() to convert vm_map_* return values to errno.
- Fix memory leak of e->obj.

Reported by:	markj
Reviewed by:	markj
MFC after:	1 week
2021-03-20 17:15:50 +00:00
Ka Ho Ng
cf5d111240 virtio_pci_legacy: Allow memory space for configuration
For guests running under some kind of VMMs, configuration structure is
available in memory space but not I/O space.

Reported by:	Yuan Rui <number201724@me.com>
MFC after:	2 weeks
Reviewed by:	rpokala, bryanv, jhb
Approved by:	philip (mentor)
Differential Revision:	https://reviews.freebsd.org/D28818
2021-03-20 15:45:34 +08:00
Ka Ho Ng
faf9a4e914 virtio_pci_legacy: Use the table BAR and PBA BAR from MSI-X cap
The MSI-X resource shouldn't be assumed to be always on BAR1.
The Virtio v1.1 Spec did not specify that MSI-X table and PBA BAR has to
be BAR1 either.

Reported by:	Yuan Rui <number201724@me.com>
MFC after:	2 weeks
Reviewed by:	bryanv, jhb
Approved by:	philip (mentor)
Differential Revision:	https://reviews.freebsd.org/D28817
2021-03-20 15:45:34 +08:00
Alan Somers
9c5aac8f2e fusefs: fix a dead store in fuse_vnop_advlock
kevans actually caught this in the original review and I fixed it, but
then I committed an older copy of the branch.  Whoops.

Reported by:	kevans
MFC after:	13 days
MFC with:	929acdb19a
Differential Revision:	https://reviews.freebsd.org/D29031
2021-03-19 19:38:57 -06:00
Rick Macklem
5f742d3879 nfsv4 client: fix forced dismount when sleeping on nfsv4lck
During a recent NFSv4 testing event a test server caused a hang
where "umount -N" failed.  The renew thread was sleeping on "nfsv4lck"
and the "umount" was sleeping, waiting for the renew thread to
terminate.

This is the first of two patches that is hoped to fix the renew thread
so that it will terminate when "umount -N" is done on the mount.

nfsv4_lock() checks for forced dismount, but only after it wakes up
from msleep().  Without this patch, a wakeup() call was required.
This patch adds a 1second timeout on the msleep(), so that it will
wake up and see the forced dismount flag.  Normally a wakeup()
will occur in less than 1second, but if a premature return from
msleep() does occur, it will simply loop around and msleep() again.

While here, replace the nfsmsleep() wrapper that was used for portability
with the actual msleep() call and make the same change for nfsv4_getref().

MFC after:	2 weeks
2021-03-19 14:09:33 -07:00
Navdeep Parhar
3cc6f777be cxgbe(4): create a separate helper routine to write the global RSS key.
While here, make sure only the PF driver attempts to program the global
RSS key (with options RSS).  The VF driver doesn't have access to those
device registers.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2021-03-19 13:35:30 -07:00
Mitchell Horne
c02c04f113 x86: consolidate hw watchpoint logic into new file
This is a prerequisite to using these functions outside of ddb, but also
provides some cleanup and minor refactoring. This code is almost
entirely duplicated between the two implementations, the only
significant difference being the lack of dbreg synchronization on i386.

Cleanups are:
 - demote some internal functions to static
 - use the constant NDBREGS instead of a '4' literal
 - remove K&R definitions
 - some added comments

Reviewed by:	kib, jhb
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D29153
2021-03-19 16:51:52 -03:00
Navdeep Parhar
a1d803c162 cxgbe(4): make it safe to call setup_memwin repeatedly.
A repeat call will recreate the memory windows in the hardware and move
them to their last-known positions without repeating any of the software
initialization.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2021-03-19 12:37:44 -07:00
Navdeep Parhar
473f6163e3 cxgbe(4): use standard sysctl routines to deal with 16b values.
These routines to handle 8b and 16b types were added in r289773 5+ years
ago.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2021-03-19 10:56:24 -07:00
Mitchell Horne
da45b46266 armv8crypto: note derivation in armv8_crypto_wrap.c
This file inherits some boilerplate and structure from the analogous
file in aesni(4), aesni_wrap.c. Note the derivation and the copyright
holders of that file.

For example, the AES-XTS bits added in 4979620ece were ported from
aesni(4).

Requested by:	jmg
Reviewed by:	imp, gnn
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D29268
2021-03-19 10:53:49 -03:00
D Scott Phillips
f8a6ec2d57 bhyve: support relocating fbuf and passthru data BARs
We want to allow the UEFI firmware to enumerate and assign
addresses to PCI devices so we can boot from NVMe[1]. Address
assignment of PCI BARs is properly handled by the PCI emulation
code in general, but a few specific cases need additional support.
fbuf and passthru map additional objects into the guest physical
address space and so need to handle address updates. Here we add a
callback to emulated PCI devices to inform them of a BAR
configuration change. fbuf and passthru then watch for these BAR
changes and relocate the frame buffer memory segment and passthru
device mmio area respectively.

We also add new VM_MUNMAP_MEMSEG and VM_UNMAP_PPTDEV_MMIO ioctls
to vmm(4) to facilitate the unmapping needed for addres updates.

[1]: https://github.com/freebsd/uefi-edk2/pull/9/

Originally by:	scottph
MFC After:	1 week
Sponsored by:	Intel Corporation
Reviewed by:	grehan
Approved by:	philip (mentor)
Differential Revision:	https://reviews.freebsd.org/D24066
2021-03-19 11:04:36 +08:00
Alan Somers
929acdb19a fusefs: fix two bugs regarding fcntl file locks
1) F_SETLKW (blocking) operations would be sent to the FUSE server as
   F_SETLK (non-blocking).

2) Release operations, F_SETLK with lk_type = F_UNLCK, would simply
   return EINVAL.

PR:		253500
Reported by:	John Millikin <jmillikin@gmail.com>
MFC after:	2 weeks
2021-03-18 17:09:10 -06:00
Alex Richardson
6ceacebdf5 Unbreak MSG_CMSG_CLOEXEC
MSG_CMSG_CLOEXEC has not been working since 2015 (SVN r284380) because
_finstall expects O_CLOEXEC and not UF_EXCLOSE as the flags argument.
This was probably not noticed because we don't have a test for this flag
so this commit adds one. I found this problem because one of the
libwayland tests was failing.

Fixes:		ea31808c3b ("fd: move out actual fp installation to _finstall")
MFC after:	3 days
Reviewed By:	mjg, kib
Differential Revision: https://reviews.freebsd.org/D29328
2021-03-18 20:52:20 +00:00