1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00
Commit Graph

288428 Commits

Author SHA1 Message Date
Vladimir Kondratyev
745067c585 LinuxKPI: Add acpi_video_backlight_use_native()
We assume that backlight (in Linux term) is always "native".

Also stub acpi_video_register_backlight()

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42814
2023-12-24 11:20:00 +03:00
Vladimir Kondratyev
5ae2e6f913 LinuxKPI: Add bitmap_intersects(), bitmap_from_arr32()
and bitmap_shift_right() functions to linux/bitmap.h

They perform calculation of two bitmaps intersection,
copying the contents of u32 array of bits to bitmap and
logical right shifting of the bits in a bitmap.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42812
2023-12-24 11:19:59 +03:00
Vladimir Kondratyev
1b2f43a742 LinuxKPI: Add cancel_work() function.
Cancel a work not waiting for it to finish.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42811
2023-12-24 11:19:59 +03:00
Vladimir Kondratyev
64e30cba3f LinuxKPI: Add write_seqcount_invalidate() and seqprop_sequence()
functions to linux/seqlock.h

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42810
2023-12-24 11:19:59 +03:00
Vladimir Kondratyev
a39ed121ea LinuxKPI: Chase for new "name" argument of register_shrinker()
Linux uses it only if SHRINKER_DEBUG config option is enabled. Ignore it.

Sponsored by:	Serenity Cyber Security, LLC
Reviewers:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42809
2023-12-24 11:19:59 +03:00
Vladimir Kondratyev
c7312643b7 LinuxKPI: Add ida_alloc_min()
ida_alloc_min() allocates an unused ID. between min and INT_MAX.

While here allow end parameter of ida_simple_get() be larger than
INT_MAX. Linux caps the value to INT_MAX.

Sponsored by:	Serenity Cyber Security, LLC
Reviewers:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42806
2023-12-24 11:19:59 +03:00
Vladimir Kondratyev
af787b8e8b LinuxKPI: Add IOMEM_ERR_PTR() to linux/io.h
The function creates an error pointer.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42805
2023-12-24 11:19:59 +03:00
Vladimir Kondratyev
e964da1415 LinuxKPI: Add ktime_get_raw_fast_ns() to linux/ktime.h
It is implemented like ktime_get_raw_ns() function but uses less
precise getnanouptime() call.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42804
2023-12-24 11:19:59 +03:00
Vladimir Kondratyev
66f9a98335 LinuxKPI: Add xa_(un)lock_irq to linux/xarray.h
On FreeBSD they are equal to non-irq version.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42803
2023-12-24 11:19:59 +03:00
Vladimir Kondratyev
206e9fea75 LinuxKPI: Add asm/hypervisor.h header
Sponsored by:	Serenity Cyber Security, LLC
Obtained from:	OpenBSD
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42802
2023-12-24 11:19:59 +03:00
Vladimir Kondratyev
dcfc983373 LinuxKPI: Implement ioread64()
Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42801
2023-12-24 11:19:58 +03:00
Vladimir Kondratyev
f8ab2f5bae LinuxKPI: Add linux/iosys-map.h header
Sponsored by:	Serenity Cyber Security, LLC
Obtained from:	OpenBSD
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42799
2023-12-24 11:19:58 +03:00
Vladimir Kondratyev
1bce29bcf1 LinuxKPI: Add some header pollution and dummy headers
required by recent drm-kmod to be succesfully compiled.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
Obtained from:	OpenBSD (partially)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42798
2023-12-24 11:19:58 +03:00
Vladimir Kondratyev
c612e3c262 LinuxKPI: Add xen/xen.h header
It contains proxy-implementation of xen_initial_domain() and
xen_pv_domain() required by latest drm-kmod.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42797
2023-12-24 11:19:58 +03:00
Vladimir Kondratyev
fa862482fb LinuxKPI: Split linux/container_of.h off from linux/kernel.h
Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:      1 week
Differential Revision:	https://reviews.freebsd.org/D42796
2023-12-24 11:19:58 +03:00
Vladimir Kondratyev
31ef29091b LinuxKPI: Add static_assert() macro
And move it along BUILD_BUG family in to
linux/build_bug.h to match Linux.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42800
2023-12-24 11:19:58 +03:00
Vladimir Kondratyev
a012599653 LinuxKPI: Implement dev_dbg_once() macro
Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42795
2023-12-24 11:19:58 +03:00
Vladimir Kondratyev
ae1084ff01 LinuxKPI: Add str_on_off and other helpers to linux/string_helpers.h
Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz, imp (previous version)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42794
2023-12-24 11:19:58 +03:00
Vladimir Kondratyev
5e6bddfc43 LinuxKPI: Add video/vga.h header
Sponsored by:	Serenity Cyber Security, LLC
Obtained from:	OpenBSD
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42793
2023-12-24 11:19:58 +03:00
Vladimir Kondratyev
96ab16ebab LinuxKPI: Remove sys/rman.h include from LKPI headers.
sys/rman.h defines `resource` structure which conflicts with the Linux
structure of the same name. To fix that remove reference to sys/rman.h
from linux/pci.h and move resource management code to linux_pci.c.
Update consumers which were depending on linux/pci.h pollution.

No functional changes intended.

Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42792
2023-12-24 11:19:57 +03:00
Jason A. Harmening
0ee1cd6da9 vm_page.h: tweak page-busied assertion macros
Fix incorrect macro name and include the value of curthread in the
panic message where relevant.
2023-12-23 23:20:13 -06:00
Jason A. Harmening
2619c5ccfe Avoid waiting on physical allocations that can't possibly be satisfied
- Change vm_page_reclaim_contig[_domain] to return an errno instead
  of a boolean.  0 indicates a successful reclaim, ENOMEM indicates
  lack of available memory to reclaim, with any other error (currently
  only ERANGE) indicating that reclamation is impossible for the
  specified address range.  Change all callers to only follow
  up with vm_page_wait* in the ENOMEM case.

- Introduce vm_domainset_iter_ignore(), which marks the specified
  domain as unavailable for further use by the iterator.  Use this
  function to ignore domains that can't possibly satisfy a physical
  allocation request.  Since WAITOK allocations run the iterators
  repeatedly, this avoids the possibility of infinitely spinning
  in domain iteration if no available domain can satisfy the
  allocation request.

PR:		274252
Reported by:	kevans
Tested by:	kevans
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D42706
2023-12-23 23:01:40 -06:00
Alexander Motin
1a3ee6002f acpi_lid: Remove duplicate events
Remove extra acpi_UserNotify() call per event.  Filter duplicate
notifications received from ACPI without actual status change.

Without this on my Dell XPS 13 9310 I saw 4 devd events for either
open or close, now only one.

MFC after:	1 month
2023-12-23 21:33:51 -05:00
Alexander Motin
68e457df02 iichid(4): Restore/increase sampling rate
My previous commit by reducing precision reduced the sampling rate
from 60Hz to 40Hz on idle system.  Return it back to 60-80Hz range,
that should be good for mouse smoothness on 60Hz displays.

MFC after:	1 months
2023-12-23 19:10:49 -05:00
Alexander Motin
9c9d7fdd9f ig4: Fix FIFO depths detection
At least on my Tiger Lake-LP queue depth detection failed before the
ig4iic_set_config() call, resulting in no FIFO use.  Moving it after
solves the problem, getting proper 64 bytes size.

On my Dell XPS 13 9310 with iichid(4) touchscreen and touchpad this
by few times reduces context switch rate in the driver, and probably
also improves the I2C bus utilization.

MFC after:	1 month
2023-12-23 19:02:49 -05:00
Alexander Motin
a74df3f96e iicbb: Fix pause_sbt() arguments order
It should make pause interval less strict.

While there, add cpu_spinwait() into a tight spin wait loop to burn
less power and let other SMT thread work more.

MFC after:	1 month
2023-12-23 18:58:51 -05:00
Yuji Hagiwara
553ed8e38b mlx4(5): fix driver initialization
After netlinkification, ether_ifattach() requires ifmedia_init() to be
done before it.

PR:	275897
MFC after:	1 week
2023-12-23 22:53:02 +02:00
Xin LI
906748d208 newsyslog(8): Add option to globally override compression method.
Historically, newsyslog compressed rotated log files to save disk space.
This was useful in the early days. However, with modern file systems like
ZFS offering native compression, and with the availability of larger hard
drives, the benefits of additional compression have become less significant.
This is particularly true considering the inconvenience of decompressing
log files when searching for specific patterns.

Additionally, the original implementation of compression methods was not
future-proof.  As a result, we have redefined the J, X, Y, Z flags to
signify "treat the file as compressible" rather than "compress the file
with that specific method."

A new command-line option, -c, has been introduced to allow overriding
these settings in a more future-proof way. The available choices are:

 * none			 - do not compress, regardless of flag.
 * legacy		 - historical behavior: J=bzip2, X=xz, Y=zstd, Z=gzip.
 * bzip2, xz, zstd, gzip - apply the specified compression method.

Currently, the default is set to 'legacy' to preserve historical behavior.
However, our intention is to change this default to 'none' in FreeBSD 15.0.

Additionally, this update changes the default settings for zstd to use
multithreading and long-range options, better aligning with its intended
use.

Inspired by D42961 .

Reviewed by:	debdrup (earlier version, mdoc(7))
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D43165
2023-12-22 22:46:33 -08:00
Alexander Motin
8c86b98124 iichid(4): Improve idle sampling hysteresis
In sampling mode some devices return same data indefinitely even if
there is nothing to report.  Previous idle hysteresis implementation
activated only when device returned no data, so some devices ended up
polled at fast rate all the time.  This new implementation compares
each new report with the previous, and, if they are identical, after
reaching threshold also drop sampling rate to slow.

On my Dell XPS 13 9310 with iichid(4) touchscreen and touchpad this
reduces idle power consumption by ~0.5W by reducing number of context
switches in the driver from ~4000 to ~700 per second when not touched.

MFC after:	1 month
2023-12-22 22:50:52 -05:00
Philip Paeps
eebb9c2cae contrib/tzdata: import tzdata 2023d
Changes: https://github.com/eggert/tz/blob/2023d/NEWS

MFC after:	1 day
2023-12-23 09:51:01 +08:00
Philip Paeps
893fe32cd2 Import tzdata 2023d 2023-12-23 09:34:58 +08:00
Rick Macklem
dac33a65b9 RELNOTES: Add an entry for commit 7c5146da12 2023-12-22 12:25:19 -08:00
Rick Macklem
922e78f65f mountd: Update exports.5 for commit 7c5146da12
Commit 7c5146da12 modified mountd so that it uses
strunvis(3) to decode directory names in exports lines.
This allows special characters, such as blanks, to be
encoded in the directory names.

This patch updates the exports.5 man page for this change.

This is a content change.

Reviewed by:	karels, pauamma_gundo.com (manpages)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42163
2023-12-22 12:17:36 -08:00
Rick Macklem
b484bcd504 nfscl: Fix handling of a copyout() error reply
If vfs.nfs.nfs_directio_enable is set non-zero (the default is
zero) and a file on an NFS mount is read after being opened
with O_DIRECT | O_ RDONLY, a call to nfsm_mbufuio() calls
copyout() without checking for an error return.
If copyout() returns EFAULT, this would not work correctly.

Only the call path
 VOP_READ()->ncl_readrpc()->nfsrpc_read()->nfsrpc_readrpc()
will do this and the error return for EFAULT will
be returned back to VOP_READ().

This patch adds the error check to nfsm_mbufuio().

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43160
2023-12-22 12:11:22 -08:00
Konstantin Belousov
671a00491d vm_iommu_map()/unmap(): stop transiently wiring already wired pages
Namely, switch from vm_fault_quick_hold() to pmap_extract() KPI to
translate gpa to hpa. Assert that the looked up hpa belongs to the wired
page, as it should be for the VM which is configured for pass-throu
(this is theoretically a restriction that could be removed on newer
DMARs).

Noted by:	alc
Reviewed by:	alc, jhb, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43140
2023-12-22 19:34:27 +02:00
Konstantin Belousov
3abc72f871 vmm_iommu_modify(): split vm_iommu_map()/unmap() into separate functions
Reviewed by:	alc, jhb, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43140
2023-12-22 19:34:27 +02:00
Kristof Provost
e774c1ef27 pf: mark netlink commands as requiring NETINET_PF privileges
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-12-22 17:43:30 +01:00
John Baldwin
d281fece43 kldxref: Appease a Coverity warning
While parsing .dynamic, nsym is set when parsing the symbol table from
.dynsym.  That parsing also sets ef->ef_symtab to a non-NULL value.
The value of nsym isn't validated until after a check for
ef->ef_symtab being NULL, so nsym always has a valid value when it is
read.  However, that chain of events is a bit much for static analysis
to follow, so initialize nsym to 0 before parsing sections to quiet
the warning.

Reported by:	Coverity Scan
CID:		1532339
Sponsored by:	DARPA
2023-12-22 07:49:40 -08:00
John Baldwin
0d557cdf6f kldxref: Simplify handling of ELF object files
Unlike the backend for ELF DSOs, the object file backend allocated an
aligned chunk of memory and read all of the in-memory sections from
the file into this memory even though most of the file contents were
never used.  Instead, just track a set of virtual addresses (based at
0) that each loaded section would be loaded at and only read the
necessary bits from the backing file when needed.

Reviewed by:	imp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43126
2023-12-22 07:49:18 -08:00
John Baldwin
ed96fd7fc6 kldxref: Simplify elf_read_raw_data
Use pread as a valid offset is always passed now.  Originally the DSO
code read the .hash section in two separate requests and relied on the
implicit offset for the second read, but now the hash table is fetched
in a single call.

Reviewed by:	imp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43125
2023-12-22 07:49:03 -08:00
John Baldwin
6d46e2e0a7 kldxref: Tidy error handling for invalid addresses
- Don't print an offset value that's always zero.

- ef_get_offset can't return -1.

Reviewed by:	imp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43124
2023-12-22 07:48:47 -08:00
Konstantin Belousov
72f1e31f5f bhyve.8: fix -k description
Apparently 19eaa01bea inserted -K description in the middle of -k.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D43164
2023-12-22 17:29:33 +02:00
Konstantin Belousov
59a35b7c6b bhyve.8: add missed dot
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D43164
2023-12-22 17:29:25 +02:00
Tijl Coosemans
272b4b764b devd: Don't install autofs.conf with WITHOUT_AUTOFS 2023-12-22 15:27:50 +01:00
Richard Scheffenegger
8717c306bd tcp: allow userspace use of tcp header flags accessor functions
Provide accessor functions to all 12 possible TCP header
flags for userspace too.

Reviewed By:           zlei
MFC after:             2 weeks
Sponsored by:          Netapp, Inc.
Differential Revision: https://reviews.freebsd.org/D43152
2023-12-22 02:20:29 +01:00
Pawel Jakub Dawidek
eb4d13126d seq(1): Put separator only between the elements.
- Using non-default ('\n') separator will produce an output with the
  separator at the end of the output, eg.

	% echo "[$(seq -s ' ' 0 2)]"
	[0 1 2 ]

- The output should always be followed by a new line character. Currently:

	% seq -s ' ' 0 2
	0 1 2 %

This change makes seq(1) to behave the same way Linux seq(1):

	% echo "[$(seq -s ' ' 0 2)]"
	[0 1 2]

	% seq -s ' ' 0 2
	0 1 2
	%

Approved by:	oshogbo
Differential Revision:	https://reviews.freebsd.org/D43094
2023-12-21 21:54:05 -08:00
Bill Sommerfeld
8f7ed58a15 regex: mixed sets are misidentified as singletons
Fix "singleton" function used by regcomp() to turn character set matches
into exact character matches if a character set has exactly one
element.

The underlying cset representation is complex; most critically it
records"small" characters (codepoint less than either 128
or 256 depending on locale) in a bit vector, and "wide" characters in
a secondary array.

Unfortunately the "singleton" function uses to identify singleton sets
treated a cset as a singleton if either the "small" or the "wide" sets
had exactly one element (it would then ignore the other set).

The easiest way to demonstrate this bug:

	$ export LANG=C.UTF-8
	$ echo 'a' | grep '[abà]'

It should match (and print "a") but instead it doesn't match because the
single accented character in the set is misinterpreted as a singleton.

Reviewed by:	kevans, yuripv
Obtained from:	illumos
Differential Revision:	https://reviews.freebsd.org/D43149
2023-12-22 12:19:59 +07:00
Bjoern A. Zeeb
488e8a7fac LinuxKPI: reduce impact of large MAXCPU
Start scaling arrays dynamically instead of using MAXCPU, resulting in
extra allocations on startup but reducing the overall memory footprint.
For the static single CPU mask we provide two versions to further save
memory depending on a low or high CPU count system.  The threshold to
switch is currently at 128 CPUs on 64bit platforms.
More detailed comments on the implementations can be found in the code.

If I am not wrong on a MAXCPU=65536 system the memory footprint should
roughly go down from 512M to 1.5M for the static single CPU mask.

Submitted by:	olce (most of this final version)
Sponsored by:	The FreeBSD Foundation
PR:		274316
Differential Revision: https://reviews.freebsd.org/D42345
2023-12-22 00:22:04 +00:00
Bjoern A. Zeeb
e85eb4c8d7 net80211: adjust more VHT structures/fields
Replace ieee80211_ie_vhtcap with ieee80211_vht_cap and
ieee80211_ie_vht_operation with ieee80211_vht_operation.
The "ie" version has the two bytes type/length at the beginning which
we did not actually use as such (the one place doing did just as unused
extra work).

Using the non-"ie" versions allows us to re-use them on shared code.
Using an enum helps us to not accidentally get unsuppored or unhandled
values tough we cannot use it in the struct as we need to ensure the
field width.

ieee80211_vht_operation is guarded by _KERNEL/WANT_NET80211.  While the
header is supposed to be exported to user land historically, software
such as wpa bring their own structure definitions.  For in-tree usage
it is only ifconfig which really cares (at least for now).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian (earlier), cc
Differential Revision: https://reviews.freebsd.org/D42901
2023-12-22 00:20:19 +00:00
Bjoern A. Zeeb
72bb33a36b net80211: improve logging about state transitions lost
It is possible that we call ieee80211_new_state_locked() again before
a previous task finished to completion (not run yet or unlocked in
between) since 5efea30f03 (and follow-up).
In either case we would overwrite the new state and argument in the vap.

While most drivers somehow deal with that (or not), LinuxKPI 802.11 compat
code has KASSERTs to keep net80211, LinuxKPI and driver/firmware state in
sync and they may trigger due to a missing transition or more likely a
changed ni/lsta.

Enhance the wlandebug +state logging for these cases so they
are easier to debug.

While here remove the unconditional logging to the message buffer;
it has been here for a good decade but not helped to actually identify
and sort the problem.

Sponsored by:   The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	cc
Differential Revision: https://reviews.freebsd.org/D42560
2023-12-22 00:19:05 +00:00