Commit Graph

276017 Commits

Author SHA1 Message Date
Christos Margiolis
034667f9fa dtrace: add warning for /dev/dtrace/prototype
Let the programmer know that creating a device is not necessary.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D35381
2022-06-01 12:58:31 -04:00
Alexander Motin
42cf2ad0e4
Remove wrong assertion in log spacemap
It is typical, but not generally true that if log summary has more
blocks it must also have unflushed metaslabs.  Normally with metaslabs
flushed in order it works, but there are known exceptions, such as
device removal or metaslab being loaded during its flush attempt.

Before 600a02b884 if spa_flush_metaslabs() hit loading metaslab it
usually stopped (unless memlimit is also exceeded), but now it may
flush more metaslabs, just skipping that particular one.  This
increased chances of assertion to fire when the skipped metaslab is
flushed on next iteration if all other metaslabs in that summary
entry are already flushed out of order.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #13486 
Closes #13513
2022-06-01 09:54:35 -07:00
Christos Margiolis
2a72a1a41b dtrace: remove /dev/dtrace/fbt
It is unused.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D35377
2022-06-01 12:49:43 -04:00
Christos Margiolis
4544a795b2 dtrace: remove /dev/dtrace/profile
It is unused.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D35380
2022-06-01 12:42:35 -04:00
Christos Margiolis
16901dafdf dtrace: remove /dev/dtrace/dtmalloc
It is unused.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D35379
2022-06-01 12:39:23 -04:00
Ed Maste
49c937e704 getpagesize(3): add .Xr to sysconf(3)
POSIX deprecated getpagesize(3).  The portable way to obtain the page
size is `sysconf(_SC_PAGESIZE)`.

Reviewed by:	cperciva (earlier), imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35352
2022-06-01 12:16:26 -04:00
Alexander Motin
5acb4c862b hwpmc: Remove always zero pc_resync field.
MFC after:	1 month
2022-06-01 11:07:39 -04:00
Peter Holm
368852d672 stress2: Updated the exclude list and sorted it 2022-06-01 10:03:23 +02:00
Peter Holm
e14e0a1632 stress2: Added syzkaller reproducers 2022-06-01 10:02:08 +02:00
Peter Holm
4d0adee4e6 stress2: Added procctl(2) PROC_REAP_KILL regression tests 2022-06-01 09:58:28 +02:00
Kristof Provost
a7f20faa07 netinet6: fix panic on kldunload pfsync
Commit d6cd20cc5 ("netinet6: fix ndp proxying") caused us to panic when
unloading pfsync:

	Fatal trap 12: page fault while in kernel mode
	cpuid = 19; apic id = 38
	fault virtual address	= 0x20
	fault code		= supervisor read data, page not present
	instruction pointer	= 0x20:0xffffffff80dfe7f4
	stack pointer	        = 0x28:0xfffffe015d4f8ac0
	frame pointer	        = 0x28:0xfffffe015d4f8ae0
	code segment		= base 0x0, limit 0xfffff, type 0x1b
				= DPL 0, pres 1, long 1, def32 0, gran 1
	processor eflags	= interrupt enabled, resume, IOPL = 0
	current process		= 5477 (kldunload)
	trap number		= 12
	panic: page fault
	cpuid = 19
	time = 1654023100
	KDB: stack backtrace:
	db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe015d4f8880
	vpanic() at vpanic+0x17f/frame 0xfffffe015d4f88d0
	panic() at panic+0x43/frame 0xfffffe015d4f8930
	trap_fatal() at trap_fatal+0x387/frame 0xfffffe015d4f8990
	trap_pfault() at trap_pfault+0xab/frame 0xfffffe015d4f89f0
	calltrap() at calltrap+0x8/frame 0xfffffe015d4f89f0
	--- trap 0xc, rip = 0xffffffff80dfe7f4, rsp = 0xfffffe015d4f8ac0, rbp = 0xfffffe015d4f8ae0 ---
	in6_purge_proxy_ndp() at in6_purge_proxy_ndp+0x14/frame 0xfffffe015d4f8ae0
	if_purgeaddrs() at if_purgeaddrs+0x24/frame 0xfffffe015d4f8b90
	if_detach_internal() at if_detach_internal+0x1c2/frame 0xfffffe015d4f8bf0
	if_detach() at if_detach+0x71/frame 0xfffffe015d4f8c20
	pfsync_clone_destroy() at pfsync_clone_destroy+0x1dd/frame 0xfffffe015d4f8c70
	if_clone_destroyif() at if_clone_destroyif+0x239/frame 0xfffffe015d4f8cc0
	if_clone_detach() at if_clone_detach+0xc8/frame 0xfffffe015d4f8cf0
	vnet_pfsync_uninit() at vnet_pfsync_uninit+0xda/frame 0xfffffe015d4f8d10
	vnet_deregister_sysuninit() at vnet_deregister_sysuninit+0x85/frame 0xfffffe015d4f8d40
	linker_file_sysuninit() at linker_file_sysuninit+0x147/frame 0xfffffe015d4f8d70
	linker_file_unload() at linker_file_unload+0x269/frame 0xfffffe015d4f8db0
	kern_kldunload() at kern_kldunload+0x18d/frame 0xfffffe015d4f8e00
	amd64_syscall() at amd64_syscall+0x12e/frame 0xfffffe015d4f8f30
	fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe015d4f8f30
	--- syscall (444, FreeBSD ELF64, sys_kldunloadf), rip = 0x1601eab28cba, rsp = 0x1601e9c363f8, rbp = 0x1601e9c36c50 ---

This happens because ifp->if_afdata[AF_INET6] is NULL. Check for this,
just as we already do in a few other places.
See also c139b3c19b ("arp/nd: Cope with late calls to
iflladdr_event").

Reviewed by:	melifaro
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D35374
2022-06-01 09:26:15 +02:00
Kirk McKusick
bc218d8920 Two bug fixes to UFS/FFS superblock integrity checks when reading a superblock.
Two bugs have been reported with the UFS/FFS superblock integrity
checks that were added in commit 076002f24d.

The code checked that fs_sblockactualloc was properly set to the
location of the superblock. The fs_sblockactualloc field was an
addition to the superblock in commit dffce2150e on Jan 26 2018
and used a field that was zero in filesystems created before it
was added. The integrity check had to be expanded to accept the
fs_sblockactualloc field being zero so as not to reject filesystems
created before Jan 26 2018.

The integrity check set an upper bound on the value of fs_maxcontig
based on the maximum transfer size supported by the kernel. It
required that fs->fs_maxcontig <= maxphys / fs->fs_bsize. The kernel
variable maxphys defines the maximum transfer size permitted by the
controllers and/or buffering. The fs_maxcontig parameter controls the
maximum number of blocks that the filesystem will read or write in
a single transfer. It is calculated when the filesystem is created
as maxphys / fs_bsize. The bug appeared in the loader because it
uses a maxphys of 128K even when running on a system that supports
larger values. If the filesystem was built on a system that supports
a larger maxphys (1M is typical) it will have configured fs_maxcontig
for that larger system so would fail the test when run with the smaller
maxphys used by the loader. So we bound the upper allowable limit
for fs_maxconfig to be able to at least work with a 1M maxphys on the
smallest block size filesystem: 1M / 4096 == 256. We then use the
limit for fs_maxcontig as fs_maxcontig <= MAX(256, maxphys / fs_bsize).
There is no harm in allowing the mounting of filesystems that make larger
than maxphys I/O requests because those (mostly 32-bit machines) can
(very slowly) handle I/O requests that exceed maxphys.

Thanks to everyone who helped sort out the problems and the fixes.

Reported by:  Cy Schubert, David Wolfskill
Diagnosis by: Mark Johnston, John Baldwin
Reviewed by:  Warner Losh
Tested by:    Cy Schubert, David Wolfskill
MFC after:    1 month (with 076002f24d)
Differential Revision: https://reviews.freebsd.org/D35219
2022-05-31 19:58:37 -07:00
Rich Ercolani
bc8192cd5b
Corrected parameters for zstd early abort
That'll teach me to try and recall them from the definition.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #13519
2022-05-31 15:41:33 -07:00
Allan Jude
2310dba9eb
Fix typo in zil_commit() comment block
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Allan Jude <allan@klarasystems.com>
Closes #13518
2022-05-31 15:37:46 -07:00
Brian Behlendorf
a70e613070
Linux 5.18 compat: META
Update the META file to reflect compatibility with the 5.18 kernel.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #13527
2022-05-31 14:38:00 -07:00
Arseny Smalyuk
d18b4bec98 netinet6: Fix mbuf leak in NDP
Mbufs leak when manually removing incomplete NDP records with pending packet via ndp -d.
It happens because lltable_drop_entry_queue() rely on `la_numheld`
counter when dropping NDP entries (lles). It turned out NDP code never
increased `la_numheld`, so the actual free never happened.

Fix the issue by introducing unified lltable_append_entry_queue(),
common for both ARP and NDP code, properly addressing packet queue
maintenance.

Reviewed By: melifaro
Differential Revision: https://reviews.freebsd.org/D35365
MFC after:	2 weeks
2022-05-31 21:06:14 +00:00
Mateusz Guzik
6c92016aa6 pf: fix a race against kif destruction in pf_test{,6}
ifp kif was dereferenced prior to taking the lock and
could have been nullified later.

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:
2022-05-31 20:11:39 +00:00
Alfredo Dal'Ava Junior
3cb9f1976c nfs: skip bootpc when vfs.root.mountfrom is other than nfs
If "vfs.root.mountfrom" is set and the value is something other
than "nfs:*", it means the user doesn't want to mount root via nfs,
there's no reason to continue with bootpc

This fixes the powerpcspe kernel (MPC85XXSPE) that's compiled with
BOOTP_NFSROOT by default and gets stuck on bootpc/dhcp request loop
when no DHCP server is available on the network, even when user
specifies a local disk via "vfs.root.mountfrom" kernel parameter.

Reviewed by:	imp
MFC after:	2 weeks
Sponsored by:	Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D35098
2022-05-31 16:07:27 -03:00
Brian Behlendorf
91350681b8 Linux 5.19 compat: zap_flags_t conflict
As of the Linux 5.19 kernel an identically named zap_flags_t typedef
is declared in the include/linux/mm_types.h linux header.  Sadly,
the inclusion of this header cannot be easily avoided.  To resolve
the conflict a #define is used to remap the name in the OpenZFS
sources when building against the Linux kernel.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #13515
2022-05-31 12:04:39 -07:00
Brian Behlendorf
d41e864181 Linux 5.19 compat: bdev_start_io_acct() / bdev_end_io_acct()
As of the Linux 5.19 kernel the disk_*_io_acct() helper functions
have been replaced by the bdev_*_io_acct() functions.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #13515
2022-05-31 12:04:35 -07:00
Brian Behlendorf
c2c2e7bb8b Linux 5.19 compat: aops->read_folio()
As of the Linux 5.19 kernel the readpage() address space operation
has been replaced by read_folio().

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #13515
2022-05-31 12:04:31 -07:00
Brian Behlendorf
a12a5cb5b8 Linux 5.19 compat: blkdev_issue_secure_erase()
Linux 5.19 commit torvalds/linux@44abff2c0 splits the secure
erase functionality from the blkdev_issue_discard() function.
The blkdev_issue_secure_erase() must now be issued to issue
a secure erase.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #13515
2022-05-31 12:04:26 -07:00
Brian Behlendorf
e2c31f2bc7 Linux 5.19 compat: bdev_max_secure_erase_sectors()
Linux 5.19 commit torvalds/linux@44abff2c0 removed the
blk_queue_secure_erase() helper function.  The preferred
interface is to now use the bdev_max_secure_erase_sectors()
function to check for discard support.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #13515
2022-05-31 12:04:22 -07:00
Brian Behlendorf
5e4aedaca7 Linux 5.19 compat: bdev_max_discard_sectors()
Linux 5.19 commit torvalds/linux@70200574cc removed the
blk_queue_discard() helper function.  The preferred interface
is to now use the bdev_max_discard_sectors() function to check
for discard support.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #13515
2022-05-31 12:04:17 -07:00
Brian Behlendorf
5f264996f4 Linux 5.18 compat: bio_alloc()
As for the Linux 5.18 kernel bio_alloc() expects a block_device struct
as an argument.  This removes the need for the bio_set_dev() compatibility
code for 5.18 and newer kernels.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #13515
2022-05-31 12:04:03 -07:00
Rick Macklem
9792c7d3eb nfscl: Enable support for the Lookup+Open RPC
Commits 3ad1e1c1ce and 57014f21e7 added a Lookup+Open
RPC for NFSv4.1/4.2, which can reduce the RPC count by
10-20% for some loads.  This has now received a fair amount
of testing, so I think it is ok to enable it.

Note that the Lookup+Open RPC is only used when the
"oneopenown" mount option is specified.  As such, this
change won't affect most NFSv4.1/4.2 mounts.
2022-05-31 11:59:39 -07:00
Dimitry Andric
4b1174e27a llvm MIPS target: add missed source file
Otherwise, linking llvm binaries with this target enabled (which is not
the default) will fail with a number of undefined symbol errors:

  ld: error: undefined symbol: llvm::initializeMipsMulMulBugFixPass(llvm::PassRegistry&)
  ld: error: undefined symbol: llvm::createMipsMulMulBugPass()

MFC after:	3 days
2022-05-31 17:41:51 +02:00
Eric van Gyzen
9f6a619a7d mandoc: workaround lack of macro parsing in list -width
GNU tools parse macros in the -width argument of lists.  mandoc does not,
so it calculates an excessive width.  This often squeezes the text into
a very narrow column, especially in nested lists.

Implement the easy workaround suggested in the TODO list.  When there is
only one macro, at the beginning of the -width argument, this fixes the
formatting as well as a complete solution.

Reviewed by:	bapt
Relnotes:	yes
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D35245
2022-05-31 10:06:46 -05:00
Mark Johnston
89e58b955c rc: Fix quoting in the zpoolreguid script
Reported by:	0mp
Fixes:		227caacc91 ("rc: Add a zpoolreguid rc.d script")
Sponsored by:	The FreeBSD Foundation
2022-05-31 10:51:28 -04:00
Dmitry Chagin
539fadb493 linux(4): Return EINVAL when the clockid has invalid bits are set
Linux forbids PERTHREAD bit set for CLOCKFD clock.

MFC after:		2 weeks
2022-05-31 11:46:15 +03:00
Dmitry Chagin
452f4636c3 linux(4): Return ENOTSUP for unsupported clockid
It's much better from the user perspective to get a sane error code.

MFC after:		2 weeks
2022-05-31 11:43:00 +03:00
Dmitry Chagin
7e2a451119 linprocfs: Add /proc/vm/max_map_count
On Linux this limits the number of maps per mm struct.
We don't limit mappings, return a suitable large value.

Reviewed by:		emaste
Differential revision:	https://reviews.freebsd.org/D35351
MFC after:		2 weeks
2022-05-31 11:42:06 +03:00
Alexander Motin
037dd0a967 libpmc: Fix INVERT flag mapping for both Intel and AMD.
Looks like somebody's trivial copy/paste bug.

MFC after:	1 month
2022-05-31 00:04:43 -04:00
Gleb Smirnoff
f083739350 soo_aio_*: use socket buffer mutexes in struct socket directly
A miss from commit 4328318445.
2022-05-30 20:46:38 -07:00
Alexander Motin
fe109d3113 hwpmc: Add basic Intel Alderlake CPUs support.
The PMC subsystem is not designed for non-uniform CPU capabilities
(P/E-cores are different), but at least several working architectural
events like cpu_clk_unhalted.thread_p should be better than nothing.

MFC after:	1 month
2022-05-30 23:17:37 -04:00
Alexander Motin
ae57fbc7ec hwpmc: Update Intel's programmable counters restrictions.
Primarily remove unneeded restrictions from later CPUs.

MFC after:	1 month
2022-05-30 22:54:00 -04:00
Kyle Evans
5b7adeb184 zdiff: avoid non-conformant features
`setvar` is a non-conformant feature that looks slightly neater but is
not portable to other /bin/sh implementations.  Making the script
portable is straightforward, so let's do it.

Tests are added to make sure that I didn't break anything major in the
process.

Reviewed by:	bapt (previous version), jilles
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35275
2022-05-30 19:25:16 -05:00
Alexander Motin
73b7b181e6 libpmc: Disable hardcoding of Intel fixed counters.
Intel json's now have pretty reasonable fixed counters representation
via event=0 and umask.  Hardcoded values create more confusion than fix.

MFC after:	1 month
2022-05-30 20:05:15 -04:00
Alexander Motin
c1e813d123 hwpmc: Correct selection of Intel fixed counters.
Intel json's use event=0 to specify fixed counter number via umask.
Alternatively fixed counters have equivalent programmable event/umask.

MFC after:	1 month
2022-05-30 20:05:15 -04:00
Mitchell Horne
acdfbc6cbe irdma: fix LINT-NOIP/NOINET/NOINET6 builds
This module depends on the presence of both INET and INET6 options in
order to compile.

Reviewed by:	erj
Fixes:	cdcd52d41e ("irdma: Add RDMA driver for Intel(R) Ethernet...")
Differential Revision:	https://reviews.freebsd.org/D35343
2022-05-30 17:47:55 -03:00
Hans Petter Selasky
c4a4155053 ibcore: Fix missing ib_cm_destroy_id() in ib_cm_insert_listen()
The algorithm pre-allocates a cm_id since allocation cannot be done while
holding the cm.lock spinlock, however it doesn't free it on one error
path, leading to a memory leak.

Linux commit:
c14dfddbd869bf0c2bafb7ef260c41d9cebbcfec

PR:		264248
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-05-30 20:22:18 +02:00
Hans Petter Selasky
f29c9901a4 mlx4core: Fix a memory leak when deleting slave's resources
mlx4_delete_all_resources_for_slave() in the resource tracker should free
all memory allocated for a slave. While releasing memory of fs_rule,
it misses releasing memory of fs_rule->mirr_mbox.

Linux commit:
461d5f1b59490ce0096dfda45e10038c122a7892

PR:		264249
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-05-30 20:22:18 +02:00
Alexander Motin
62ff619dcc libpmc: jevents: Sync with the latest Linux kernel.
commit f4df0dbbe62ee8e4405a57b27ccd54393971c773
Date:   Wed May 25 22:04:10 2022 +0800

MFC after:	1 month
2022-05-30 14:10:21 -04:00
Alexander Motin
51f329660f Revert "libpmc: jevents: Partial style(9) pass"
This file is shared with Linux.  Having local style patches does not
help with updating it.

This reverts commit 3ea691c261.
2022-05-30 14:10:21 -04:00
Dmitry Chagin
4a6c2d075d linux(4): Properly restore the thread signal mask after signal delivery on i386
Replace sigframe sf_extramask by native sigset_t and use it to
store/restore the thread signal mask without conversion to/from
Linux signal mask.

Pointy hat to:		dchagin
MFC after:		2 weeks
2022-05-30 20:03:49 +03:00
Dmitry Chagin
2722e515ac linux(4): Prefer sizeof(object) vs sizeof(type)
MFC after:		2 weeks
2022-05-30 20:03:14 +03:00
Dmitry Chagin
5573143777 linux(4): Error is not a bool, use proper comparison
MFC afer:		2 weeks
2022-05-30 20:00:30 +03:00
Dmitry Chagin
5e872c279a linux(4): Use the copyin_sigset() in the remaining places
MFC after:		2 weeks
2022-05-30 19:59:45 +03:00
Dmitry Chagin
7a7cee5585 linux(4): Refactor SIGPWR mapping
Map Linux RT signals to the native RT signals starting from SIGRTMIN,
and Linux SIGPWR signal map to after the last RT signal.

MFC after:		2 weeks
2022-05-30 19:55:49 +03:00
Dmitry Chagin
669516a1a1 linux(4): Fix the type of a constant in the signal mask macro
Since l_sigset_t is 64-bit unsigned on all Linuxulators, fix the type
of a constant in the signal mask manipulation macro.
The suffix L indicates type long which is 32-bit on i386, therefore,
bitwise operations between a 32-bit constant and 64-bit signal mask
lead to the wrong result.

Pointy hat to:		dchagin
MFC after:		2 weeks
2022-05-30 19:53:52 +03:00