clockintr: switch from callee- to caller-allocated clockintr structs
authorcheloha <cheloha@openbsd.org>
Wed, 24 Jan 2024 19:23:38 +0000 (19:23 +0000)
committercheloha <cheloha@openbsd.org>
Wed, 24 Jan 2024 19:23:38 +0000 (19:23 +0000)
commit1d970828bcdfaa6f1de83da4a110fd1536b535fe
tree62b39180bd36bbf8f66c9b940d22ad7b8c3ac0da
parent13e262cf287165162838f36e9c633b03249fc1e0
clockintr: switch from callee- to caller-allocated clockintr structs

Currently, clockintr_establish() calls malloc(9) to allocate a
clockintr struct on behalf of the caller.  mpi@ says this behavior is
incompatible with dt(4).  In particular, calling malloc(9) during the
initialization of a PCB outside of dt_pcb_alloc() is (a) awkward and
(b) may conflict with future changes/optimizations to PCB allocation.

To side-step the problem, this patch changes the clockintr subsystem
to use caller-allocated clockintr structs instead of callee-allocated
structs.

clockintr_establish() is named after softintr_establish(), which uses
malloc(9) internally to create softintr objects.  The clockintr subsystem
is no longer using malloc(9), so the "establish" naming is no longer apt.
To avoid confusion, this patch also renames "clockintr_establish" to
"clockintr_bind".

Requested by mpi@.  Tweaked by mpi@.

Thread: https://marc.info/?l=openbsd-tech&m=170597126103504&w=2

ok claudio@ mlarkin@ mpi@
19 files changed:
sys/arch/alpha/include/cpu.h
sys/arch/amd64/include/cpu.h
sys/arch/arm/include/cpu.h
sys/arch/arm64/include/cpu.h
sys/arch/hppa/include/cpu.h
sys/arch/i386/include/cpu.h
sys/arch/m88k/include/cpu.h
sys/arch/mips64/include/cpu.h
sys/arch/powerpc/include/cpu.h
sys/arch/riscv64/include/cpu.h
sys/arch/sh/include/cpu.h
sys/arch/sparc64/include/cpu.h
sys/kern/kern_clockintr.c
sys/kern/kern_fork.c
sys/kern/kern_sched.c
sys/kern/sched_bsd.c
sys/kern/subr_prof.c
sys/sys/clockintr.h
sys/sys/sched.h