openbsd
2 years agodrm/i915: Allow !join_mbus cases for adlp+ dbuf configuration
jsg [Thu, 17 Feb 2022 05:26:18 +0000 (05:26 +0000)]
drm/i915: Allow !join_mbus cases for adlp+ dbuf configuration

From Ville Syrjala
8d6a31b83cddd5c3429def795ba7ec8fdaf4541d in linux 5.15.y/5.15.24
8fd5a26e43859547790a7995494c952b708ab3b5 in mainline linux

2 years agodrm/amdgpu/display: change pipe policy for DCN 2.0
jsg [Thu, 17 Feb 2022 05:23:06 +0000 (05:23 +0000)]
drm/amdgpu/display: change pipe policy for DCN 2.0

From Alex Deucher
c1af59449d80a4f642dbe64fd8be7c1ce86fc2cf in linux 5.15.y/5.15.24
6e7545ddb13416fd200e0b91c0acfd0404e2e27b in mainline linux

2 years agodrm/amd/display: Correct MPC split policy for DCN301
jsg [Thu, 17 Feb 2022 05:20:32 +0000 (05:20 +0000)]
drm/amd/display: Correct MPC split policy for DCN301

From Zhan Liu
a277422a8d975966de1bd3351cc6cfd8718a166d in linux 5.15.y/5.15.24
ac46d93235074a6c5d280d35771c23fd8620e7d9 in mainline linux

2 years agodrm: panel-orientation-quirks: Add quirk for the 1Netbook OneXPlayer
jsg [Thu, 17 Feb 2022 05:17:30 +0000 (05:17 +0000)]
drm: panel-orientation-quirks: Add quirk for the 1Netbook OneXPlayer

From Raymond Jay Golo
9696125fb3ca1660d28a0aef53bcaa1a20a02bdb in linux 5.15.y/5.15.24
d3cbc6e323c9299d10c8d2e4127c77c7d05d07b1 in mainline linux

2 years agoWrites to the ps_flags field of struct process should be atomic.
rob [Thu, 17 Feb 2022 03:12:34 +0000 (03:12 +0000)]
Writes to the ps_flags field of struct process should be atomic.
Ok deraadt@ guenther@

2 years agoremove unused defines
jsg [Thu, 17 Feb 2022 00:47:47 +0000 (00:47 +0000)]
remove unused defines

2 years agoreduce includes
jsg [Thu, 17 Feb 2022 00:21:40 +0000 (00:21 +0000)]
reduce includes

2 years agoreduce includes
jsg [Thu, 17 Feb 2022 00:11:21 +0000 (00:11 +0000)]
reduce includes
ok deraadt@

2 years agorev 1.4 was wrong to put potential IO operations after _GTS.
deraadt [Wed, 16 Feb 2022 20:20:36 +0000 (20:20 +0000)]
rev 1.4 was wrong to put potential IO operations after _GTS.
re-creating the original (2 weeks ago) order of last-minute-disk-parking
needs a different approach, hmm.

2 years agoSupport more mouse buttons when the terminal sends them, GitHub issue
nicm [Wed, 16 Feb 2022 18:55:05 +0000 (18:55 +0000)]
Support more mouse buttons when the terminal sends them, GitHub issue
3055.

2 years agosync
deraadt [Wed, 16 Feb 2022 17:07:05 +0000 (17:07 +0000)]
sync

2 years agosync the description for mviic(4);
jmc [Wed, 16 Feb 2022 16:47:26 +0000 (16:47 +0000)]
sync the description for mviic(4);

2 years agoreturn unique errors (I chose some errno values.. ) for the various
deraadt [Wed, 16 Feb 2022 16:44:17 +0000 (16:44 +0000)]
return unique errors (I chose some errno values.. ) for the various
failure modes.  Also, pack the code a little bit, easier to read.

2 years agoAdd missing FILTEROP_MPSAFE flag to fifoexcept_filtops.
visa [Wed, 16 Feb 2022 13:19:33 +0000 (13:19 +0000)]
Add missing FILTEROP_MPSAFE flag to fifoexcept_filtops.

OK mpi@

2 years agoReduce code duplication in FIFO event filters.
visa [Wed, 16 Feb 2022 13:18:08 +0000 (13:18 +0000)]
Reduce code duplication in FIFO event filters.

OK mpi@

2 years agoReduce code duplication in socket event filters.
visa [Wed, 16 Feb 2022 13:16:10 +0000 (13:16 +0000)]
Reduce code duplication in socket event filters.

OK mpi@

2 years agoAdd mpfiic(4), a driver for the PolarFire SoC MSS I2C controller.
visa [Wed, 16 Feb 2022 13:07:36 +0000 (13:07 +0000)]
Add mpfiic(4), a driver for the PolarFire SoC MSS I2C controller.

OK kettenis@

2 years agoAccording to RFC 2132, 2. BOOTP Extension/DHCP Option Field Format
florian [Wed, 16 Feb 2022 10:35:57 +0000 (10:35 +0000)]
According to RFC 2132, 2. BOOTP Extension/DHCP Option Field Format
ASCII data should not include trailing NUL but we MUST delete trailing
NULs on receiving.

Jan Vlach ( janus AT volny.cz) reported that Microsoft DHCP server
sends the domain name option with a trailing NUL which the installer
put into /etc/myname as a trailing ^@ which smtpd does not like.

Fix some whitespace while here.

Input & OK millert

2 years agonat-to round-robin without a pool should fallback to POOL_NONE
sashan [Wed, 16 Feb 2022 08:46:11 +0000 (08:46 +0000)]
nat-to round-robin without a pool should fallback to POOL_NONE
bug reported by giovanni@

OK giovanni@

2 years agounifdef PROC_PC
jsg [Wed, 16 Feb 2022 08:01:32 +0000 (08:01 +0000)]
unifdef PROC_PC
ok guenther@ rob@

2 years agohyphenate "8-byte";
jmc [Wed, 16 Feb 2022 07:17:41 +0000 (07:17 +0000)]
hyphenate "8-byte";

2 years agoif the lids indicate we are not supposed to wakeup, return EAGAIN rather
deraadt [Wed, 16 Feb 2022 07:13:09 +0000 (07:13 +0000)]
if the lids indicate we are not supposed to wakeup, return EAGAIN rather
than scheduling an acpi thread

2 years agodocument endpoint mode
dlg [Wed, 16 Feb 2022 06:54:08 +0000 (06:54 +0000)]
document endpoint mode

2 years agoIf the lid is closed, suspend_finish() now returns EAGAIN, so go to the top
deraadt [Wed, 16 Feb 2022 06:47:28 +0000 (06:47 +0000)]
If the lid is closed, suspend_finish() now returns EAGAIN, so go to the top
and restart the suspend all over again.  This was previously done by issuing
a task to the acpi thread, but this is simpler.
(I want to try to duplicate these tests earlier in the resume path...)

2 years agochange MD gosleep() and sleep_finish() to return int, the MI code will be
deraadt [Wed, 16 Feb 2022 06:41:27 +0000 (06:41 +0000)]
change MD gosleep() and sleep_finish() to return int, the MI code will be
able to react to this suitably.

2 years agoCurrently, wskbd_set_mixervolume() only adjusts the volume of the first
anton [Wed, 16 Feb 2022 06:23:42 +0000 (06:23 +0000)]
Currently, wskbd_set_mixervolume() only adjusts the volume of the first
attached audio device, i.e. audio0. This approach does not work well
while using additional audio devices equipped with physical volume keys
since those would only affect the volume of audio0.

Instead, correlate audio and ucc devices attached over USB in order to
adjust the volume of the correct audio device. This is done by passing a
cookie from the common point of attachment which is later used to
correlate the audio and wskbd device.

The same approach could be adopted for audio and wskbd devices attaching
on a different bus. Keep in mind that it's of importance to make use of
and increment the same global cookie identifier to avoid collisions.

Makes the volume keys on my Logitech G435 Headset do the right thing.

ok ratchov@

2 years agoMake room for a cookie argument passed to audio_attach_mi(). Currently
anton [Wed, 16 Feb 2022 06:21:18 +0000 (06:21 +0000)]
Make room for a cookie argument passed to audio_attach_mi(). Currently
unused but intended to be used to correlate audio and wskbd devices.

ok ratchov@

2 years agocheck pf rule "set prio" values consistently.
dlg [Wed, 16 Feb 2022 04:25:34 +0000 (04:25 +0000)]
check pf rule "set prio" values consistently.

consistently means we do the check in pf_rule_copyin() so both
DIOCADDRULE and DIOCCHANGERULE have the prio values checked. this in
turn prevents invalid prio values getting set on a rule via
DIOCCHANGERULE.

this was caught by a kassert in the ifq priq code firing.

Reported-by: syzbot+a8f8e24a44b441e71d93@syzkaller.appspotmail.com
ok sashan@

2 years agoAdd libclang_rt.ubsan_minimal to comp set
gnezdo [Wed, 16 Feb 2022 04:12:48 +0000 (04:12 +0000)]
Add libclang_rt.ubsan_minimal to comp set

ok jca@

2 years agoPlug ubsan_minimal into gnu/lib/libclang_rt build
gnezdo [Wed, 16 Feb 2022 03:49:40 +0000 (03:49 +0000)]
Plug ubsan_minimal into gnu/lib/libclang_rt build

ok jca@

2 years agoAdd ifdefs to build ubsan_minimal on OpenBSD
gnezdo [Wed, 16 Feb 2022 03:48:55 +0000 (03:48 +0000)]
Add ifdefs to build ubsan_minimal on OpenBSD

ok jca@

2 years agoprevent (re)opening of tun/tap interfaces that are being destroyed.
dlg [Wed, 16 Feb 2022 02:22:39 +0000 (02:22 +0000)]
prevent (re)opening of tun/tap interfaces that are being destroyed.

if an open tun (or tap) device is destroyed via the clone destroy
ioctl (eg, like what ifconfig destroy does), there is a window while
the open device is being revoked on the vfs side that a third thread
can come and open it again. this in turn triggers a kassert in the
ifconfig destroy path where it expects the
device to be closed.

fix this by having tun_dev_open check for the TUN_DEAD flag that
the destroy function sets. this still relies on the kernel lock for
serialisation.

Reported-by: syzbot+5df2ad232f5f8b671442@syzkaller.appspotmail.com
ok visa@

2 years agotake a quick run at updating the manpage for the rewritten driver.
dlg [Wed, 16 Feb 2022 02:13:43 +0000 (02:13 +0000)]
take a quick run at updating the manpage for the rewritten driver.

2 years agofill in support for rx prio handling.
dlg [Wed, 16 Feb 2022 01:45:31 +0000 (01:45 +0000)]
fill in support for rx prio handling.

2 years agorewrite vxlan to better fit the current kernel infrastructure.
dlg [Wed, 16 Feb 2022 01:25:45 +0000 (01:25 +0000)]
rewrite vxlan to better fit the current kernel infrastructure.

the big change is removing the integration with and reliance on
bridge(4) for learning vxlan endpoints. we have the etherbridge
layer now (which is used by veb, nvgre, bpe, etc) so vxlan can
operate independently of bridge(4) (or any other driver) while still
dynamically learning about other endpoints.

vxlan now uses the udp socket upcall mechanism to receive packets.
this means it actually creates and binds udp sockets to use rather
adding code in the udp layer for stealing packets from the udp
layer.

i think it's also important to note that this adds loop prevention
to the code. this stops a vxlan interface being used to transmit a
packet that was encapsulated in itself.

i want to clear this out of my tree where it's been sitting for
nearly a year. noone seems too concerned with the change either
way.

ok claudio@

2 years agoReintroduce ps state flag 'c' indicating chrooted process (via PS_BITS).
rob [Tue, 15 Feb 2022 23:16:00 +0000 (23:16 +0000)]
Reintroduce ps state flag 'c' indicating chrooted process (via PS_BITS).
Ok deraat@

2 years agoSince acpitoshiba brightness button processing no longer plays games
deraadt [Tue, 15 Feb 2022 21:17:12 +0000 (21:17 +0000)]
Since acpitoshiba brightness button processing no longer plays games
with AML parsing outside the acpi thread, the locking-release dance
around wsdisplay_{suspend,resume} can be removed
ok kettenis

2 years agoDefer the actual setting of the display brightness to the acpi thread.
kettenis [Tue, 15 Feb 2022 21:13:39 +0000 (21:13 +0000)]
Defer the actual setting of the display brightness to the acpi thread.

ok deraadt@

2 years agowhen the MI suspend code encounters problems, we need a way to
deraadt [Tue, 15 Feb 2022 16:54:48 +0000 (16:54 +0000)]
when the MI suspend code encounters problems, we need a way to
reset the MD state before bailing out.  New MD function sleep_abort()
does that.

2 years agoAdd an option (default off) to control the passthrough escape sequence.
nicm [Tue, 15 Feb 2022 13:11:29 +0000 (13:11 +0000)]
Add an option (default off) to control the passthrough escape sequence.
Like set-clipboard and allow-rename it is safer to forbid this by
default.

2 years agoDo not create a buffer from an OSC 52 response if we have not sent a
nicm [Tue, 15 Feb 2022 13:03:02 +0000 (13:03 +0000)]
Do not create a buffer from an OSC 52 response if we have not sent a
query.

2 years agocom at acpi like com at isa needs com_active() for suspend/resume support.
claudio [Tue, 15 Feb 2022 12:24:55 +0000 (12:24 +0000)]
com at acpi like com at isa needs com_active() for suspend/resume support.
Fixes my com0 issues after zzz and ZZZ.
OK kettenis@ miod@

2 years agounifdef __OpenBSD__
jsg [Tue, 15 Feb 2022 12:04:44 +0000 (12:04 +0000)]
unifdef __OpenBSD__

2 years agoBackout previous "Unwire with map lock held" (commitid: SsVz7dLGFgR21kFe)
kn [Tue, 15 Feb 2022 11:54:19 +0000 (11:54 +0000)]
Backout previous "Unwire with map lock held" (commitid: SsVz7dLGFgR21kFe)

The (known) lock order reversals which now occur more reliably and much
earlier on WITNESS boots with this diff knock out syzcaller reports since
syzcaller stops at the first "crash report":
https://syzkaller.appspot.com/bug?id=81b39e970cd2eb21b97d1b31746c693e300fd2dd

2 years agounifdef OpenBSD
jsg [Tue, 15 Feb 2022 10:36:59 +0000 (10:36 +0000)]
unifdef OpenBSD
ok miod@

2 years agoconsistently use __linux__
jsg [Tue, 15 Feb 2022 10:30:23 +0000 (10:30 +0000)]
consistently use __linux__

2 years agoUse knote_modify_fn() and knote_process_fn() in bpf.
visa [Tue, 15 Feb 2022 08:43:50 +0000 (08:43 +0000)]
Use knote_modify_fn() and knote_process_fn() in bpf.

OK dlg@

2 years agounifdef CDIOCCLOSE __OpenBSD__
jsg [Tue, 15 Feb 2022 08:17:50 +0000 (08:17 +0000)]
unifdef CDIOCCLOSE __OpenBSD__

2 years agomake use of pkg_* infra simplifications
espie [Tue, 15 Feb 2022 08:02:03 +0000 (08:02 +0000)]
make use of pkg_* infra simplifications
okay afresh1@

2 years agosimplify code based on afresh1@'s remark: indeed I always need to
espie [Tue, 15 Feb 2022 07:35:35 +0000 (07:35 +0000)]
simplify code based on afresh1@'s remark: indeed I always need to
have a state once I'm past the initial locking

2 years agodocument the unbound/host-bound options to PubkeyAuthentication;
djm [Tue, 15 Feb 2022 05:13:36 +0000 (05:13 +0000)]
document the unbound/host-bound options to PubkeyAuthentication;
spotted by HARUYAMA Seigo

2 years agoonly tweak ifp if_flags while holding NET_LOCK.
dlg [Tue, 15 Feb 2022 04:19:52 +0000 (04:19 +0000)]
only tweak ifp if_flags while holding NET_LOCK.

tun_dev_open and tun_dev_close were being optmistic.

2 years agomake tun_link_state take the ifnet pointer instead of tun_softc.
dlg [Tue, 15 Feb 2022 04:16:10 +0000 (04:16 +0000)]
make tun_link_state take the ifnet pointer instead of tun_softc.

it only works on struct ifnet data, so passing ifp makes it clearer
what's actually being manipulated. also fix tun_dev_open so
tun_link_state is called before if_put instead of immediately after.

2 years agounifdef TIOCHPCL, 4.3BSD compat ioctl
jsg [Tue, 15 Feb 2022 03:53:58 +0000 (03:53 +0000)]
unifdef TIOCHPCL, 4.3BSD compat ioctl
ok deraadt@ guenther@

2 years agoremove unused and uneeded bits in a byte define
jsg [Tue, 15 Feb 2022 03:31:17 +0000 (03:31 +0000)]
remove unused and uneeded bits in a byte define
posix requires a byte to be 8 bits

2 years agoMI disable_lid_wakeups() is not needed, x86 systems can do this
deraadt [Tue, 15 Feb 2022 02:38:16 +0000 (02:38 +0000)]
MI disable_lid_wakeups() is not needed, x86 systems can do this
in sleep_resume(), which seems sensible for other future systems also

2 years agoThe DVACT_POWERDOWN step was accidentally moved in relation to some MD
deraadt [Tue, 15 Feb 2022 02:29:23 +0000 (02:29 +0000)]
The DVACT_POWERDOWN step was accidentally moved in relation to some MD
steps, so shuffle the MD steps to reinforce the order.

2 years agofix mask in hppa inst_trap_return()
jsg [Tue, 15 Feb 2022 00:27:11 +0000 (00:27 +0000)]
fix mask in hppa inst_trap_return()

inst_trap_return() was checking for rfir by masking with 0xfc001fc0
which made it impossible to match rfir (0xca0)

rfi: return from interruption
00 rv rv rv 60 0
 6  5  5  3  8 5

rfir: return from interruption and restore
00 rv rv rv 65 0
 6  5  5  3  8 5

from "PA-RISC 1.1 Architecture and Instruction Set Reference Manual"
where rv indicates reserved bits

change the mask to only mask out reserved bits and check for rfi
in addition to rfir

ok miod@

2 years agoMake sure we call acpi_resume_cpu() with the right ACPI state. This was
kettenis [Mon, 14 Feb 2022 23:42:37 +0000 (23:42 +0000)]
Make sure we call acpi_resume_cpu() with the right ACPI state.  This was
accidentally broken with the reorganization of the suspend/resume code that
was committed a few days ago.

ok deraadt@

2 years agodon't deref pointer before test it is safe
jsg [Mon, 14 Feb 2022 23:20:46 +0000 (23:20 +0000)]
don't deref pointer before test it is safe
ok miod@

2 years agofix cmalo_media_change() test
jsg [Mon, 14 Feb 2022 23:02:15 +0000 (23:02 +0000)]
fix cmalo_media_change() test
ok claudio@ deraadt@

2 years agoUse fdisk -b to create the desired 1MB MSDOS boot partition
krw [Mon, 14 Feb 2022 22:38:24 +0000 (22:38 +0000)]
Use fdisk -b to create the desired 1MB MSDOS boot partition
rather than relying on /usr/mdec/mbr.

Tested by tobhe@

2 years agoUnwire with map lock held
kn [Mon, 14 Feb 2022 21:11:02 +0000 (21:11 +0000)]
Unwire with map lock held

This is an updated version of uvm_map.c r1.283 "Unwire with map lock held".

The previous version introduced a use-after-free by not unlocking vm_map
locks in uvm_map_teardown(), resulting in dangling references on the
reaper's lock list (thanks visa!).

Lock and unlock the map in around uvm_map_teardown() instead.
This code path holds the last reference, hence the lock isn't strictly
needed except for satisfying upcoming locking assertions.

Tested on amd64, arm64, i386, macppc, octeon, sparc64.
This time also with WITNESS enabled (except on sparc64 which builds but does
not boot with WITNESS;  this is a known issue).

OK mpi visa

2 years agoacpi_indicator() can take the softc*, instead of void*
deraadt [Mon, 14 Feb 2022 19:25:03 +0000 (19:25 +0000)]
acpi_indicator() can take the softc*, instead of void*

2 years agoRevert change to ps for displaying chrooted process.
rob [Mon, 14 Feb 2022 18:09:08 +0000 (18:09 +0000)]
Revert change to ps for displaying chrooted process.
Ok deraadt

2 years agoWhitespace nit.
krw [Mon, 14 Feb 2022 16:10:45 +0000 (16:10 +0000)]
Whitespace nit.

2 years agoUse iic_is_compatible(9) and use the more generic compatible string to
kettenis [Mon, 14 Feb 2022 14:57:00 +0000 (14:57 +0000)]
Use iic_is_compatible(9) and use the more generic compatible string to
match the device.

ok visa@

2 years agoPass the entire compatible property for devices attaching to the iic(4) bus.
kettenis [Mon, 14 Feb 2022 14:55:53 +0000 (14:55 +0000)]
Pass the entire compatible property for devices attaching to the iic(4) bus.

ok visa@

2 years agoDraw a bit more attention to transport switches between RRDP, RSYNC, and cache
job [Mon, 14 Feb 2022 14:47:49 +0000 (14:47 +0000)]
Draw a bit more attention to transport switches between RRDP, RSYNC, and cache

OK claudio@ tb@

2 years agoName the maximum number of deltas permitted in a RRDP Notification file
job [Mon, 14 Feb 2022 14:46:16 +0000 (14:46 +0000)]
Name the maximum number of deltas permitted in a RRDP Notification file

OK claudio@ tb@

2 years agoDelete incomplete implementation of bus_space_{alloc,free} in bus.h.
aoyama [Mon, 14 Feb 2022 13:03:52 +0000 (13:03 +0000)]
Delete incomplete implementation of bus_space_{alloc,free} in bus.h.

This prevents errors on luna88k in src/usr.sbin/fw_update/pattern.c
which includes dev/pci/pcivar.h, which includes machine/bus.h.

Suggested by miod@

2 years agoOF_getproplen() returns -1 on error, so don't store result in size_t
jsg [Mon, 14 Feb 2022 12:54:43 +0000 (12:54 +0000)]
OF_getproplen() returns -1 on error, so don't store result in size_t
spotted by and ok tb@, ok tobhe@

2 years agoIntroduce a signal context that is used to pass signal related information
claudio [Mon, 14 Feb 2022 11:26:05 +0000 (11:26 +0000)]
Introduce a signal context that is used to pass signal related information
from cursig() to postsig() or the caller itself. This will simplify locking.
Also alter sigactsfree() a bit and move it into process_zap() so ps_sigacts
is always a valid pointer.
OK semarie@

2 years agomake db locking self-contained
espie [Mon, 14 Feb 2022 10:34:36 +0000 (10:34 +0000)]
make db locking self-contained

2 years agoDo not return error with -q, GitHub issue 3065.
nicm [Mon, 14 Feb 2022 09:10:48 +0000 (09:10 +0000)]
Do not return error with -q, GitHub issue 3065.

2 years agoAdd the EM_RISCV value to match <sys/exec_elf.h>
kevlo [Mon, 14 Feb 2022 08:14:19 +0000 (08:14 +0000)]
Add the EM_RISCV value to match <sys/exec_elf.h>

ok miod@

2 years agopty test is not expected to fail any longer.
visa [Mon, 14 Feb 2022 06:39:19 +0000 (06:39 +0000)]
pty test is not expected to fail any longer.

2 years agoreprint device name in attach error paths if needed
jsg [Mon, 14 Feb 2022 05:30:53 +0000 (05:30 +0000)]
reprint device name in attach error paths if needed

2 years agocheck return value of drm_attach_pci()
jsg [Mon, 14 Feb 2022 05:20:03 +0000 (05:20 +0000)]
check return value of drm_attach_pci()
adapted from a diff by Ted Bullock

2 years agoremove unused code
jsg [Mon, 14 Feb 2022 04:55:55 +0000 (04:55 +0000)]
remove unused code

2 years agono need for ifndef __sparc64__
jsg [Mon, 14 Feb 2022 04:41:13 +0000 (04:41 +0000)]
no need for ifndef __sparc64__
from Ted Bullock who tested on sparc64 with xvr-100

2 years agoupdate sbchecklowmem() to better detect actual mbuf memory usage.
dlg [Mon, 14 Feb 2022 04:33:18 +0000 (04:33 +0000)]
update sbchecklowmem() to better detect actual mbuf memory usage.

previously sbchecklowmem() (and sonewconn()) would look at the mbuf
and mbuf cluster pools to see if they were approaching their hard
limits. based on how many mbufs/clusters were allocated against the
limits, socket operations would start to fail with ENOBUFS until
utilisation went down.

mbufs and clusters have changed a lot since then though. there are
now many mbuf cluster pools, not just one for 2k clusters. because
of this the mbuf layer now limits the amount of memory all the mbuf
pools can allocate backend pages from rather than limit the individual
pools. this means sbchecklowmem() ends up looking at the default
pool hard limit, which is UINT_MAX, which in turn means means
sbchecklowmem() probably never applies backpressure. this is made
worse on multiprocessor systems where per cpu caches of mbuf and
cluster pool items are enabled because the number of in use pool
items is distorted by the cpu caches.

this switches sbchecklowmem to looking at the page allocations made
by all the pools instead. the big benefit of this is that the page
allocations are much more representative of the overall mbuf memory
usage in the system. the downside is is that the backend page
allocation accounting does not see idle memory held by pools. pools
cannot release partially free pages to the page backend (obviously),
and pools cache idle items to avoid thrashing on the backend page
allocator. this means the page allocation level is higher than the
memory used by actual in-flight mbufs.

however, this can also be a benefit. the backend page allocation is a
kind of smoothed out "trend" line. mbuf utilisation over short periods
can be extremely bursty because of things like rx ring dequeue and fill
cycles, or large socket sends. if you're trying to grow socket
buffers while these things are happening, luck becomes an important
factor in whether it will work or not. because pools cache idle items,
the backend page utilisation better represents the overall trend
of activity in the system and will give more consistent behaviour here.

this diff is deliberately simple. we're basically going from "no
limits" to "some sort of limit" for sockets again, so keeping the
code simple means it should be easy to understand and tweak in the
future.

ok djm@ visa@ claudio@

2 years agochange a NULL pa_memex test after use to an earlier KASSERT
jsg [Mon, 14 Feb 2022 03:51:42 +0000 (03:51 +0000)]
change a NULL pa_memex test after use to an earlier KASSERT
from Ted Bullock

2 years agoMark all the rpc 'ops' vectors, for auth, client, service, and xdr,
guenther [Mon, 14 Feb 2022 03:38:59 +0000 (03:38 +0000)]
Mark all the rpc 'ops' vectors, for auth, client, service, and xdr,
as const, moving them from .data to .data.rel.ro.  The other BSDs
did this a long time ago; NetBSD did a chunk in 1998, which is long
enough I didn't bother to get exact dates for others.

ok deraadt@ millert@

2 years agotest the correct pointer for acpi_intr_establish() result
jsg [Mon, 14 Feb 2022 02:57:21 +0000 (02:57 +0000)]
test the correct pointer for acpi_intr_establish() result
ok deraadt@ gnezdo@

2 years agoOF_getproplen() returns -1 on error, so don't store result in size_t
jsg [Mon, 14 Feb 2022 00:53:40 +0000 (00:53 +0000)]
OF_getproplen() returns -1 on error, so don't store result in size_t
ok kettenis@

2 years agoThe length value in bpf_movein() is casted to from size_t to u_int
bluhm [Sun, 13 Feb 2022 23:11:10 +0000 (23:11 +0000)]
The length value in bpf_movein() is casted to from size_t to u_int
and then rounded before checking.  Put the same check before the
calculations to avoid overflow.
Reported-by: syzbot+6f29d23eca959c5a9705@syzkaller.appspotmail.com
OK claudio@

2 years ago- for -a, get the brackets right
jmc [Sun, 13 Feb 2022 21:27:51 +0000 (21:27 +0000)]
- for -a, get the brackets right
- for -l and -m remove the brackets
- note that -m whilst charging now displays estimated recharge time
- A/C -> AC

from jan stary;
tweaked a little by myself

2 years agoHandle the case in freechunks where not a single allocation has happened.
otto [Sun, 13 Feb 2022 20:02:30 +0000 (20:02 +0000)]
Handle the case in freechunks where not a single allocation has happened.
ok deraadt@

2 years agosync
sthen [Sun, 13 Feb 2022 19:37:41 +0000 (19:37 +0000)]
sync

2 years agoremove stray tab whitespace. no code change.
mlarkin [Sun, 13 Feb 2022 19:15:09 +0000 (19:15 +0000)]
remove stray tab whitespace. no code change.

2 years agoFix return value check of OF_getproplen(). If "reset-gpios" is not found
tobhe [Sun, 13 Feb 2022 16:44:50 +0000 (16:44 +0000)]
Fix return value check of OF_getproplen(). If "reset-gpios" is not found
in the device tree -1 is returned, causing a panic in the following malloc
call.

ok kn@ patrick@ kettenis@

2 years agoMove some MI pieces out of suspend_mp/resume_mp
deraadt [Sun, 13 Feb 2022 15:56:55 +0000 (15:56 +0000)]
Move some MI pieces out of suspend_mp/resume_mp
ok kettenis

2 years agoThe Apple M1 SoC has two mechanism for doing IPIs. The first method uses
kettenis [Sun, 13 Feb 2022 15:54:07 +0000 (15:54 +0000)]
The Apple M1 SoC has two mechanism for doing IPIs.  The first method uses
the interrupt controller, the second method used implementation-specific
CPU registers.  The M1 Pro/Max SoCs use a modified interrupt controller
that no longer provides the first method.  So switch to the second method
in preparation for adding M1 Pro/Max support to OpenBSD.  As a bonus this
mechanism seems to be faster (which may be why Apple calls these "fast"
IPIs).

ok patrick@

2 years agoUse knote_modify() and knote_process() in obvious places.
visa [Sun, 13 Feb 2022 13:05:51 +0000 (13:05 +0000)]
Use knote_modify() and knote_process() in obvious places.

2 years agoAdd helper functions for f_modify and f_process to condense code
visa [Sun, 13 Feb 2022 13:03:02 +0000 (13:03 +0000)]
Add helper functions for f_modify and f_process to condense code

These new functions, knote_modify() and knote_process(), implement
the logic that is common to most f_modify and f_process instances.

The code is inlined so as to not add yet another call frame on the
already towering stack of kqueue functions. Also, the _fn versions
allow direct calling of an event function when there is only one
filter type to handle.

2 years agoRename knote_modify() to knote_assign()
visa [Sun, 13 Feb 2022 12:58:46 +0000 (12:58 +0000)]
Rename knote_modify() to knote_assign()

This avoids verb overlap with f_modify.

2 years agoSKEEYSEED -> SKEYSEED
mbuhl [Sun, 13 Feb 2022 12:26:54 +0000 (12:26 +0000)]
SKEEYSEED -> SKEYSEED

2 years agoSome PCIe devices on the M1 and M1 Pro/Max need to be explicitly powered on
kettenis [Sun, 13 Feb 2022 12:02:21 +0000 (12:02 +0000)]
Some PCIe devices on the M1 and M1 Pro/Max need to be explicitly powered on
(most notably the WiFi chip).  This is done through a GPIO controlled by
the SMC.  Add support for this and make sure we wait for the 100ms required
by the PCIe standard when we use that GPIO to turn on power.  This makes sure
these devices are available even if U-Boot doesn't turn them on for us.

ok patrick@

2 years agoAdd basic GPIO support.
kettenis [Sun, 13 Feb 2022 11:58:53 +0000 (11:58 +0000)]
Add basic GPIO support.

ok patrick@