OpenBSD cvs log

created 2023-08-27T07:47:53Z
begin 2023-08-23T00:00:00Z
end 2023-08-24T00:00:00Z
path src/sys
commits 3

date 2023-08-23T01:55:45Z
author cheloha
files src/sys/arch/alpha/alpha/clock.c log diff annotate
src/sys/arch/amd64/amd64/machdep.c log diff annotate
src/sys/kern/kern_clock.c log diff annotate
src/sys/sys/systm.h log diff annotate
message all platforms: separate cpu_initclocks() from cpu_startclock()

To give the primary CPU an opportunity to perform clock interrupt
preparation in a machine-independent manner we need to separate the
"initialization" parts of cpu_initclocks() from the "start the clock
interrupt" parts. Currently, cpu_initclocks() does everything all at
once, so there is no space for this MI setup.

Many platforms have more-or-less already done this separation by
implementing a separate routine named "cpu_startclock()". This patch
promotes cpu_startclock() from de facto standard to mandatory API.

- Prototype cpu_startclock() in sys/systm.h alongside cpu_initclocks().
The separation of responsibility between the two routines is a bit
fuzzy but the basic guidelines are as follows:

+ cpu_initclocks() must initialize hz, stathz, and profhz, and call
clockintr_init().

+ cpu_startclock() must call clockintr_cpu_init() and start the clock
interrupt cycle on the calling CPU.

These guidelines will shift in the future, but that's the way things
stand as of *this* commit.

- In initclocks(): first call cpu_initclocks(), then do MI setup, and
last call cpu_startclock().

- On platforms where cpu_startclock() already exists: don't call
cpu_startclock() from cpu_initclocks() anymore.

- On platforms where cpu_startclock() doesn't yet exist: implement it.
Usually this is as simple as dividing cpu_initclocks() in two.

Tested on amd64 (i8254, lapic), arm64, i386 (i8254, lapic), macppc,
mips64/octeon, and sparc64. Tested on arm/armv7 (agtimer(4)) by
phessler@ and jmatthew@. Tested on m88k/luna88k by aoyama@. Tested
on powerpc64 by gkoehler@ and mlarkin@. Tested on riscv64 by
jmatthew@.

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

date 2023-08-23T01:55:46Z
author cheloha
files src/sys/arch/amd64/amd64/lapic.c log diff annotate
src/sys/arch/amd64/include/cpu.h log diff annotate
src/sys/arch/amd64/isa/clock.c log diff annotate
src/sys/arch/arm/cortex/agtimer.c log diff annotate
src/sys/arch/arm/cortex/amptimer.c log diff annotate
src/sys/arch/arm/include/cpu.h log diff annotate
src/sys/arch/arm64/dev/agtimer.c log diff annotate
src/sys/arch/arm64/include/cpu.h log diff annotate
src/sys/arch/armv7/omap/dmtimer.c 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/cpu.h log diff annotate
src/sys/arch/i386/i386/lapic.c log diff annotate
src/sys/arch/i386/i386/machdep.c log diff annotate
src/sys/arch/i386/include/cpu.h log diff annotate
src/sys/arch/i386/isa/clock.c log diff annotate
message all platforms: separate cpu_initclocks() from cpu_startclock()

To give the primary CPU an opportunity to perform clock interrupt
preparation in a machine-independent manner we need to separate the
"initialization" parts of cpu_initclocks() from the "start the clock
interrupt" parts. Currently, cpu_initclocks() does everything all at
once, so there is no space for this MI setup.

Many platforms have more-or-less already done this separation by
implementing a separate routine named "cpu_startclock()". This patch
promotes cpu_startclock() from de facto standard to mandatory API.

- Prototype cpu_startclock() in sys/systm.h alongside cpu_initclocks().
The separation of responsibility between the two routines is a bit
fuzzy but the basic guidelines are as follows:

+ cpu_initclocks() must initialize hz, stathz, and profhz, and call
clockintr_init().

+ cpu_startclock() must call clockintr_cpu_init() and start the clock
interrupt cycle on the calling CPU.

These guidelines will shift in the future, but that's the way things
stand as of *this* commit.

- In initclocks(): first call cpu_initclocks(), then do MI setup, and
last call cpu_startclock().

- On platforms where cpu_startclock() already exists: don't call
cpu_startclock() from cpu_initclocks() anymore.

- On platforms where cpu_startclock() doesn't yet exist: implement it.
Usually this is as simple as dividing cpu_initclocks() in two.

Tested on amd64 (i8254, lapic), arm64, i386 (i8254, lapic), macppc,
mips64/octeon, and sparc64. Tested on arm/armv7 (agtimer(4)) by
phessler@ and jmatthew@. Tested on m88k/luna88k by aoyama@. Tested
on powerpc64 by gkoehler@ and mlarkin@. Tested on riscv64 by
jmatthew@.

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

date 2023-08-23T01:55:47Z
author cheloha
files src/sys/arch/luna88k/luna88k/clock.c log diff annotate
src/sys/arch/macppc/macppc/clock.c log diff annotate
src/sys/arch/mips64/include/cpu.h log diff annotate
src/sys/arch/mips64/mips64/clock.c log diff annotate
src/sys/arch/mips64/mips64/mips64_machdep.c log diff annotate
src/sys/arch/powerpc64/include/cpu.h log diff annotate
src/sys/arch/powerpc64/powerpc64/clock.c log diff annotate
src/sys/arch/riscv64/include/cpu.h log diff annotate
src/sys/arch/riscv64/riscv64/clock.c log diff annotate
src/sys/arch/sh/sh/clock.c log diff annotate
src/sys/arch/sparc64/sparc64/clock.c log diff annotate
message all platforms: separate cpu_initclocks() from cpu_startclock()

To give the primary CPU an opportunity to perform clock interrupt
preparation in a machine-independent manner we need to separate the
"initialization" parts of cpu_initclocks() from the "start the clock
interrupt" parts. Currently, cpu_initclocks() does everything all at
once, so there is no space for this MI setup.

Many platforms have more-or-less already done this separation by
implementing a separate routine named "cpu_startclock()". This patch
promotes cpu_startclock() from de facto standard to mandatory API.

- Prototype cpu_startclock() in sys/systm.h alongside cpu_initclocks().
The separation of responsibility between the two routines is a bit
fuzzy but the basic guidelines are as follows:

+ cpu_initclocks() must initialize hz, stathz, and profhz, and call
clockintr_init().

+ cpu_startclock() must call clockintr_cpu_init() and start the clock
interrupt cycle on the calling CPU.

These guidelines will shift in the future, but that's the way things
stand as of *this* commit.

- In initclocks(): first call cpu_initclocks(), then do MI setup, and
last call cpu_startclock().

- On platforms where cpu_startclock() already exists: don't call
cpu_startclock() from cpu_initclocks() anymore.

- On platforms where cpu_startclock() doesn't yet exist: implement it.
Usually this is as simple as dividing cpu_initclocks() in two.

Tested on amd64 (i8254, lapic), arm64, i386 (i8254, lapic), macppc,
mips64/octeon, and sparc64. Tested on arm/armv7 (agtimer(4)) by
phessler@ and jmatthew@. Tested on m88k/luna88k by aoyama@. Tested
on powerpc64 by gkoehler@ and mlarkin@. Tested on riscv64 by
jmatthew@.

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