Commit Graph

271542 Commits

Author SHA1 Message Date
Vladimir Kondratyev
db562aeff7 LinuxKPI: Implement clflush_cache_range()
Required by drm-kmod 5.7

MFC after:	1 week
Reviewed by:	hselasky, manu
Differential Revision:	https://reviews.freebsd.org/D33289
2022-01-10 22:49:36 +03:00
Vladimir Kondratyev
9a79e08ae7 LinuxKPI: Add clflush argument type conversion wrapper
to reduce amount of source patching in drm-kmod.

MFC after:	1 week
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D33288
2022-01-10 22:49:36 +03:00
Vladimir Kondratyev
dbc920bd9a LinuxKPI: Implement interval_tree
Required by drm-kmod

MFC after:	1 week
Reviewed by:	hselasky, manu
Differential Revision: https://reviews.freebsd.org/D32869
2022-01-10 22:49:36 +03:00
Vladimir Kondratyev
dd52763387 LinuxKPI: Import some linux/rbtree.h functions from OpenBSD
Required by drm-kmod

Obtained from:	OpenBSD
MFC after:	1 week
2022-01-10 22:49:36 +03:00
Ruslan Makhmatkhanov
312ba38a9b LinuxKPI: 802.11 correctly spell queues
PR:		261078
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2022-01-10 18:08:17 +00:00
Mitchell Horne
d72e944812 riscv: gdb(4) support
Add the MD portion required for the gdb stub.

Reviewed by:	jhb (earlier version)
Discussed with:	jrtc27
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D33734
2022-01-10 13:40:12 -04:00
Warner Losh
479ef15dfd libc: Teak comment about mips
Remove mips from the list of machines using TLS variant I and reformat
paragraph. No functional change intended.

Sponsored by:		Netflix
2022-01-10 10:15:15 -07:00
Edward Tomasz Napierala
1866c766d2 linux: Improve debugging by recognizing TIOCGPTPEER
Sponsored By:	EPSRC
2022-01-10 15:36:11 +00:00
Konstantin Belousov
c0ba4c2ee2 script(1): work around slow reading child
If child is slow reading from its input, or even completely stops doing
the read, script(1) hangs in write(2) to the pts master waiting until
there is a space in the terminal discipline buffer.  This also stops
handling any outer io, as well as child output.

Work around the problem by making pts master fd non-blocking, and be
prepared for short writes to it.  The data to be written to master is
buffered in the tailq which is processed when select(2) detects that
master is ready for write.

PR:	260938
Reported by:	наб <nabijaczleweli@nabijaczleweli.xyz>
See also:	https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1003095
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33789
2022-01-10 17:34:51 +02:00
Eugene Grosbein
ba94a95402 gpart(8): add minimal reference to glabel(8) to manual page
MFC after:	1 week
2022-01-10 22:07:23 +07:00
Alexander Motin
618d49f5ca Revert "iflib: Relax timer period from 0.5 to 0.5-0.75s."
I've noticed relations between iflib_timer() vs ixl_admin_timer().
Both scheduled at the same 2Hz rate, but the second is rescheduling
the first each time, so if the first get any slower, it won't be
executed at all.  Revert this until deeper investigation.

This reverts commit 90bc1cf657.
2022-01-10 09:40:38 -05:00
Jessica Clarke
e74c7ffcb1 hwpmc: Fix amd/arm64/armv7/uncore sampling overflow race
If a counter more than overflows just as we read it on switch out then,
if using sampling mode, we will negate this small value to give a huge
reload count, and if we later switch back in that context we will
validate that value against pm_reloadcount and panic an INVARIANTS
kernel with:

  panic: [pmc,1470] pmcval outside of expected range cpu=2 ri=16 pmcval=fffff292 pm_reloadcount=10000

or similar. Presumably in a non-INVARIANTS kernel we will instead just
use the provided value as the reload count, which would lead to the
overflow not happing for a very long time (e.g. 78 minutes for a 48-bit
counter incrementing at an averate rate of 1GHz).

Instead, clamp the reload count to 0 (which corresponds precisely to the
value we would compute if it had just overflowed and no more), which
will result in hwpmc using the full original reload count again. This is
the approach used by core for Intel (for both fixed and programmable
counters).

As part of this, armv7 and arm64 are made conceptually simpler; rather
than skipping modifying the overflow count for sampling mode counters so
it's always kept as ~0, those special cases are removed so it's always
applicable and the concatentation of it and the hardware counter can
always be viewed as a 64-bit counter, which also makes them look more
like other architectures.

Whilst here, fix an instance of UB (shifting a 1 into the sign bit) for
amd in its sign-extension code.

Reviewed by:	andrew, mhorne, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D33654
2022-01-10 14:30:05 +00:00
Andrew Turner
78c347d9f3 Fix a typo in an arm64 comment
This was pointed out by markj in the review, but I missed it and forgot
to fix before pushing.

Reported by:	markj
Sponsored by:	The FreeBSD Foundation
2022-01-10 14:08:15 +00:00
Wei Hu
ed65c80a34 Mana: report OS info to PF driver
The PF driver might use the OS info for statistical purposes.

MFC after:	2 weeks
Sponsored by:	Microsoft
2022-01-10 13:32:30 +00:00
Andrew Turner
77402d2834 Move instructions into the arm64 exception vectors
We have 32 instructions in each exception vector on arm64. Previously
only one was used to branch to the handler function. We can split the
start of these functions and move some of the instructions into the
vectors.

Reviewed by:	kib, markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33751
2022-01-10 10:51:16 +00:00
Doug Moore
ae13829ddc vm_addr_ok: add power2 invariant check
With INVARIANTS defined, have vm_addr_align_ok and vm_addr_bound_ok
panic when passed an alignment/boundary parameter that is not a power
of two.

Reviewed by:	alc
Suggested by:	kib, se
Differential Revision:	https://reviews.freebsd.org/D33725
2022-01-10 01:17:25 -06:00
Alexander Motin
90bc1cf657 iflib: Relax timer period from 0.5 to 0.5-0.75s.
While there switch it from hardclock ticks to milliseconds.

MFC after:	2 weeks
2022-01-09 20:32:50 -05:00
Alexander Motin
cb1f5d1136 Reduce minimum idle hardclock rate from 2Hz to 1Hz.
On idle 80-thread system it allows to improve package-level idle state
residency and so power consumption by several percent.

MFC after:	2 weeks
2022-01-09 19:25:56 -05:00
Kirk McKusick
7ef56fb049 Avoid unnecessary setting of UFS flag requesting fsck(8) be run.
When the kernel is requested to mount a filesystem with a bad superblock
check hash, it would set the flag in the superblock requesting that the
fsck(8) program be run. The flag is only written to disk as part of a
superblock update. Since the superblock always has its check hash updated
when it is written to disk, the problem for which the flag has been set
will no longer exist. Hence, it is counter-productive to set the flag
as it will just cause an unnecessary run of fsck if it ever gets written.

Sponsored by: Netflix
2022-01-09 16:18:28 -08:00
Robert Wing
174d86a01b tws: fix "set but not used" in the tws driver
With __diagused, these warnings were still emitted since INVARIANTS was
defined but TWS_DEBUG was not.

Fixes:  a21f086a33 ("Fix "set but not used" in the tws driver")
Differential Revision:	https://reviews.freebsd.org/D33784
2022-01-09 14:28:08 -09:00
Alexander Motin
3455c738ac nfsd: Reduce callouts rate.
Before this callouts were scheduled twice a seconds even if nfsd was
never used.  This reduces the rate to ~1Hz and only after nfsd first
started.

MFC after:	2 weeks
2022-01-09 13:14:23 -05:00
Bjoern A. Zeeb
51b461b3db LinuxKPI: 802.11 update compat code for driver updates
Add more (dummy in case of HE) defines, structs, functions and another
mac80211 function pointer needed to update and support recent drivers.

MFC after:	3 days
2022-01-09 18:08:47 +00:00
Warner Losh
e0ab0ff104 devd: correct wifi regexp
Correct the wifi regexp to include iwlwifi and remove wi driver that was
has been retired.

Sponsored by:		Netflix
2022-01-09 10:16:31 -07:00
Warner Losh
926e825ef8 devd: remove the scsi regexp
We don't really use the scsi regexp for anything. The rescan was a
workaround that was fixed a long time ago and has been disabled for
ages. And the regexp was incomplete.

Sponsored by:		Netflix
2022-01-09 10:13:58 -07:00
Warner Losh
85056a56f3 cam: Include more statuses as errors for CAM_IO_STATS
Tag more status return values as an error for the
I/O. CAM_SCSI_STATUS_ERROR is returned for medium errors, for example,
but the counts weren't increased. The added errors all indicate a
problem with the device request.

Sponsored by:		Netflix
PR:			260257
Feedback from:		ken
Reviewed by:		asomers
Differential Revision:	https://reviews.freebsd.org/D33783
2022-01-09 10:13:05 -07:00
Bjoern A. Zeeb
2fb0569f1f LinuxKPI: bitfields add more *replace_bits()
Add or extend the already existing *_replace_bits() implementations
using macros as we do for the other parts in the file for
le<n>p_replace_bits(), u<n>p_replace_bits(), and _u<n>_replace_bits().

MFC after:	3 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D33799
2022-01-09 14:39:19 +00:00
Bjoern A. Zeeb
deb9bfbd5b LinuxKPI: add hex2bin()
Add a hex2bin() implementation needed by a driver's debugfs code.

MFC after:	3 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D33798
2022-01-09 14:36:28 +00:00
Edward Tomasz Napierala
595532a766 linux: More man page tweaks
Mention debootstrap(8) and improve the wording.

Reviewed By:	debdrup, emaste, Pau Amma
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D33772
2022-01-09 10:05:05 +00:00
Konstantin Belousov
6d06bc688e libc clnt_com_create: relock rpcsoc_lock earlier when port is obtained from portmapper
Otherwise on mapper failure we goto error handler which expect
rpscoc_lock owned, but we do not.

PR:	261051
Reported by:	RyanCai <ryancaicse@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-01-09 07:36:06 +02:00
Bjoern A. Zeeb
e200809190 LinuxKPI / iwlwifi: fix spelling of constants
Fix the spelling of IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_*
(was "NOMIMAL").  The original version came from iwlwifi
in iwlwifi-next.  Other drivers (from wireless-testing) already
use the correct spelling and need this change in LinuxKPI.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-01-09 02:21:05 +00:00
Robert Wing
eb18708ec8 syncache: accept packet with no SA when TCP_MD5SIG is set
When TCP_MD5SIG is set on a socket, all packets are dropped that don't
contain an MD5 signature. Relax this behavior to accept a non-signed
packet when a security association doesn't exist with the peer.

This is useful when a listen socket set with TCP_MD5SIG wants to handle
connections protected with and without MD5 signatures.

Reviewed by:	bz (previous version)
Sponsored by:   nepustil.net
Sponsored by:   Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D33227
2022-01-08 16:32:14 -09:00
Robert Wing
91d388119a tcpmd5: return ENOENT when security association not found
Return ENOENT from tcp_ipsec_input() when a security association is not
found. This allows callers of TCP_MD5_INPUT() to differentiate between a
security association not found and receiving a bad signature.

Also return ENOENT from tcp_ipsec_output() for consistency.

Reviewed by:	ae
Sponsored by:   nepustil.net
Sponsored by:   Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D33226
2022-01-08 16:31:17 -09:00
Bjoern A. Zeeb
086be6a809 LinuxKPI: 802.11 handle IEEE80211_CONF_IDLE better
We never initialized hw->conf.flags for IEEE80211_CONF_IDLE but
on set_channel we would clear it and announce a change.
This lead to a problem that drivers may do some work every time
which was not needed and may lead to unexpected behaviour (for no
better driver code).

Properly initialize conf.flags with IEEE80211_CONF_IDLE.
Factor out the toggling into a function and clear IDLE while
sw scanning and when associated and set again when scan ends
or we are bouncing out of assoc.

MFC after:	3 days
2022-01-09 00:59:50 +00:00
Bjoern A. Zeeb
4ddc0079ea LinuxKPI: ip.h add #include
Also include netinet/in.h so that in_addr in known for ip.h.
Found by compiling a new piece of code which complained.

MFC after:	3 days
2022-01-09 00:57:13 +00:00
Konstantin Belousov
fcbb1441d0 ldconfig: remove two symbols
_PATH_LD32_HINTS is unused because it is a.out remnant.
_PATH_ELF32_HINTS is provided by rtld_paths.h already.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-01-08 12:45:46 +02:00
Peter Holm
bf48a958ad stress2: Aded two msdos FS fuzzer tests 2022-01-08 07:11:10 +01:00
Cy Schubert
08ab34a06a ipfilter: Restore ipfsync
ipfsync is a WIP sync daemon designed to be used in a failover scenario.
It was removed by 5ee61c7daa. This commit
restores its three files. ipfsync is in my work queue.

MFC after:	10 days
X-MFC with:	5ee61c7daa
2022-01-07 21:46:53 -08:00
Konstantin Belousov
15964f1cb3 amd64 pmap: preset A and M bits for pmap_qenter() and pmap_kenter() mappings
This removes one or two atomic update of the pte on access. Also it
makes the pte constant during its lifecycle.

Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33778
2022-01-08 06:34:18 +02:00
Konstantin Belousov
720a892ac6 amd64 pmap: simplify vtopte() and vtopde()
Pre-calculate masks and page table/page directory bases, for LA48 and
LA57 cases, trading a conditional for the memory accesses.

This shaves 672 bytes of .text, by the cost of 32 .data bytes.  Note
that eliminated code contained one conditional, and several costly
movabs instructions, which are traded by two memory fetches per
vtop{t,d}e() inlines.

Reviewed by:	markj
Discussed with:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33776
2022-01-08 06:34:18 +02:00
Konstantin Belousov
aaaa4fb54e msdosfs: use mntfs vnode for pm_devvp
to prevent races with devfs VCHR vnode reclamation, same as it was
done for UFS.

Reported by:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33721
2022-01-08 06:21:58 +02:00
Konstantin Belousov
41e85eeab9 msdosfs: on integrity error, fire a task to remount filesystem to ro
In collaboration with:	pho
Reviewed by:	markj, mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33721
2022-01-08 06:20:48 +02:00
Konstantin Belousov
b2e4b63584 msdosfs: add msdosfs_integrity_error()
A function to remount the filesystem from rw to ro on integrity error.
The work is performed in taskqueue to allow the call to be done from
almost arbitrary context where erronous state was detected.

Tested by:	pho
Reviewed by:	markj, mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33721
2022-01-08 06:20:48 +02:00
Konstantin Belousov
4a4b059a97 Add vfs_remount_ro()
a helper to remount filesystem from rw to ro.

Tested by:	pho
Reviewed by:	markj, mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33721
2022-01-08 05:41:44 +02:00
Konstantin Belousov
ba2c98389b msdosfs: sanity check sector count from BPB
We use sector count to size the FAT inuse bitset.  If sector count is
corrupted, kernel might be tricked into doing unbound allocation.
Ensure that the sector count does not exceed the actual volume size.

In collaboration with:	pho
Reviewed by:	markj, mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33721
2022-01-08 05:41:44 +02:00
Konstantin Belousov
65990b68a2 msdosfs: clusterfree() is used only in error handling cases
Change its return type to void, because its result is ignored in both
call sites.  Remove oldcnp argument as well, it is NULL always.

Suggested and reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33721
2022-01-08 05:41:44 +02:00
Konstantin Belousov
aec97963cd msdosfs: do no allow lookup to return vdp except for dot lookups
In collaboaration with:	pho
Reviewed by:	markj, mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33721
2022-01-08 05:41:44 +02:00
Konstantin Belousov
1319c433f4 msdosfs: handle a case when non-dot lookup returned dvp
This means that filesystem is corrupted, there is a loop.

In collaboration with:	pho
Reviewed by:	markj, mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33721
2022-01-08 05:41:44 +02:00
Konstantin Belousov
2c9a1c22c3 msdosfs: take inusemap inconsistency as an error, not invariants violation
In other words, stop silently accepting freeing free cluster in
non-debug kernels, but return the error to the caller.  Modify callers
to handle errors from usemap_free().

In collaboration with:	pho
Reviewed by:	markj, mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33721
2022-01-08 05:41:44 +02:00
Konstantin Belousov
595ed4d767 msdosfs: handle inconsistently hashed denodes
It is possible, on the corrupted msdosfs volume, to have file which
denode inode number does not match the one calculated using directory
cluster.  Instead of asserting the condition as impossible, handle it
and return error, after reclaiming the aliased vnode.

In collaboration with:	pho
Reviewed by:	markj, mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33721
2022-01-08 05:41:44 +02:00
Konstantin Belousov
9f4073d446 geom label msdosfs: sanity check BPB before using it for io request
It must be greater than zero, and be multiple of the device block size.

In collaboration with:	pho
Reviewed by:	markj, mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33721
2022-01-08 05:41:44 +02:00