OpenBSD cvs log

created 2020-12-01T16:24:27Z
begin 2020-10-15T00:00:00Z
end 2020-10-16T00:00:00Z
path src/sys
commits 20

date 2020-10-15T00:01:24Z
author krw
files src/sys/dev/ic/aac.c log diff annotate
src/sys/dev/ic/ami.c log diff annotate
src/sys/dev/ic/cac.c log diff annotate
src/sys/dev/ic/gdt_common.c log diff annotate
src/sys/dev/ic/twe.c log diff annotate
message Replace local *_copy_internal_data() with scsi_copy_internal_data().

date 2020-10-15T00:13:47Z
author krw
files src/sys/dev/softraid.c log diff annotate
message Replace sr_copy_internal_data() with scsi_copy_internal_data().

date 2020-10-15T01:37:29Z
author jsg
files src/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c log diff annotate
message drm/amdgpu: move discovery gfx config fetching

From Alex Deucher
6ba57b7a8f94fcf3df6883db362642a0075d185b in mainline linux

date 2020-10-15T01:42:55Z
author jsg
files src/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c log diff annotate
message drm/amdgpu: move gpu_info parsing after common early init

From Alex Deucher
6e29c227a4976460ec6d4cc70b998e3a8c30c873 in mainline linux

needed to load the correct gpu info firmware on raven2
(Ryzen 3 3200U/Ryzen 3 3250U/Athlon 300U/Athlon 3000G)

date 2020-10-15T03:13:59Z
author deraadt
files src/sys/ddb/db_break.c log diff annotate
message sick of the CMU, let's make this KNF

date 2020-10-15T03:14:00Z
author deraadt
files src/sys/ddb/db_command.c log diff annotate
src/sys/ddb/db_ctf.c log diff annotate
src/sys/ddb/db_elf.c log diff annotate
src/sys/ddb/db_expr.c log diff annotate
src/sys/ddb/db_hangman.c log diff annotate
src/sys/ddb/db_input.c log diff annotate
src/sys/ddb/db_lex.c log diff annotate
src/sys/ddb/db_output.c log diff annotate
src/sys/ddb/db_run.c log diff annotate
src/sys/ddb/db_sym.c log diff annotate
src/sys/ddb/db_var.h log diff annotate
src/sys/ddb/db_variables.c log diff annotate
src/sys/ddb/db_watch.c log diff annotate
message sick of the CMU, let's make this KNF

date 2020-10-15T04:28:42Z
author cheloha
files src/sys/kern/kern_exec.c log diff annotate
src/sys/kern/kern_exit.c log diff annotate
message _exit(2), execve(2): cancel per-process interval timers safely

During _exit(2) and sometimes during execve(2) we need to cancel any
active per-process interval timers. We don't currently do this in an
MP-safe way. Both syscalls ignore the locking assumptions documented
in proc.h.

The easiest way to make them MP-safe is to use setitimer(), just like
the getitimer(2) and setitimer(2) syscalls do. To make things a bit
cleaner I have added a helper function, cancelitimer(), so the callers
don't need to fuss with an itimerval struct.

While we're here we can remove the splclock/splx dance from execve(2).
It is no longer necessary.

ok deraadt@

date 2020-10-15T04:28:43Z
author cheloha
files src/sys/kern/kern_time.c log diff annotate
src/sys/sys/time.h log diff annotate
message _exit(2), execve(2): cancel per-process interval timers safely

During _exit(2) and sometimes during execve(2) we need to cancel any
active per-process interval timers. We don't currently do this in an
MP-safe way. Both syscalls ignore the locking assumptions documented
in proc.h.

The easiest way to make them MP-safe is to use setitimer(), just like
the getitimer(2) and setitimer(2) syscalls do. To make things a bit
cleaner I have added a helper function, cancelitimer(), so the callers
don't need to fuss with an itimerval struct.

While we're here we can remove the splclock/splx dance from execve(2).
It is no longer necessary.

ok deraadt@

date 2020-10-15T07:49:55Z
author mpi
files src/sys/kern/sched_bsd.c log diff annotate
message Stop asserting that the NET_LOCK() shouldn't be held in yield().

This create too many false positive when setting pool_debug=2.

Prodded by deraadt@, ok mvs@

date 2020-10-15T10:04:39Z
author jsg
files src/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c log diff annotate
message don't print pci ids when amdgpu attaches

Print asic name, rev and number of compute units.
Suggested by and ok kettenis@

date 2020-10-15T10:08:36Z
author jsg
files src/sys/dev/pci/drm/radeon/radeon_device.c log diff annotate
message don't print pci ids when radeondrm attaches

date 2020-10-15T10:36:53Z
author jsg
files src/sys/dev/pci/drm/amd/amdgpu/psp_v12_0.c log diff annotate
src/sys/dev/pci/drm/amd/amdgpu/psp_v3_1.c log diff annotate
message consistently use dev_info() for sos fw version messages
noticed in renoir dmesg

date 2020-10-15T11:30:08Z
author krw
files src/sys/dev/pv/xbf.c log diff annotate
message Nuke commented out variable declaration.

date 2020-10-15T13:22:12Z
author krw
files src/sys/arch/sparc64/dev/vdsk.c log diff annotate
message Replace simple one-line bcopy()/memcpy() of faked data into scsi_xfer with call
to scsi_copy_internal_data(). Thus getting xs->resid properly set and adding the
usual uio/size sanity checks.

date 2020-10-15T13:22:13Z
author krw
files src/sys/dev/ata/atascsi.c log diff annotate
src/sys/dev/ic/nvme.c log diff annotate
src/sys/dev/pci/ips.c log diff annotate
src/sys/dev/pv/vioblk.c log diff annotate
src/sys/dev/pv/xbf.c log diff annotate
src/sys/dev/sdmmc/sdmmc_scsi.c log diff annotate
message Replace simple one-line bcopy()/memcpy() of faked data into scsi_xfer with call
to scsi_copy_internal_data(). Thus getting xs->resid properly set and adding the
usual uio/size sanity checks.

date 2020-10-15T15:36:31Z
author cheloha
files src/sys/sys/kernel.h log diff annotate
message sys/kernel.h: remove dead externs: tickfix, tixfixinterval, tickdelta, ...

miod@ removed several time-related globals from the kernel with the
commit "unifdef -d __HAVE_TIMECOUNTER" (see sys/kern/kern_clock.c v1.76).
He neglected to remove their externs from sys/kernel.h, though.

Remove the externs.

With help from jsg@.

ok jsg@

date 2020-10-15T16:31:11Z
author cheloha
files src/sys/kern/kern_exec.c log diff annotate
src/sys/kern/kern_exit.c log diff annotate
src/sys/kern/kern_time.c log diff annotate
src/sys/sys/time.h log diff annotate
message _exit(2), execve(2): tweak per-process interval timer cancellation

If we fold the for-loop iterating over each interval timer into the
helper function the result is slightly tidier than what we have now.
Rename the helper function "cancel_all_itimers".

Based on input from millert@ and kettenis@.

date 2020-10-15T17:47:24Z
author krw
files src/sys/dev/pv/hvs.c log diff annotate
message Ensure resid is correctly set in the INQUIRY case.

date 2020-10-15T20:03:43Z
author cheloha
files src/sys/kern/kern_timeout.c log diff annotate
message timeout(9): basic support for kclock timeouts

A kclock timeout is a timeout that expires at an absolute time on one
of the kernel's clocks. A timeout's absolute expiration time is kept
in a new member of the timeout struct, to_abstime. The timeout's
kclock is set at initialization and is kept in another new member of
the timeout struct, to_kclock.

Kclock timeouts are desireable because they have nanosecond
resolution, regardless of the value of hz(9). The timecounter
subsystem is also inherently NTP-sensitive, so timeouts scheduled
against the subsystem are NTP-sensitive. These two qualities
guarantee that a kclock timeout will never expire early.

Currently there is support for one kclock, KCLOCK_UPTIME (the uptime
clock). Support for KCLOCK_RUNTIME (the runtime clock) and KCLOCK_UTC
(the UTC clock) is planned for the future.

Support for these additional kclocks will allow us to implement some
of the POSIX interfaces OpenBSD is missing, e.g. clock_nanosleep() and
timer_create(). We could also use it to provide proper absolute
timeouts for e.g. pthread_mutex_timedlock(3).

Kclock timeouts are initialized with timeout_set_kclock(). They can
be scheduled with either timeout_in_nsec() (relative timeout) or
timeout_at_ts() (absolute timeout). They are incompatible with
timeout_add(9), timeout_add_sec(9), timeout_add_msec(9),
timeout_add_usec(9), timeout_add_nsec(9), and timeout_add_tv(9).
They can be cancelled with timeout_del(9) or timeout_del_barrier(9).

Documentation for the new interfaces is a work in progress.

For now, tick-based timeouts remain supported alongside kclock
timeouts. They will remain supported until we are certain we don't
need them anymore. It is possible we will never remove them. I would
rather not keep them around forever, but I cannot predict what
difficulties we will encounter while converting tick-based timeouts to
kclock timeouts. There are a *lot* of timeouts in the kernel.

Kclock timeouts are more costly than tick-based timeouts:

- Calling timeout_in_nsec() incurs a call to nanouptime(9). Reading
the hardware timecounter is too expensive in some contexts, so care
must be taken when converting existing timeouts.

We may add a flag in the future to cause timeout_in_nsec() to use
getnanouptime(9) instead of nanouptime(9), which is much cheaper.
This may be appropriate for certain classes of timeouts. tcp/ip
session timeouts come to mind.

- Kclock timeout expirations are kept in a timespec. Timespec
arithmetic has more overhead than 32-bit tick arithmetic, so
processing kclock timeouts during softclock() is more expensive.
On my machine the overhead for processing a tick-based timeout is
~125 cycles. The overhead for a kclock timeout is ~500 cycles.

The overhead difference on 32-bit platforms is unknown. If it
proves too large we may need to use a 64-bit value to store the
expiration time. More measurement is needed.

Priority targets for conversion are setitimer(2), *sleep_nsec(9), and
the kevent(2) EVFILT_TIMER timers. Others will follow.

With input from mpi@, visa@, kettenis@, dlg@, guenther@, claudio@,
deraadt@, probably many others. Older version tested by visa@.
Problems found in older version by bluhm@. Current version tested by
Yuichiro Naito.

"wait until after unlock" deraadt@, ok kettenis@

date 2020-10-15T20:03:44Z
author cheloha
files src/sys/sys/timeout.h log diff annotate
message timeout(9): basic support for kclock timeouts

A kclock timeout is a timeout that expires at an absolute time on one
of the kernel's clocks. A timeout's absolute expiration time is kept
in a new member of the timeout struct, to_abstime. The timeout's
kclock is set at initialization and is kept in another new member of
the timeout struct, to_kclock.

Kclock timeouts are desireable because they have nanosecond
resolution, regardless of the value of hz(9). The timecounter
subsystem is also inherently NTP-sensitive, so timeouts scheduled
against the subsystem are NTP-sensitive. These two qualities
guarantee that a kclock timeout will never expire early.

Currently there is support for one kclock, KCLOCK_UPTIME (the uptime
clock). Support for KCLOCK_RUNTIME (the runtime clock) and KCLOCK_UTC
(the UTC clock) is planned for the future.

Support for these additional kclocks will allow us to implement some
of the POSIX interfaces OpenBSD is missing, e.g. clock_nanosleep() and
timer_create(). We could also use it to provide proper absolute
timeouts for e.g. pthread_mutex_timedlock(3).

Kclock timeouts are initialized with timeout_set_kclock(). They can
be scheduled with either timeout_in_nsec() (relative timeout) or
timeout_at_ts() (absolute timeout). They are incompatible with
timeout_add(9), timeout_add_sec(9), timeout_add_msec(9),
timeout_add_usec(9), timeout_add_nsec(9), and timeout_add_tv(9).
They can be cancelled with timeout_del(9) or timeout_del_barrier(9).

Documentation for the new interfaces is a work in progress.

For now, tick-based timeouts remain supported alongside kclock
timeouts. They will remain supported until we are certain we don't
need them anymore. It is possible we will never remove them. I would
rather not keep them around forever, but I cannot predict what
difficulties we will encounter while converting tick-based timeouts to
kclock timeouts. There are a *lot* of timeouts in the kernel.

Kclock timeouts are more costly than tick-based timeouts:

- Calling timeout_in_nsec() incurs a call to nanouptime(9). Reading
the hardware timecounter is too expensive in some contexts, so care
must be taken when converting existing timeouts.

We may add a flag in the future to cause timeout_in_nsec() to use
getnanouptime(9) instead of nanouptime(9), which is much cheaper.
This may be appropriate for certain classes of timeouts. tcp/ip
session timeouts come to mind.

- Kclock timeout expirations are kept in a timespec. Timespec
arithmetic has more overhead than 32-bit tick arithmetic, so
processing kclock timeouts during softclock() is more expensive.
On my machine the overhead for processing a tick-based timeout is
~125 cycles. The overhead for a kclock timeout is ~500 cycles.

The overhead difference on 32-bit platforms is unknown. If it
proves too large we may need to use a 64-bit value to store the
expiration time. More measurement is needed.

Priority targets for conversion are setitimer(2), *sleep_nsec(9), and
the kevent(2) EVFILT_TIMER timers. Others will follow.

With input from mpi@, visa@, kettenis@, dlg@, guenther@, claudio@,
deraadt@, probably many others. Older version tested by visa@.
Problems found in older version by bluhm@. Current version tested by
Yuichiro Naito.

"wait until after unlock" deraadt@, ok kettenis@