OpenBSD cvs log

created 2020-11-21T19:22:15Z
begin 2020-07-06T00:00:00Z
end 2020-07-07T00:00:00Z
path src/sys
commits 22

date 2020-07-06T03:56:51Z
author dlg
files src/sys/dev/kstat.c log diff annotate
src/sys/sys/kstat.h log diff annotate
message add kstat(4), a subsystem to let the kernel expose statistics to userland.

a kstat is an arbitrary chunk of data that a part of the kernel
wants to expose to userland. data could mean just a chunk of raw
bytes, but generally a kernel subsystem will provide a series of
kstat key/value chunks.

this code is loosely modelled on kstat in solaris, but with a bunch
of simplifications (we don't want to provide write support for
example). the named or key/value structure is significantly richer
in this version too. eg, ssolaris kstat named data supports integer
types, but this version offers differentiation between counters
(like the number of packets transmitted on an interface) and gauges
(like how long the transmit queue is) and lets kernel providers say
what the units are (eg, packets vs bytes vs cycles).

the main motivation for this is to improve the visibility of what
the kernel is doing while it's running. i wrote this as part of the
recent work we've been doing on multiqueue and rss/toeplitz so i
could verify that network load is actually spread across multiple
rings on a single nic. without this we would be wasting memory and
interrupt vectors on multiple rings and still just using the 1st
one, and noone would know cos there's no way to see what rings are
being used.

another thing that can become visible is the different counters
that various network cards provide. i'm particularly interested in
seeing if packets get dropped because the rings aren't filled fully,
which is an effect we've never really observed directly.

a small part of wanting this is cos i spend an annoying amount of
time instrumenting the kernel when hacking code in it. if most of
the scaffolding for the instrumentation is already there, i can
avoid repeatedly writing that code and save time.

iterated a few times with claudio@ and deraadt@

date 2020-07-06T04:09:46Z
author dlg
files src/sys/conf/files log diff annotate
message tell the kernel how to build kstat

it's like ksyms, but different

date 2020-07-06T04:11:26Z
author dlg
files src/sys/sys/conf.h log diff annotate
message kstat does open, close, and ioctl.

date 2020-07-06T04:32:25Z
author dlg
files src/sys/arch/alpha/alpha/conf.c log diff annotate
src/sys/arch/amd64/amd64/conf.c log diff annotate
src/sys/arch/arm/arm/conf.c log diff annotate
src/sys/arch/arm64/arm64/conf.c log diff annotate
src/sys/arch/hppa/hppa/conf.c log diff annotate
src/sys/arch/i386/i386/conf.c log diff annotate
src/sys/arch/landisk/landisk/conf.c log diff annotate
src/sys/arch/loongson/loongson/conf.c log diff annotate
src/sys/arch/luna88k/luna88k/conf.c log diff annotate
src/sys/arch/macppc/macppc/conf.c log diff annotate
src/sys/arch/octeon/octeon/conf.c log diff annotate
src/sys/arch/powerpc64/powerpc64/conf.c log diff annotate
src/sys/arch/sgi/sgi/conf.c log diff annotate
src/sys/arch/sparc64/sparc64/conf.c log diff annotate
message wire up kstat(4)

"looks right" deraadt@

date 2020-07-06T07:26:40Z
author kettenis
files src/sys/arch/powerpc64/powerpc64/pmap.c log diff annotate
message Fix pmap_pted_ro() such that it actually takes away PROT_EXEC when asked to
do so.

date 2020-07-06T10:35:42Z
author jsg
files src/sys/dev/usb/usbdevs log diff annotate
message add D-Link DWA-121 rev B1

from Miguel Landaeta

date 2020-07-06T10:36:19Z
author jsg
files src/sys/dev/usb/usbdevs.h log diff annotate
src/sys/dev/usb/usbdevs_data.h log diff annotate
message regen

date 2020-07-06T10:38:54Z
author jsg
files src/sys/dev/usb/if_urtwn.c log diff annotate
message match on D-Link DWA-121 rev B1

from Miguel Landaeta

date 2020-07-06T11:28:51Z
author stsp
files src/sys/dev/ic/ar5008.c log diff annotate
src/sys/dev/ic/athn.c log diff annotate
message Repair athn(4) in client mode against WPA2 access points.

Client mode was subtly broken after support for CCMP offload was added.

In client mode we should be using the first key table slot for our CCMP
pairwise key, not an arbitrary slot based on our association ID (as is
done in hostap mode).

When the interface came up again after being reset the CCMP hardware engine
was left in a non-working state. Apparently the key table was messed up or
contained stale entries. Fix a potential timing issue in the code path which
attempts to clear the key table on device power-up. For good measure, also
clear the key table before the device is powered down.

While here, fix off-by-ones in key table slot range checks.

Problems reported by Tim Chase, Kevin Chadwick, Austin Hook, Stefan Kapfhammer.

Fix tested by me on AR9280 (PCI) and AR9271 (USB) and Kevin Chadwick on AR9280

date 2020-07-06T13:33:06Z
author pirofti
files src/sys/arch/alpha/alpha/clock.c log diff annotate
src/sys/arch/alpha/include/timetc.h log diff annotate
src/sys/arch/amd64/amd64/tsc.c log diff annotate
src/sys/arch/amd64/include/timetc.h log diff annotate
src/sys/arch/amd64/isa/clock.c log diff annotate
src/sys/arch/arm/cortex/amptimer.c log diff annotate
src/sys/arch/arm/include/Attic/timetc.h log diff annotate
src/sys/arch/arm64/dev/agtimer.c log diff annotate
message Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@

date 2020-07-06T13:33:07Z
author pirofti
files src/sys/arch/arm64/include/timetc.h log diff annotate
src/sys/arch/armv7/include/timetc.h log diff annotate
src/sys/arch/armv7/omap/gptimer.c log diff annotate
src/sys/arch/armv7/sunxi/sxitimer.c log diff annotate
src/sys/arch/hppa/dev/clock.c log diff annotate
src/sys/arch/hppa/include/timetc.h log diff annotate
src/sys/arch/i386/include/timetc.h log diff annotate
src/sys/arch/i386/isa/clock.c log diff annotate
src/sys/arch/i386/pci/geodesc.c log diff annotate
src/sys/arch/i386/pci/gscpm.c log diff annotate
src/sys/arch/i386/pci/ichpcib.c log diff annotate
src/sys/arch/landisk/include/timetc.h log diff annotate
src/sys/arch/loongson/include/timetc.h log diff annotate
src/sys/arch/loongson/loongson/generic3a_machdep.c log diff annotate
src/sys/arch/luna88k/include/timetc.h log diff annotate
src/sys/arch/luna88k/luna88k/clock.c log diff annotate
src/sys/arch/m88k/include/Attic/timetc.h log diff annotate
src/sys/arch/macppc/include/timetc.h log diff annotate
message Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@

date 2020-07-06T13:33:08Z
author pirofti
files src/sys/arch/macppc/macppc/clock.c log diff annotate
src/sys/arch/mips64/include/timetc.h log diff annotate
src/sys/arch/mips64/mips64/mips64_machdep.c log diff annotate
src/sys/arch/octeon/include/timetc.h log diff annotate
src/sys/arch/octeon/octeon/machdep.c log diff annotate
src/sys/arch/powerpc/include/Attic/timetc.h log diff annotate
src/sys/arch/powerpc64/include/timetc.h log diff annotate
src/sys/arch/sgi/include/timetc.h log diff annotate
src/sys/arch/sgi/sgi/ip27_machdep.c log diff annotate
src/sys/arch/sgi/xbow/xheart.c log diff annotate
src/sys/arch/sh/include/Attic/timetc.h log diff annotate
src/sys/arch/sparc64/dev/psycho.c log diff annotate
src/sys/arch/sparc64/include/timetc.h log diff annotate
src/sys/arch/sparc64/sparc64/clock.c log diff annotate
src/sys/dev/acpi/acpihpet.c log diff annotate
src/sys/dev/acpi/acpitimer.c log diff annotate
message Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@

date 2020-07-06T13:33:09Z
author pirofti
files src/sys/dev/pci/amdpm.c log diff annotate
src/sys/dev/pci/viapm.c log diff annotate
src/sys/dev/pv/hyperv.c log diff annotate
src/sys/dev/pv/pvclock.c log diff annotate
src/sys/kern/exec_elf.c log diff annotate
src/sys/kern/kern_exec.c log diff annotate
src/sys/kern/kern_tc.c log diff annotate
src/sys/sys/exec_elf.h log diff annotate
src/sys/sys/proc.h log diff annotate
src/sys/sys/time.h log diff annotate
src/sys/sys/timetc.h log diff annotate
src/sys/uvm/uvm_unix.c log diff annotate
message Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@

date 2020-07-06T14:50:19Z
author jsg
files src/sys/dev/pci/drm/drm_fb_helper.c log diff annotate
message defer access of fb_info pointer in drm_fb_helper_hotplug_event()

Fixes a regression from rev 1.24 which lead to a page fault reported by
Martin Ziemer. ok stsp@

date 2020-07-06T15:18:03Z
author kettenis
files src/sys/arch/arm/arm/openprom.c log diff annotate
src/sys/arch/arm64/arm64/openprom.c log diff annotate
src/sys/arch/octeon/octeon/openprom.c log diff annotate
src/sys/dev/ofw/fdt.c log diff annotate
src/sys/dev/ofw/openfirm.h log diff annotate
message IEEE1275 (Open Firmware) defines that parameter name strings can have a
length of up to 31 characters. This limit is also present in the
flattened device tree specification/ Unfortunately this limit isn't enforced
by the tooling and there are systems in the wild that use longer strings.
This includes the device trees used on POWER9 systems and has been seen
on some ARM systems as well.

So bump the buffer size from 32 bytes (31 + terminating NUL) to 64 bytes.
Centrally define OFMAXPARAM to this value (in <dev/ofw/openfirm.h>)
replacing the various OPROMMAXPARAM definition scattered around the tree
to make sure the FDT implementation of OF_nextprop() uses the same
buffer size as its consumers.

Eliminate the static buffer in various openprom(4) implementations on
FDT systems.

Makes it possible to dump the full device tree on POWER9 systems using
eeprom -p.

ok deraadt@, visa@

date 2020-07-06T15:18:04Z
author kettenis
files src/sys/arch/powerpc64/powerpc64/openprom.c log diff annotate
message IEEE1275 (Open Firmware) defines that parameter name strings can have a
length of up to 31 characters. This limit is also present in the
flattened device tree specification/ Unfortunately this limit isn't enforced
by the tooling and there are systems in the wild that use longer strings.
This includes the device trees used on POWER9 systems and has been seen
on some ARM systems as well.

So bump the buffer size from 32 bytes (31 + terminating NUL) to 64 bytes.
Centrally define OFMAXPARAM to this value (in <dev/ofw/openfirm.h>)
replacing the various OPROMMAXPARAM definition scattered around the tree
to make sure the FDT implementation of OF_nextprop() uses the same
buffer size as its consumers.

Eliminate the static buffer in various openprom(4) implementations on
FDT systems.

Makes it possible to dump the full device tree on POWER9 systems using
eeprom -p.

ok deraadt@, visa@

date 2020-07-06T15:47:41Z
author kettenis
files src/sys/arch/powerpc64/include/pmap.h log diff annotate
message Hide most of the contents behind #ifdef _KERNEL. Reorganize the file a
bit to achieve this with a single #ifdef/#endif pair.

date 2020-07-06T17:43:23Z
author kettenis
files src/sys/arch/powerpc64/include/signal.h log diff annotate
src/sys/arch/powerpc64/powerpc64/machdep.c log diff annotate
message Save and restore FPU around signal handlers.

date 2020-07-06T19:22:40Z
author deraadt
files src/sys/uvm/uvm_map.c log diff annotate
message fix spelling

date 2020-07-06T20:28:38Z
author mvs
files src/sys/net/pipex.c log diff annotate
message pipex_rele_session() frees memory pointed by `old_session_keys'. Use it in
pipex_destroy_session() instead of pool_put(9) to prevent memory leak.

ok mpi@

date 2020-07-06T20:37:51Z
author mvs
files src/sys/net/if_pppx.c log diff annotate
src/sys/net/pipex.c log diff annotate
src/sys/net/pipex.h log diff annotate
src/sys/net/pipex_local.h log diff annotate
message Protect the whole pipex(4) layer by NET_LOCK(). pipex(4) was
simultaneously protected by KERNEL_LOCK() and NET_LOCK() and now we have
the only lock for it. This step reduces locking mess in this layer.

ok mpi@

date 2020-07-06T21:41:56Z
author kettenis
files src/sys/kern/kern_exec.c log diff annotate
message Wire down the timekeep page. If we don't do this, the pagedaemon may
page it out and bad things will happen when we try to page it back in
from within the clock interrupt handler.

While there, make sure we set timekeep_object back to NULL if we fail
to make the timekeep page into kernel space.

ok deraadt@ (who had a very similar diff)