OpenBSD cvs log

created 2023-08-09T09:10:26Z
begin 2022-11-22T00:00:00Z
end 2022-11-29T00:00:00Z
path src/sys
commits 53

date 2022-11-22T03:40:53Z
author dlg
files src/sys/net/ifq.c log diff annotate
src/sys/net/ifq.h log diff annotate
message count how many times ifiqs enqueue and dequeue packets.

network cards try to enqueue a list of packets on an ifiq once per
interrupt and ifiqs already count how many packets they're handling.
this let's us see how well interrupt mitigation is working on a
ring or interface. ifiqs are supposed to provide backpressure
signalling to a driver if it enqueues a lot more work than it's
able to process in softnet, so recording dequeues let's us see this
ratio.

date 2022-11-22T06:48:32Z
author jmatthew
files src/sys/dev/pci/if_mcx.c log diff annotate
message Allocate additional command queue slots and use command completion events
to run commands where we can sleep while waiting. Rather than actually
using it as a queue, just allocate the slots to particular uses.
The first slot is used for polled commands (anything run while cold),
then there's one for general ioctls, one for kstat reads, and one for
link operations. Since we can sleep while waiting now, we need to serialize
access to the command slots. This is done with rwlocks for the ioctl and
kstat slots, and link slot is only used from a single instance task.
This also means we don't need to hold the kernel lock while doing kstat
reads.

Using interrupt based command completion drops the time taken to read all
the kstats off mcx interfaces from tens of milliseconds to almost nothing,
which is a pretty big win when you're reading them every few seconds on
busy firewalls.

ok dlg@

date 2022-11-22T14:51:01Z
author kn
files src/sys/netinet6/in6.c log diff annotate
src/sys/netinet6/in6_var.h log diff annotate
src/sys/netinet6/nd6.h log diff annotate
message Remove useless struct in6_ifextra

in6_var.h r1.75 removed all other struct members.

Now It only contains a single struct nd_ifinfo pointer, so address family
specific data might as well be just that.

ND_IFINFO() is the only way nd6_nbr.c and nd6.c access this data, there is
no other usage of if_afdata[].

One allocation and unhelpful indirection less per interface.

All under _KERNEL.

OK claudio

date 2022-11-22T15:49:06Z
author kn
files src/sys/netinet6/in6.c log diff annotate
message Use local variable consistently

All prior lines in this function already use it, do so on the last one.

OK claudio

date 2022-11-22T19:28:29Z
author kn
files src/sys/netinet6/in6.c log diff annotate
src/sys/netinet6/in6_var.h log diff annotate
src/sys/netinet6/nd6.h log diff annotate
message Backout "Remove useless struct in6_ifextra" commit

I committed the wrong iteration of this diff, sorry for the noise.

date 2022-11-22T22:28:40Z
author sashan
files src/sys/net/pf_if.c log diff annotate
message Interface tables (a.k.a. kif) in pf(4) are currently protected
by NET_LOCK() only. This change makes them protected by PF_LOCK().
Having this change in tree will allow us to remove NET_LOCK()
protection from ioctl(2) code path in pf(4).

OK dlg@, kn@

date 2022-11-23T07:57:39Z
author kn
files src/sys/netinet6/in6.c log diff annotate
src/sys/netinet6/in6_var.h log diff annotate
src/sys/netinet6/nd6.h log diff annotate
message Recommit previous "Remove useless struct in6_ifextra"

This was the right diff after all, I just confused myself between trees.

OK bluhm
---
Remove useless struct in6_ifextra

in6_var.h r1.75 removed all other struct members.

Now It only contains a single struct nd_ifinfo pointer, so address family
specific data might as well be just that.

ND_IFINFO() is the only way nd6_nbr.c and nd6.c access this data, there is
no other usage of if_afdata[].

One allocation and unhelpful indirection less per interface.

All under _KERNEL.

OK claudio

date 2022-11-23T08:05:49Z
author kn
files src/sys/netinet6/nd6.c log diff annotate
message ND_IFINFO() cannot be NULL, use inline read-only idiom for clarity

ND_IFINFO() always points at a valid struct nd_ifinfo; ND6_LLINFO_DELAY
checks for NULL, while other cases in nd6_llinfo_timer() dereference it
unconditionally.

Inline all three per-case read-only usages rather than having one hoisted
*ndi pointer which could be used to write.

nd6_nbr.c already uses this `ND_IFINFO(ifp)->retrans' idiom which makes it
immediately clear that data is only read.

OK bluhm

date 2022-11-23T11:00:27Z
author mbuhl
files src/sys/kern/exec_elf.c log diff annotate
src/sys/kern/kern_exec.c log diff annotate
src/sys/sys/proc.h log diff annotate
message cache ps_auxinfo inside the kernel, to avoid codedump() reading the
copy on userland stack which points at an illicit region.
ok kettenis, deraadt

date 2022-11-23T14:48:27Z
author kn
files src/sys/net/if.c log diff annotate
src/sys/net/if_var.h log diff annotate
message Add *if_nd to struct ifnet, call nd6_if{at,de}tach() directly

*if_afdata[] and struct domain's dom_if{at,de}tach() are only used with
IPv6 Neighbour Discovery in6_dom{at,de}tach(), which allocate/init and
free single struct nd_ifinfo.

Set up a new ND-specific *if_nd member directly to avoid yet another
layer of indirection and thus make the generic domain API obsolete.

The per-interface data is only accessed in nd6.c and nd6_nbr.c through
the ND_IFINFO() macro; it is allocated and freed exactly once during
interface at/detach, so document it as [I]mmutable.

OK bluhm mvs claudio

date 2022-11-23T14:48:28Z
author kn
files src/sys/netinet6/in6.c log diff annotate
src/sys/netinet6/in6_proto.c log diff annotate
src/sys/netinet6/nd6.h log diff annotate
message Add *if_nd to struct ifnet, call nd6_if{at,de}tach() directly

*if_afdata[] and struct domain's dom_if{at,de}tach() are only used with
IPv6 Neighbour Discovery in6_dom{at,de}tach(), which allocate/init and
free single struct nd_ifinfo.

Set up a new ND-specific *if_nd member directly to avoid yet another
layer of indirection and thus make the generic domain API obsolete.

The per-interface data is only accessed in nd6.c and nd6_nbr.c through
the ND_IFINFO() macro; it is allocated and freed exactly once during
interface at/detach, so document it as [I]mmutable.

OK bluhm mvs claudio

date 2022-11-23T14:50:59Z
author kn
files src/sys/net/if.c log diff annotate
src/sys/net/if_var.h log diff annotate
src/sys/sys/domain.h log diff annotate
message Remove unused struct ifnet's *if_afdata[] and struct domain's dom_if{at,de}tach()

Both made obsolete through struct ifnet's previous *if_nd addition.

IPv6 Neighbour Discovery handles per-interface data directly, nothing
else uses this generic domain API anymore.

Outside of _KERNEL, but nothing in base uses them, either.

OK bluhm mvs claudio

date 2022-11-23T15:12:27Z
author mvs
files src/sys/net/if_pflow.c log diff annotate
src/sys/net/if_pflow.h log diff annotate
message Make `so' dereference safe within pflow_output_process().

sosend() has sleep points, so the kernel lock serialisation within
pflow_output_process() doesn't work as expected. The pflow(4) interface
associated socket `so' could be overwritten by concurrent pflowioctl()
thread.

Introduce pflow(4) interface's `sc_lock' rwlock(9) to make `so'
dereference safe. Since the solock() of udp(4) sockets uses netlock as
backend, the `sc_lock' should be taken first. This expands a little
netlock relocking within pflowioctl().

pflow_sendout_mbuf() called by pflow_output_process(), now called
without kernel lock held, so the mp safe counters_pkt(9) used instead
of manual `if_opackets' increment.

Since if_detach() does partial ifnet destruction, now it can't be called
before we finish pflow_output_process() task, otherwise we introduce use
after free for interface counters. In other hand, we need to deny
pflowioctl() to reschedule pflow_output_process() task. The `sc_dyind'
flag introduced for that.

Tested by Hrvoje Popovski.

ok bluhm@

date 2022-11-23T16:57:37Z
author kn
files src/sys/net/if.c log diff annotate
src/sys/netinet6/nd6.c log diff annotate
src/sys/netinet6/nd6.h log diff annotate
message Let nd6_if{at,de}tach() be void and take an ifp argument

Do it like the rest of at/detach routines which modify a struct ifnet
pointer without returning anything.

OK mvs

date 2022-11-23T16:59:10Z
author kn
files src/sys/netinet6/nd6.c log diff annotate
src/sys/netinet6/nd6.h log diff annotate
src/sys/netinet6/nd6_nbr.c log diff annotate
message Inline useless ND_IFINFO() macro

A single cast-free struct pointer dereference needs no indirection.
ND_IFINFO() is under _KERNEL.

OK mvs

date 2022-11-23T19:34:59Z
author kn
files src/sys/netinet6/nd6.h log diff annotate
message Remove unused struct prf_ra; dead since 2017 sys/netinet/icmp6.h r1.45

Get rid of ICMPV6CTL_ND6_DRLIST and ICMPV6CTL_ND6_PRLIST sysctls
With this we can also get rid of in6_prefix and in6_defrouter. They
are meaningless, the kernel no longer tracks this information.

Outside of _KERNEL, but nothing in base uses it, either.
codesearch.debian.net seems to agree.

OK mvs claudio bluhm

date 2022-11-23T19:35:18Z
author kn
files src/sys/netinet6/nd6.h log diff annotate
message Remove unused struct in6_ndifreq; dead since 2013 sys/netinet6/in6_var.h r1.37

Remove unused code manipulating a default interface and its index
This is a leftover from the on-link assumption behavior removal,
which has been deprecated by RFC4861 anyway.

Outside of _KERNEL, but nothing in base uses it, either.
codesearch.debian.net seems to agree.

OK mvs claudio bluhm

date 2022-11-23T19:35:42Z
author kn
files src/sys/netinet6/nd6.h log diff annotate
message Remove unused NDPRF_* defines; dead since 2017 sys/netinet6/nd6.c r1.210

Remove sending of router solicitations and processing of router
advertisements from the kernel. It's handled by slaacd(8) these days.

Outside of _KERNEL, but nothing in base uses it, either.
codesearch.debian.net seems to agree.

OK mvs claudio bluhm

date 2022-11-23T23:43:08Z
author kettenis
files src/sys/dev/fdt/files.fdt log diff annotate
src/sys/dev/fdt/pwmleds.c log diff annotate
message Add pwmleds(4), a driver for PWM controlled LEDs.
For now this only implements keyboard backlight support.

ok kn@

date 2022-11-24T00:04:32Z
author mvs
files src/sys/net/pfvar_priv.h log diff annotate
message Remove netlock assertion within PF_LOCK(). The netlock should be taken
first, but only if both locks are taken.

ok dlg@ sashan@

date 2022-11-24T04:04:39Z
author jmatthew
files src/sys/dev/acpi/acpimadt.c log diff annotate
src/sys/dev/acpi/acpireg.h log diff annotate
message Don't report unknown apic structure types if they're in the OEM reserved
range (0x80 to 0xff). We're not going to understand OEM specific
structures, and some machines such as the Dell R6515 have significant
numbers of them.

ok kettenis@

date 2022-11-24T14:36:07Z
author kettenis
files src/sys/arch/arm64/include/armreg.h log diff annotate
message Document a few more ID register bits. This should add most of the stuff
in ARMv8.5 as far as the ISAR and PFR registers are concerned.

ok deraadt@

date 2022-11-24T14:43:16Z
author kettenis
files src/sys/arch/arm64/arm64/cpu.c log diff annotate
src/sys/arch/arm64/arm64/machdep.c log diff annotate
src/sys/arch/arm64/include/cpu.h log diff annotate
message Expose the complete set of ID registers as defined in the current version
of ARMv8/ARMv9. Make sure we only expose the features that we know about
and support in our kernel. This matches what Linux does. For now, mostly
restrict ourselves to features defined in ARMv8.5 which means that we only
actually implement support for ID_AA64ISAR0_EL1, ID_AA64ISAR1_EL1,
ID_AA64PFR0_EL1 and ID_AA64PFR1_EL1. For the other registers we simply
always return 0.

ok deraadt@

date 2022-11-25T03:20:09Z
author dlg
files src/sys/dev/ic/nvme.c log diff annotate
message nvme can do 64bit dma.

ok jmatthew@

date 2022-11-25T03:45:39Z
author dlg
files src/sys/net/pf.c log diff annotate
message get rid of NET_LOCK in the pf purge work

pf purge was moved to systqmp (to get it away from KERNEL_LOCK)
which is also used as the backend for things like intr_barrier and
sched_barrier. it is common for network cards to call intr_barrier
while holding NET_LOCK, and if pf is trying to get the NET_LOCK in
the purge tasks that are now running in systqmp, it's a deadlock.
bluhm@ hit this exact issue.

sashan@ has been working to get rid of the need for NET_LOCK in pf,
so now we can remove the NET_LOCKs here rather than create a pf
specific taskq to run these tasks in.

ok sashan@ bluhm@

date 2022-11-25T15:03:24Z
author kn
files src/sys/netinet6/nd6.c log diff annotate
message Revert hunk accidentially committed in r1.248 "Clarify/typofix comments"

date 2022-11-25T18:03:53Z
author kettenis
files src/sys/net/pf.c log diff annotate
message Revert previous commit. It was not properly tested and produces splassert
warnings. Rushing to pile more stuff on top of it isn't the answer. This
needs a rethink.

ok deraadt@

date 2022-11-25T20:27:53Z
author bluhm
files src/sys/net/pf.c log diff annotate
src/sys/net/pf_ioctl.c log diff annotate
src/sys/net/pfvar.h log diff annotate
src/sys/net/pfvar_priv.h log diff annotate
message revert pf.c r1.1152 again: move pf_purge out from under the kernel lock

Using systqmp for pf_purge creates a deadlock between pf_purge()
and ixgbe_stop() and possibly other drivers. On systqmp pf(4) needs
netlock which the interface ioctl(2) is holding. ix(4) waits in
sched_barrier() which is also scheduled on the systqmp task queue.

Removing the netlock from pf_purge() as a quick fix caused other
problems.

backout suggested by deraadt@

date 2022-11-25T20:33:11Z
author tobhe
files src/sys/arch/arm64/dev/aplsmc.c log diff annotate
message Disable screen backlight on Apple silicon laptops when lid is closed.

ok kettenis@

date 2022-11-26T06:20:18Z
author anton
files src/sys/dev/wscons/wsdisplay.c log diff annotate
message While emulating the bell, wsdisplay could end up sleeping when reaching
down to wsmux. This does not work since we're in interrupt context, as
pointed out by witness.

Instead, defer the work to a task which in turn will execute in process
context.

Problem reported by beck@

ok visa@

date 2022-11-26T06:26:14Z
author anton
files src/sys/dev/usb/uhidpp.c log diff annotate
message Rename type argument to buf in hidpp10_get_type(), no functional change.

date 2022-11-26T06:26:51Z
author anton
files src/sys/dev/usb/uhidpp.c log diff annotate
message Stop printing the device serial number during attach, it's not that
useful after all.

date 2022-11-26T06:27:48Z
author anton
files src/sys/dev/usb/uhidpp.c log diff annotate
message Reduce indentation, no functional change.

date 2022-11-26T06:28:08Z
author anton
files src/sys/dev/usb/uhidpp.c log diff annotate
message Take note of the needed feature indices already in
uhipp_device_features().

date 2022-11-26T06:28:34Z
author anton
files src/sys/dev/usb/uhidpp.c log diff annotate
message Pass a uhidpp_device to hidpp20_battery_get_capability() and
hidpp20_battery_get_level_status().

date 2022-11-26T06:28:50Z
author anton
files src/sys/dev/usb/uhidpp.c log diff annotate
message Group function and response defines.

date 2022-11-26T06:29:07Z
author anton
files src/sys/dev/usb/uhidpp.c log diff annotate
message Stop checking the link status upon receiving connect notifications as
the Bolt receiver uses another bit for this which I haven't been able to
identify.

date 2022-11-26T06:29:24Z
author anton
files src/sys/dev/usb/uhidpp.c log diff annotate
message Pave the way for checking presence of more features in
uhidpp_device_features().

date 2022-11-26T06:29:50Z
author anton
files src/sys/dev/usb/uhidpp.c log diff annotate
message Shove more battery feature logic down to hidpp20_battery_get_level_status().
In preparation for supporting the unified battery feature.

date 2022-11-26T06:30:08Z
author anton
files src/sys/dev/usb/uhidpp.c log diff annotate
message Remove unused battery fields.

date 2022-11-26T09:05:32Z
author kettenis
files src/sys/arch/arm64/conf/GENERIC log diff annotate
message Enable aplpwm(4) and pwmleds(4).

date 2022-11-26T17:23:15Z
author tobhe
files src/sys/arch/arm64/arm64/acpi_machdep.c log diff annotate
src/sys/arch/arm64/arm64/machdep.c log diff annotate
src/sys/arch/arm64/dev/aplsmc.c log diff annotate
src/sys/arch/arm64/include/cpu.h log diff annotate
message Add arm64 lid_action sysctl for Apple Silicon laptops.

ok kettenis@

date 2022-11-26T17:50:26Z
author mvs
files src/sys/net/if_pppx.c log diff annotate
message Next step of netlock pressure decreasing in pppx(4).

The kernel lock is still taken when we access pppx(4) layer through
device node. Since pipex(4) layer doesn't rely on netlock anymore, and we
don't acquire it when we access pipex(4) from pppx(4) layer, kernel lock
is enough to protect pppx(4) data. Such data doesn't accessed from packet
processing path, so there is no reason to block it by netlock acquiring.

Assume kernel lock as protection for `pxd_pxis' lists and `pppx_ifs' tree.
The search in `pppx_ifs' tree has no context switch. There is no context
switch between the `pxi' free unit search and tree insertion.

Use reference counters to make `pxi' dereference safe, instead of holding
netlock. Now pppx_if_find() returns `pxi' with reference counter bumped,
and newly introduced pppx_if_rele() used for release this `pxi'.

Introduce pppx_if_find_locked() which returns `pxi' but doesn't bump
reference counter. pppx_if_find_locked() and pppx_if_find() both called
with kernel lock held, but keep existing notation where _locked()
function returned data with non bumped counter.

Mark dying `pxi' by setting `pxi_ready' to null, so concurrent thread
can't receive it by pppx_if_find().

The netlock is left around modification of associated ifnet's
`if_description'. This is unwanted because `if_description' never accessed
within packet processing path, but this require ifnet locking
modification, so keep this to the following diffs.

ok bluhm@

date 2022-11-26T17:51:18Z
author mvs
files src/sys/kern/uipc_usrreq.c log diff annotate
src/sys/sys/unpcb.h log diff annotate
message Merge uipc_bind() with unp_bind(). Unlike other unp_*() functions,
unp_bind() has the only uipc_bind() caller. In the uipc_usrreq() times,
it made sense to have dedicated unp_bind() for prevent tne code mess
within giant switch(), but now it doesn't.

ok bluhm@

date 2022-11-26T17:52:35Z
author mvs
files src/sys/sys/protosw.h log diff annotate
src/sys/sys/socketvar.h log diff annotate
message Turn sowriteable(), sballoc() and sbfree() macro to inline functions.

soreadable() is already presented as inline function, but corresponding
sowriteable() is still macro. Also it's no reason to keep sballoc() and
sbfree() as macro.

The first argument of sballoc() and sbfree() is not used, but keep it for
a while.

ok kn@ bluhm@

date 2022-11-26T21:35:22Z
author kettenis
files src/sys/arch/arm64/dev/apldma.c log diff annotate
message Adjust for changes in the device tree bindings. Since it is relatively
easy to support both the "official" and "preliminary" bindings, we support
both. Support for the "preliminary" bindings will be removed at some point
in the future.

ok tobhe@

date 2022-11-27T15:31:36Z
author kn
files src/sys/netinet6/nd6_nbr.c log diff annotate
message Remove useless casts

All *dp variables are of type 'struct dadq *'; no object change.

OK mvs

date 2022-11-27T22:04:59Z
author kettenis
files src/sys/dev/fdt/dwpcie.c log diff annotate
message Implement support for the (optional) MSI controller of Synopsys Designware
PCIe host bridge. This MSI controller is quite retarded since it maps all
MSIs to a single hardware interrupt. So it doesn't really offer any
benefit over using classic INTx interrupts. Unfortunately we need to use
it on Amlogic SoCs since the PCIe device interrupt doesn't seem to work
correctly when configured as a level triggered interrupt and the workaround
of configuring it as an edge triggered interrupt causes problems when using
multiple disks connected to ahci(4) on the ODROID-HC4.

ok patrick@

date 2022-11-27T22:55:31Z
author kn
files src/sys/dev/pci/pci.c log diff annotate
message Remove last queue(3) *_END() usage from tree

queue(3) NOTES says they're deprecated and expand to NULL; indeed.

No object change.
OK kettenis mvs

date 2022-11-28T13:08:53Z
author kn
files src/sys/netinet6/nd6_nbr.c log diff annotate
message Statically initialise DAD list, remove obsolete dad_init

The list of IPv6 addresses to perfom Duplicate Address Detection on is
local to nd6_nbr.c; statically initialise it so `dad_init' can go.

nd6_dad_find() keeps returning NULL on an initialised but empty list,
so nd6_dad_stop() keeps returning early.

Feedback OK mvs

date 2022-11-28T13:10:58Z
author kn
files src/sys/netinet6/nd6.c log diff annotate
message Remove useless nd6_init_done

Only ip6_init() calls nd6_init(), exactly once, just like it calls
frag6_init() which on the other hand does not have some fra6_init_done to
guard against itself.

Like all other domains, ip6_init() is called in domaininit(), early in the
kernel's main().

This variable was probably never useful and stems from nd6.c r1.1:
bring in KAME IPv6 code, dated 19991208.

OK mvs

date 2022-11-28T19:13:36Z
author kn
files src/sys/netinet6/nd6.c log diff annotate
src/sys/netinet6/nd6.h log diff annotate
message Document struct nd_ifinfo protection, remove obsolete .initialized member

All access to struct ifnet's member *if_nd is read-only, with the one
write exception being nd6_slowtimo() updating ND information.

IPv6 Neighbour Discovery information is fully protected by the net lock.
---
nd6_ifattach() allocates and unconditionally initialises struct ifnet's
*if_nd member, so early in if_attachsetup() that there is no way to query
unitialised Neighour Unreachable Detection bits.

Only SIOCGIFINFO_IN6 through ndp(8) used the .initialized member:
Added/set since 2002 sys/netinet6/nd6.c r1.42
attach nd_ifinfo structure to if_afdata.
split IPv6 MTU (advertised by RA) from real link MTU.
sync with kame

Read since 2002 usr.sbin/ndp/ndp.c r1.16
use new SIOCGIFINFO_IN6. random other cleanups. sync w/kame.

Obsolete since 2017 sys/netinet6/nd6.c r1.217
usr.sbin/ndp/ndp.c r1.85
Remove knob and always do neighbor unreachable detection.

Feedback OK bluhm

date 2022-11-28T21:39:28Z
author mvs
files src/sys/kern/uipc_socket.c log diff annotate
message Simplify return path of (*pr_ctloutput)() return value in sogetopt().

ok guenther@ kn@