OpenBSD cvs log

created 2023-05-27T04:17:00Z
begin 2023-05-13T00:00:00Z
end 2023-05-20T00:00:00Z
path src/sys
commits 37

date 2023-05-13T09:24:59Z
author mpi
files src/sys/uvm/uvm_aobj.c log diff annotate
src/sys/uvm/uvm_aobj.h log diff annotate
src/sys/uvm/uvm_page.c log diff annotate
src/sys/uvm/uvm_pager.c log diff annotate
message Put back in the simplification of the aiodone daemon.

Previous "breakage" of the swap on arm64 has been found to be an issue
on one machine the rockpro/arm64 related to a deadlock built into the
sdmmc(4) stack interacting with swapping code both running under
KERNEL_LOCK().

This issue is easily reproducible on -current and entering swap when
building LLVM on a rockpro crashes the machine by memory corruption.

Tested by mlarkin@ on octeon & i386, by myself on amd64 & arm64 and by
sthen@ on i386 port bulk.

ok beck@ some time ago.

Previous commit message:

Simplify the aiodone daemon which is only used for async writes.

- Remove unused support for asynchronous read, including error conditions

- Grab the proper lock for each page that has been written to swap. This
allows to enable an assertion in uvm_page_unbusy().

- Move the uvm_anon_release() call outside of uvm_page_unbusy() and
assert for the different anon cases.

ok beck@, kettenis@

date 2023-05-13T13:35:17Z
author bluhm
files src/sys/net/if_bridge.c log diff annotate
src/sys/net/if_gre.c log diff annotate
src/sys/net/pf.c log diff annotate
src/sys/netinet/in.h log diff annotate
src/sys/netinet/ip_divert.c log diff annotate
src/sys/netinet/ip_output.c log diff annotate
src/sys/netinet/ipsec_input.c log diff annotate
message Instead of implementing IPv4 header checksum creation everywhere,
introduce in_hdr_cksum_out(). It is used like in_proto_cksum_out().
OK claudio@

date 2023-05-13T13:35:18Z
author bluhm
files src/sys/netinet/tcp_output.c log diff annotate
src/sys/netmpls/mpls_input.c log diff annotate
src/sys/netmpls/mpls_output.c log diff annotate
message Instead of implementing IPv4 header checksum creation everywhere,
introduce in_hdr_cksum_out(). It is used like in_proto_cksum_out().
OK claudio@

date 2023-05-13T16:27:59Z
author bluhm
files src/sys/netinet6/nd6.c log diff annotate
message Finally remove the kernel lock from IPv6 neighbor discovery. ND6
entries in rt_llinfo are protected either by exclusive netlock or
the ND6 mutex. The performance critical lookup path in nd6_resolve()
uses shared netlock, but is not lockless. In contrast to ARP it
grabs the mutex also in the common case.
tested by Hrvoje Popovski; with and OK kn@

date 2023-05-13T23:15:28Z
author dv
files src/sys/dev/vmm/vmm.c log diff annotate
src/sys/dev/vmm/vmm.h log diff annotate
message vmm(4)/vmd(8): switch to anonymous shared mappings.

While splitting out emulated virtio network and block devices into
separate processes, I originally used named mappings via shm_mkstemp(3).
While this functionally achieved the desired result, it had two
unintended consequences:

1) tearing down a vm process and its child processes required
excessive locking as the guest memory was tied into the VFS layer.

2) it was observed by mlarkin@ that actions in other parts of the
VFS layer could cause some of the guest memory to flush to storage,
possibly filling /tmp.

This commit adds a new vmm(4) ioctl dedicated to allowing a process
request the kernel share a mapping of guest memory into its own vm
space. This requires an open fd to /dev/vmm (requiring root) and
both the "vmm" and "proc" pledge(2) promises. In addition, the caller
must know enough about the original memory ranges to reconstruct them
to make the vm's ranges.

Tested with help from Mischa Peters.

ok mlarkin@

date 2023-05-14T01:46:53Z
author dlg
files src/sys/net/if.c log diff annotate
message give softnet threads unique names by suffixing softnet with their index.

ie, you'll see softnet0, softnet1, etc in top/ps/etc now instead
of just softnet on these threads.

this is done by wrapping the taskq and name up in a softnet struct.

ok patrick@ bluhm@ mvs@ kn@ sashan@

date 2023-05-14T18:34:02Z
author krw
files src/sys/dev/vnd.c log diff annotate
src/sys/dev/vndioctl.h log diff annotate
message Improve emulation of a disktab entry (-t) by using the type
specified in the disktab entry (:dt:) when setting the default
disklabel's d_type. This will enable installboot(8) to know the
vnd device should be treated as a floppy disk.

Feedback & improved field packing from millert@

date 2023-05-15T15:02:06Z
author kettenis
files src/sys/arch/arm64/arm64/trap.c log diff annotate
message Pass the ESR as the trapno value; this might help in determining the detailed
cause of a signal.

ok bluhm@, guenther@, deraadt@

date 2023-05-15T16:34:56Z
author bluhm
files src/sys/net/if.h log diff annotate
src/sys/net/pf.c log diff annotate
src/sys/netinet/ip_output.c log diff annotate
src/sys/netinet/tcp_output.c log diff annotate
src/sys/netinet/tcp_var.h log diff annotate
message Implement the TCP/IP layer for hardware TCP segmentation offload.
If the driver of a network interface claims to support TSO, do not
chop the packet in software, but pass it down to the interface
layer.
Precalculate parts of the pseudo header checksum, but without the
packet length. The length of all generated smaller packets is not
known yet. Driver and hardware will use the mbuf packet header
field ph_mss to calculate it and update checksum.
Introduce separate flags IFCAP_TSOv4 and IFCAP_TSOv6 as hardware
might support ony one protocol family. The old flag IFXF_TSO is
only relevant for large receive offload. It is missnamed, but keep
that for now.
Note that drivers do not set TSO capabilites yet. Also the ifconfig
flags and pseudo interfaces capabilities will be done separately.
So this commit should not change behavior.
heavily based on the work from jan@; OK sashan@

date 2023-05-15T16:34:57Z
author bluhm
files src/sys/netinet6/ip6_output.c log diff annotate
message Implement the TCP/IP layer for hardware TCP segmentation offload.
If the driver of a network interface claims to support TSO, do not
chop the packet in software, but pass it down to the interface
layer.
Precalculate parts of the pseudo header checksum, but without the
packet length. The length of all generated smaller packets is not
known yet. Driver and hardware will use the mbuf packet header
field ph_mss to calculate it and update checksum.
Introduce separate flags IFCAP_TSOv4 and IFCAP_TSOv6 as hardware
might support ony one protocol family. The old flag IFXF_TSO is
only relevant for large receive offload. It is missnamed, but keep
that for now.
Note that drivers do not set TSO capabilites yet. Also the ifconfig
flags and pseudo interfaces capabilities will be done separately.
So this commit should not change behavior.
heavily based on the work from jan@; OK sashan@

date 2023-05-16T14:32:54Z
author jan
files src/sys/dev/pci/if_ix.c log diff annotate
src/sys/net/if.c log diff annotate
src/sys/net/if.h log diff annotate
src/sys/net/if_aggr.c log diff annotate
src/sys/net/if_bridge.c log diff annotate
src/sys/net/if_tpmr.c log diff annotate
src/sys/net/if_veb.c log diff annotate
src/sys/net/if_vlan.c log diff annotate
src/sys/netinet/ip_carp.c log diff annotate
message Use separate IFCAPs for LRO and TSO.

This diff introduces separate capabilities for TCP offloading. We split this
into LRO (large receive offloading) and TSO (TCP segmentation offloading).
LRO can be turned on/off via tcprecvoffload option of ifconfig and is not
inherited to sub interfaces.

TSO is inherited by sub interfaces to signal this hardware offloading capability
to the network stack.

With tweaks from bluhm, claudio and dlg

ok bluhm, claudio

date 2023-05-16T19:36:00Z
author mvs
files src/sys/kern/uipc_domain.c log diff annotate
src/sys/netinet/in_proto.c log diff annotate
src/sys/netinet/ip_input.c log diff annotate
src/sys/sys/protosw.h log diff annotate
message Introduce temporary PR_MPSYSCTL flag to mark (*pr_sysctl)() handler MP
safe. We have may of them, so use flag instead of pushing kernel lock
within.

Unlock ip_sysctl(). Still take kernel lock within IPCTL_MRTSTATS case.
It looks like `mrtstat' protection is inconsistent, so keep locking as
it was. Since `mrtstat' are counters, it make sense to rework them into
per CPU counters with separate diffs.

Feedback and ok from bluhm@

date 2023-05-16T19:44:55Z
author mvs
files src/sys/sys/protosw.h log diff annotate
message Replace tab by space after #define in PR_* definitions.

ok bluhm@

date 2023-05-16T20:09:27Z
author mvs
files src/sys/kern/uipc_mbuf.c log diff annotate
message Always set maximum queue length to passed in the IFQCTL_MAXLEN case.
This is not the fast path, so dropping mq->mq_maxlen check doesn't
introduce any performance impact, but makes code MP consistent.

Discussed with and ok from bluhm@

date 2023-05-17T10:22:17Z
author dlg
files src/sys/net/toeplitz.h log diff annotate
message fix stoeplitz_hash_h32.

discussed with and ok tb@

date 2023-05-17T20:23:14Z
author patrick
files src/sys/sys/device.h log diff annotate
message Lenovo x13s requires a Qualcomm firmware file which is 13.7MB, so increase
the limit from 5MB to 15MB.

What does it contain? A full copy of Windows VM framework? For now, we
need it to read the battery status...

"go for it" deraadt@

date 2023-05-17T21:45:41Z
author kettenis
files src/sys/arch/arm64/arm64/cpu.c log diff annotate
message Tolerate difference in some of the features advertised by the
ID_AA64PFR0_EL1 register across cores. The CSV2/CSV3 features are handled
on a per-core basis so it is fine if they are different. And we only
support 64-bit userland so it is fine if the EL0/EL1/EL2/EL3 fields are
different too.

This prevents us from printing a warning on the Rockchip RK3588 SoC which
combines Cortex-A55 with Cortex-A76 that implement a sightly different
feature set.

ok deraadt@, mlarkin@

date 2023-05-17T22:12:51Z
author kettenis
files src/sys/kern/kern_sysctl.c log diff annotate
src/sys/sys/sysctl.h log diff annotate
message Implement battery management sysctl. This will provide a set of sysctls
to control the charging of laptop batteries:

* hw.battery.chargemode (int)

-1: force discharge
0: inhibit charge
1: auto

In auto mode charging may be controlled by:

* hw.battery.chargestop (int)

Percentage (0-100) of last full capacity at which the battery should
stop charging.

* hw.battery.chargestart (int)

Percentage (0-100) of last full capacity at which the battery should
start charging.

The idea is that with

hw.battery.chargemode=1
hw.battery.chargestop=80
hw.battery.chargestart=75

the battery would be kept charged within the range between 75% and 80%.

Allowable settings and some details of the behavior may differ between
hardware implementations.

Committing this early to easy testing of further diffs that implement this
functionality in acpithinkpad(4) and aplsmc(4).

ok kn@

date 2023-05-17T23:12:04Z
author patrick
files src/sys/dev/fdt/qcscm.c log diff annotate
message Add support for the Peripheral Authentication Service SMC interface.
These are used to authenticate and boot firmware images on the many
coprocessors embedded in Qualcomm SoCs.

ok kettenis@

date 2023-05-17T23:18:59Z
author patrick
files src/sys/arch/arm64/conf/GENERIC log diff annotate
src/sys/arch/arm64/conf/RAMDISK log diff annotate
message Add qcipcc(4), a driver for the inter-processor mailbox interface used
to inform (and get informed) of changes to shared memory state.

ok kettenis@

date 2023-05-17T23:19:00Z
author patrick
files src/sys/dev/fdt/files.fdt log diff annotate
src/sys/dev/fdt/qcipcc.c log diff annotate
message Add qcipcc(4), a driver for the inter-processor mailbox interface used
to inform (and get informed) of changes to shared memory state.

ok kettenis@

date 2023-05-17T23:25:45Z
author patrick
files src/sys/dev/ofw/ofw_misc.c log diff annotate
src/sys/dev/ofw/ofw_misc.h log diff annotate
message Add a framework for hardware locks.

ok kettenis@ drahn@

date 2023-05-17T23:30:58Z
author patrick
files src/sys/arch/arm64/conf/GENERIC log diff annotate
src/sys/arch/arm64/conf/RAMDISK log diff annotate
src/sys/dev/fdt/files.fdt log diff annotate
src/sys/dev/fdt/qcmtx.c log diff annotate
message Add qcmtx(4), a driver for the hardware spinlock on Qualcomm SoCs that
is used to synchronize access to the shared memory table between the
application cores we run on and the co-processors next to us.

ok kettenis@ drahn@

date 2023-05-18T08:22:37Z
author jan
files src/sys/dev/pci/if_ix.c log diff annotate
src/sys/dev/pci/ixgbe.h log diff annotate
src/sys/dev/pci/ixgbe_type.h log diff annotate
src/sys/netinet/tcp_var.h log diff annotate
message Use TSO offloading in ix(4).

With a lot of tweaks, improvements and testing from bluhm.

Thanks to Hrvoje Popovski from the University of Zagreb for
his great testing effort to make this happen.

ok bluhm

date 2023-05-18T09:59:43Z
author mvs
files src/sys/kern/uipc_domain.c log diff annotate
src/sys/netinet/in_proto.c log diff annotate
src/sys/netinet/ip_input.c log diff annotate
message Revert ip_sysctl() unlocking. Lock order issue was triggered in UVM
layer.

date 2023-05-18T09:59:44Z
author mvs
files src/sys/sys/protosw.h log diff annotate
message Revert ip_sysctl() unlocking. Lock order issue was triggered in UVM
layer.

date 2023-05-18T10:23:19Z
author mvs
files src/sys/kern/kern_sysctl.c log diff annotate
src/sys/kern/syscalls.master log diff annotate
src/sys/kern/uipc_domain.c log diff annotate
message Backout sysctl(2) unlocking. Lock order issue was triggered in UVM
layer.

date 2023-05-18T10:24:28Z
author mvs
files src/sys/kern/init_sysent.c log diff annotate
src/sys/kern/syscalls.c log diff annotate
src/sys/sys/syscall.h log diff annotate
src/sys/sys/syscallargs.h log diff annotate
message regen

date 2023-05-18T12:10:04Z
author sashan
files src/sys/net/if_pfsync.c log diff annotate
message sc_st_mtx is not sufficient protection to move state around
pfsync(4) queues. We also need to grab pf_state::mtx to put/remove
state instance safely from pfsync(4) queue. The issue has been
pointed out by bluhm@. Patch survived testing done by hrvoje@

OK dlg@

date 2023-05-18T14:11:18Z
author kn
files src/sys/net/pf_if.c log diff annotate
message Assert pf lock on interface handling

Make sure that all hooks into pf's internal list of interfaces do happen
with the pf lock held, i.e. nothing relies on the net lock alone, so that
later unlocking can then rely on it.

Full i386 regress (thanks bluhm) and daily usage are fine
OK sashan

date 2023-05-19T01:04:39Z
author guenther
files src/sys/netinet/tcp.h log diff annotate
message Move tcp_info structure to be under '#if __BSD_VISIBLE' to repair
compliance with POSIX/SUS restrictions on <netinet/tcp.h>

ok bluhm@
ports testing and ok sthen@

date 2023-05-19T01:12:23Z
author guenther
files src/sys/kern/kern_pledge.c log diff annotate
message Since waitid(2) shares code with wait4(2) and doesn't expose any
non-trivial new information or code-paths over wait4(), include
it in pledge("stdio")

discussed with deraadt@

date 2023-05-19T20:54:55Z
author patrick
files src/sys/dev/fdt/qcipcc.c log diff annotate
message Clear interrupt before executing the interrupt handler as we otherwise
risk losing an interrupt for the same pin. This can happen when a second
interrupt occurs between the interrupt handler's execution and us clearing
the interrupt.

ok kettenis@

date 2023-05-19T21:13:49Z
author patrick
files src/sys/arch/arm64/conf/GENERIC log diff annotate
src/sys/arch/arm64/conf/RAMDISK log diff annotate
src/sys/dev/fdt/files.fdt log diff annotate
src/sys/dev/fdt/qcsmem.c log diff annotate
message Add qcsmem(4), a driver for the shared memory table on Qualcomm SoCs
used to establish data communication channels with co-processors.

ok kettenis@ drahn@

date 2023-05-19T21:15:16Z
author patrick
files src/sys/arch/arm64/dev/mainbus.c log diff annotate
message Have mainbus attach nodes under /reserved-memory, so that qcsmem(4) shows
up.

ok kettenis@ drahn@

date 2023-05-19T21:26:09Z
author patrick
files src/sys/arch/arm64/conf/GENERIC log diff annotate
src/sys/arch/arm64/conf/RAMDISK log diff annotate
message Add qcsmptp(4), a driver to share 32-bit values between (co-)processors.

The inbound path is typically used as interrupt controller, e.g. to handle
handover and ready interrupts when a remoteproc boots. The outbound path
seems to be used to stop cores, but we don't do that yet.

ok kettenis@

date 2023-05-19T21:26:10Z
author patrick
files src/sys/dev/fdt/files.fdt log diff annotate
src/sys/dev/fdt/qcsmptp.c log diff annotate
message Add qcsmptp(4), a driver to share 32-bit values between (co-)processors.

The inbound path is typically used as interrupt controller, e.g. to handle
handover and ready interrupts when a remoteproc boots. The outbound path
seems to be used to stop cores, but we don't do that yet.

ok kettenis@