Commit graph

256561 commits

Author SHA1 Message Date
Mark Johnston
e2c9871f6a arm64: Include NUMA locality info in the CPU topology
The scheduler uses this topology to try and preserve locality when
migrating threads between CPUs and when performing work stealing.
Ensure that on NUMA systems it will at least take the NUMA topology into
account.

Reviewed by:	mmel
Submitted by:	Klara, Inc.
Sponsored by:	Ampere Computing
Differential Revision:	https://reviews.freebsd.org/D28579

(cherry picked from commit 17d0f830dd)
2021-02-25 08:57:08 -05:00
Mark Johnston
0486986ad8 vm_kern: Avoid sign extension in the KVA_QUANTUM definition
Otherwise, on a powerpc64 NUMA system with hashed page tables, the
first-level superpage reservation size is large enough that the value of
the kernel KVA arena import quantum, KVA_NUMA_IMPORT_QUANTUM, is
negative and gets sign-extended when passed to vmem_set_import().  This
results in a boot-time hang on such platforms.

Reported by:	bdragon

(cherry picked from commit 23e875fd97)
2021-02-25 08:56:54 -05:00
Kirk McKusick
66308a13dd Fix bug 253158 - Panic: snapacct_ufs2: bad block - mksnap_ffs(8) crash
PR:           253158

(cherry picked from commit 8563de2f27)
(cherry picked from commit c31480a1f6)
2021-02-25 14:56:20 +02:00
Konstantin Belousov
ffa424772e Call softdep_prealloc() before taking ffs_lock_ea(), if unlock is committing
(cherry picked from commit 6f30ac9995)
2021-02-25 14:55:18 +02:00
Konstantin Belousov
e2827f8a13 ffs_close_ea: do not relock vnode under lock_ea
(cherry picked from commit 5e198e7646)
2021-02-25 14:55:18 +02:00
Konstantin Belousov
120c4f6405 ffs_vnops.c: style
(cherry picked from commit c6d68ca842)
2021-02-25 14:55:18 +02:00
Konstantin Belousov
94412c2d00 ffs: do not call softdep_prealloc() from UFS_BALLOC()
(cherry picked from commit 4983146279)
2021-02-25 14:55:18 +02:00
Konstantin Belousov
fd61ccfeb4 ffs_reallocblks: change the guard for softdep_prealloc() call to DOINGSUJ()
(cherry picked from commit cc9958bf22)
2021-02-25 14:55:18 +02:00
Neel Chauhan
d65b86dd93 netgraph/ng_nat: Add RFC 6598/Carrier Grade NAT support
This extends upon the RFC 6598 support to libalias/ipfw in r357092.

Reviewed By:	manpages (bcr), donner, adrian, kp
Differential Revision: https://reviews.freebsd.org/D23461

(cherry picked from commit 5fe433a6e4)
2021-02-25 11:21:03 +01:00
Lutz Donnerhacke
522a0b7d02 netgraph/ng_vlan_rotate: IEEE 802.1ad VLAN manipulation netgraph type
This node is part of an A10-NSP (L2-BSA) development.

Carrier networks tend to stack three or more tags for internal
purposes and therefore hiding the service tags deep inside of the
stack. When decomposing such an access network frame, the processing
order is typically reversed: First distinguish by service, than by
other means.

This new netgragh node allows to bring the relevant VLAN in front (to
the out-most position). This way other netgraph nodes (like ng_vlan)
can operate on this specific type.

Reviewed by:	manpages (gbe), brueffer (manpages), kp
Relnotes:	yes
Sponsored by:	IKS Service GmbH
Differential Revision: https://reviews.freebsd.org/D22076

(cherry picked from commit cfd6422a52)
2021-02-25 09:04:24 +01:00
Guangyuan Yang
12c2780888 pwrite(2): add a BUGS section
Add a BUGS section about using pwrite(2) when O_APPEND is set on the fd.

Submitted by:	Ka Ho Ng <khng300@gmail.com>
Reviewed by:	gbe, yuripv
Differential Revision:	https://reviews.freebsd.org/D28372

(cherry picked from commit 504e64af32)
2021-02-25 06:57:35 +00:00
Alexander Motin
1f3cff343b cxgb(4): Rework my commit 9dc7c250.
The previous implementation was reported to try to coalesce packets
in situations when it should not, that resulted in assertion later.
This implementation better checks the first packet of the chain for
the coallescing elligibility.

(cherry picked from commit d510bf133d)
2021-02-24 20:40:29 -05:00
Dimitry Andric
1c1460747e Fix possibly unitialized variables in __cxa_demangle_gnu3()
After 0ee0dbfb0d where I imported a more
recent libcxxrt snapshot, the variables 'rtn' and 'has_ret' could in
some cases be used while still uninitialized. Most obviously this would
lead to a jemalloc complaint about a bad free(), aborting the program.

Fix this by initializing a bunch variables in their declarations. This
change has also been sent upstream, with some additional changes to be
used in their testing framework.

PR:		253226

(cherry picked from commit d149877758)
2021-02-24 20:39:15 +01:00
Warner Losh
0b90164992 nvme: Make nvme_ctrlr_hw_reset static
nvme_ctrlr_hw_reset is no longer used outside of nvme_ctrlr.c, so
make it static. If we need to change this in the future we can.

(cherry picked from commit dd2516fc07)
2021-02-24 11:10:51 -07:00
Warner Losh
4f4f44f70f nvme: use NVME_GONE rather than hard-coded 0xffffffff
Make it clearer that the value 0xfffffff is being used to detect the device is
gone. We use it other places in the driver for other meanings.

(cherry picked from commit 9600aa31aa)
2021-02-24 11:10:45 -07:00
Warner Losh
b8b867a10f efibootmgr: Check for efi supported after parsing args
Move the check for efi variables being supported to after parsing the args. This
allows '-h' to produce both as a normal user as well as on all systems.

(cherry picked from commit 7fe2f504f8)
2021-02-24 11:01:41 -07:00
Jessica Clarke
44f483e0fa uefi: Add riscv to historical details
(cherry picked from commit 963cf6cb0f)
2021-02-24 11:00:13 -07:00
Warner Losh
1df1b4190b Restore missing word
"in" got dropped when I shuffled things around.

Noticed by: rpokala@
MFC After: 3 days

(cherry picked from commit f11e9f325a)
2021-02-24 11:00:03 -07:00
Warner Losh
f88db54fd8 uefi: add historical details
Add details about when armv6 and armv7 support was added.

(cherry picked from commit 8c09ecb2e2)
2021-02-24 10:59:44 -07:00
Warner Losh
78050d4966 Remove incorrect statement about EFI environment variables being unsupported.
Our uefi support has included environment variable support for several years
now. Remove the bogus blanket statement saying we don't support them.

MFC After: 3 days

(cherry picked from commit ab77cc9e7b)
2021-02-24 10:59:37 -07:00
Warner Losh
ef1f205608 uart: only use MSI on devices that advertise 1 MSI vector
This updates r311987/fb1d9b7f4113d which allowed any number of vectors to be
used. Since we're just attaching one instance, the meaning of more than one
vector is not clear and seems to cause problems. Fall back to old methods for
these cards.

PR: 235016
Submitted by: David Cross

(cherry picked from commit 955b6109bb)
2021-02-24 10:57:07 -07:00
Warner Losh
dd9b24be14 boot: remove gptboot.efifat, it never should have been
conical hat reduction: Make sure we also remove gotboot.efifat. It was created,
briefly, and shouldn't have existed in the first place. Kill it at the same
place we kill boot1.efifat.

Pointy Hat to: imp@

(cherry picked from commit 8cd1b2b1a7)
2021-02-24 10:56:06 -07:00
Mark Johnston
4664afc054 iflib: Fix detach of pseudo interfaces
In commit 38bfc6dee3 we added an IFDI_DETACH() call to
iflib_pseudo_deregister() since it looked like it was missing.  One is
present in the error-handling path of iflib_pseudo_register().  However,
the detach actually comes from the DEVICE_DETACH() method for the
above-mentioned device_t, so now we're calling IFDI_DETACH() twice when
destroying a pseudo interface.

Fix the problem by not calling IFDI_DETACH() from the device detach
routine.  This way we can ensure that iflib de-initialization always
happens in a consistent order.  It also ensures that you can't do silly
things like "devctl detach <pseudo ifnet>", which would previously
detach the driver without tearing down the corresponding ifnet.

PR:		253541
Reviewed by:	erj
Fixes:		38bfc6dee3
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D28774

(cherry picked from commit 0f9544d03e)
2021-02-24 10:20:55 -05:00
Mitchell Horne
4786c8582c arm64: extend struct db_reg to include watchpoint registers
The motivation is to provide access to these registers from userspace
via ptrace(2) requests PT_GETDBREGS and PT_SETDBREGS.

This change breaks the ABI of these particular requests, but is
justified by the fact that the intended consumers (debuggers) have not
been taught to use them yet. Making this change now enables active
upstream work on lldb to begin using this interface, and take advantage
of the hardware debugging registers available on the platform.

PR:		252860
Reported by:	Michał Górny (mgorny@gentoo.org)
Reviewed by:	andrew, markj (earlier version)
Tested by:	Michał Górny (mgorny@gentoo.org)
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f2583be110)
2021-02-24 10:58:43 -04:00
Mitchell Horne
9372df63ad arm64: handle watchpoint exceptions from EL0
This is a prerequisite to allowing the use of hardware watchpoints for
userspace debuggers.

This is also a slight departure from the x86 behaviour, since `si_addr`
returns the data address that triggered the watchpoint, not the
address of the instruction that was executed. Otherwise, there is no
straightforward way for the application to determine which watchpoint
was triggered. Make a note of this in the siginfo(3) man page.

Reviewed by:	jhb, markj (earlier version)
Tested by:	Michał Górny (mgorny@gentoo.org)
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit bd012c7159)
2021-02-24 10:58:09 -04:00
Mitchell Horne
8837e9c540 arm64: validate breakpoint registers
In particular, we want to disallow setting breakpoints on kernel
addresses from userspace. The control register fields are validated or
ignored as appropriate.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit de2b942280)
2021-02-24 10:57:04 -04:00
Kristof Provost
98e40918a6 pf tests: Explicitly ask for python3
If we install the scapy package (which we do list as a dependency) we
don't automatically install python (but we do have python3).

MFC after:      1 week
Sponsored by:   Rubicon Communications, LLC (“Netgate”’)

(cherry picked from commit 4a7d84058d)
2021-02-24 09:04:19 +01:00
Kristof Provost
720206821f pf: Assert that pfil_link() calls succeed
These should only fail if we use them incorrectly, so assert that they
succeed.

MFC after:      1 week
Sponsored by:   Rubicon Communications, LLC (“Netgate”’)

(cherry picked from commit c4e0f7aa1a)
2021-02-24 09:03:56 +01:00
Kristof Provost
ef160e5cb9 pf: Remove unused return value from (de)hook_pf()
These functions always return 0, which is good, because the code calling
them doesn't handle this error gracefully.

As the functions always succeed remove their return value, and the code
handling their errors (because it was never executed anyway).

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC (“Netgate”’)

(cherry picked from commit 8a439f324e)
2021-02-24 09:03:43 +01:00
Konstantin Belousov
2947fc2ccf lockf: ensure atomicity of lockf for open(O_CREAT|O_EXCL|O_EXLOCK)
(cherry picked from commit fa3bd463ce)
(cherry picked from commit 662283b108)
2021-02-24 09:50:27 +02:00
Konstantin Belousov
c6e46d0c6b fifo: minor comment and assert improvements.
(cherry picked from commit adf28ab456)
2021-02-24 09:48:37 +02:00
Konstantin Belousov
3f0157cb65 ffs_unlock: assert that IN_ENDOFF is not leaked past locked scope
(cherry picked from commit 26af9f72f7)
2021-02-24 09:48:20 +02:00
Konstantin Belousov
ea8aa5f3ed ffs softdep: Force processing of VI_OWEINACT vnodes when there is inode shortage
(cherry picked from commit 28703d2713)
2021-02-24 09:48:00 +02:00
Konstantin Belousov
b1ed1a5151 softdep_request_cleanup: wait for softdep_request_clean_flush() to pass
(cherry picked from commit 2011b44fa3)
2021-02-24 09:47:41 +02:00
Konstantin Belousov
6dde909bb5 ufs_inactive(): stop hiding ERELOOKUP from ffs_truncate(), return it.
(cherry picked from commit 013168db8c)
2021-02-24 09:47:18 +02:00
Konstantin Belousov
bbf612a1af Stop ignoring ERELOOKUP from VOP_INACTIVE()
(cherry picked from commit b59a8e63d6)
2021-02-24 09:46:59 +02:00
Konstantin Belousov
d72a156fb6 ufs vnops: brace softdep_prelink() with DOINGSUJ instead of DOINGSOFTDEP
(cherry picked from commit 6aed2435c8)
2021-02-24 09:46:41 +02:00
Konstantin Belousov
df1314860a ffs softdep: remove will_direnter argument of softdep_prelink()
(cherry picked from commit ede40b0675)
2021-02-24 09:46:18 +02:00
Konstantin Belousov
220cd6b045 ufs_direnter: directory truncation does not need special case for rename
(cherry picked from commit 06f2918ab8)
2021-02-24 09:45:57 +02:00
Konstantin Belousov
e1e108f351 ufs_rename: use VOP_VPUT_PAIR and rely on directory sync/truncation there
(cherry picked from commit 038fe6e089)
2021-02-24 09:45:39 +02:00
Konstantin Belousov
c918922cb9 ufs_direnter: move directory truncation to ffs_vput_pair().
(cherry picked from commit 74a3652f83)
2021-02-24 09:45:21 +02:00
Konstantin Belousov
b7d28c4e90 ffs_vput_pair(): try harder to recover from the vnode reclaim
(cherry picked from commit 30bfb2fa0f)
2021-02-24 09:45:01 +02:00
Konstantin Belousov
1de6eb52fd FFS: implement special VOP_VPUT_PAIR().
(cherry picked from commit f2c9d038bd)
2021-02-24 09:44:41 +02:00
Konstantin Belousov
d96c8375a6 nfsserver: use VOP_VPUT_PAIR().
(cherry picked from commit 4a21bcb241)
2021-02-24 09:44:24 +02:00
Konstantin Belousov
6c465e4719 ffs_snapshot: use VOP_VPUT_PAIR after VOP_CREATE.
(cherry picked from commit be44e98637)
2021-02-24 09:44:07 +02:00
Konstantin Belousov
b7a3af0b9f Use VOP_VPUT_PAIR() for eligible VFS syscalls.
(cherry picked from commit 3b2aa36024)
2021-02-24 09:43:40 +02:00
Konstantin Belousov
e45f7c8419 nullfs: provide special bypass for VOP_VPUT_PAIR
(cherry picked from commit e4aaf35ab5)
2021-02-24 09:43:22 +02:00
Konstantin Belousov
1f96e4cd1e Add VOP_VPUT_PAIR() with trivial default implementation.
(cherry picked from commit 49c117c193)
2021-02-24 09:43:03 +02:00
Konstantin Belousov
75f0d88bd3 vn_open(): If the vnode is reclaimed during open(2), do not return error.
(cherry picked from commit ee965dfa64)
2021-02-24 09:42:42 +02:00
Konstantin Belousov
ed3b4bbe35 ufs_direnter/SU: unconditionally UFS_UPDATE inode when extending directory
(cherry picked from commit 08c2dc2841)
2021-02-24 09:42:20 +02:00