History log of /openbsd/sys/arch/powerpc64/powerpc64/clock.c (Results 1 – 14 of 14)
Revision Date Author Comments
# 0ed1bf01 17-Sep-2023 cheloha <cheloha@openbsd.org>

clockintr: remove clockintr_init(), clockintr_flags

All the state initialization once done in clockintr_init() has been
moved to other parts of the kernel. It's a dead function. Remove it.

Likewi

clockintr: remove clockintr_init(), clockintr_flags

All the state initialization once done in clockintr_init() has been
moved to other parts of the kernel. It's a dead function. Remove it.

Likewise, the clockintr_flags variable no longer sports any meaningful
flags. Remove it. This frees up the CL_* flag namespace, which might
be useful to the clockintr frontend if we ever need to add behavior
flags to any of those functions.

show more ...


# b3ef18bd 14-Sep-2023 cheloha <cheloha@openbsd.org>

clockintr: replace CL_RNDSTAT with global variable statclock_is_randomized

In order to separate the statclock from the clock interrupt subsystem
we need to move all statclock state out into the broa

clockintr: replace CL_RNDSTAT with global variable statclock_is_randomized

In order to separate the statclock from the clock interrupt subsystem
we need to move all statclock state out into the broader kernel.

Start by replacing the CL_RNDSTAT flag with a new global variable,
"statclock_is_randomized", in kern_clock.c. Update all clockintr_init()
callers to set the boolean instead of passing the flag.

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

show more ...


# 11d1f9b2 23-Aug-2023 cheloha <cheloha@openbsd.org>

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
"

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

show more ...


# 671537bf 25-Jul-2023 cheloha <cheloha@openbsd.org>

statclock: move profil(2), GPROF code to profclock(), gmonclock()

This patch isolates profil(2) and GPROF from statclock(). Currently,
statclock() implements both profil(2) and GPROF through a comp

statclock: move profil(2), GPROF code to profclock(), gmonclock()

This patch isolates profil(2) and GPROF from statclock(). Currently,
statclock() implements both profil(2) and GPROF through a complex
mechanism involving both platform code (setstatclockrate) and the
scheduler (pscnt, psdiv, and psratio). We have a machine-independent
interface to the clock interrupt hardware now, so we no longer need to
do it this way.

- Move profil(2)-specific code from statclock() to a new clock
interrupt callback, profclock(), in subr_prof.c. Each
schedstate_percpu has its own profclock handle. The profclock is
enabled/disabled for a given CPU when it is needed by the running
thread during mi_switch() and sched_exit().

- Move GPROF-specific code from statclock() to a new clock interrupt
callback, gmonclock(), in subr_prof.c. Where available, each cpu_info
has its own gmonclock handle . The gmonclock is enabled/disabled for
a given CPU via sysctl(2) in prof_state_toggle().

- Both profclock() and gmonclock() have a fixed period, profclock_period,
that is initialized during initclocks().

- Export clockintr_advance(), clockintr_cancel(), clockintr_establish(),
and clockintr_stagger() via <sys/clockintr.h>. They have external
callers now.

- Delete pscnt, psdiv, psratio. From schedstate_percpu, also delete
spc_pscnt and spc_psdiv. The statclock frequency is not dynamic
anymore so these variables are now useless.

- Delete code/state related to the dynamic statclock frequency from
kern_clockintr.c. The statclock frequency can still be pseudo-random,
so move the contents of clockintr_statvar_init() into clockintr_init().

With input from miod@, deraadt@, and claudio@. Early revisions
cleaned up by claudio. Early revisions tested by claudio@. Tested by
cheloha@ on amd64, arm64, macppc, octeon, and sparc64 (sun4v).
Compile- and boot- tested on i386 by mlarkin@. riscv64 compilation
bugs found by mlarkin@. Tested on riscv64 by jca@. Tested on
powerpc64 by gkoehler@.

show more ...


# 00fa57d4 04-Feb-2023 cheloha <cheloha@openbsd.org>

powerpc64: dec_rearm: don't disable interrupts around atomic operations

We don't need to disable interrupts around this singular mtdec() call.
The mtdec operation is atomic.

Link: https://marc.info

powerpc64: dec_rearm: don't disable interrupts around atomic operations

We don't need to disable interrupts around this singular mtdec() call.
The mtdec operation is atomic.

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

ok gkoehler@

show more ...


# 24ee467d 04-Feb-2023 cheloha <cheloha@openbsd.org>

timecounting: remove incomplete PPS support

The timecounting code has had stubs for pulse-per-second (PPS) polling
since it was imported in 2004. At this point it seems unlikely that
anyone is goin

timecounting: remove incomplete PPS support

The timecounting code has had stubs for pulse-per-second (PPS) polling
since it was imported in 2004. At this point it seems unlikely that
anyone is going to finish adding PPS support, so let's remove the stubs:

- Delete the dead tc_poll_pps() call from tc_windup().
- Remove all tc_poll_pps symbols from the kernel.

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

ok miod@

show more ...


# 4cd354c5 27-Jan-2023 cheloha <cheloha@openbsd.org>

powerpc64: initialize stathz, profhz as on other platforms

Don't hardcode stathz to 100 and profhz to 1000. Instead, set stathz
to hz and profhz to (stathz * 10). This is what we do on most other

powerpc64: initialize stathz, profhz as on other platforms

Don't hardcode stathz to 100 and profhz to 1000. Instead, set stathz
to hz and profhz to (stathz * 10). This is what we do on most other
platforms.

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

ok kettenis@

show more ...


# aca18452 29-Nov-2022 cheloha <cheloha@openbsd.org>

powerpc64: switch to clockintr

- Remove powerpc64-specific clock interrupt scheduling bits from
cpu_info.
- Remove powerpc64-specific randomized statclock() bits from
powerpc64/clock.c.
- Remove

powerpc64: switch to clockintr

- Remove powerpc64-specific clock interrupt scheduling bits from
cpu_info.
- Remove powerpc64-specific randomized statclock() bits from
powerpc64/clock.c.
- Remove the 'stat_count' evcount. All clock interrupts are now counted
via the 'clock_count' evcount.
- Wire up dec_intrclock.

Bringup help from gkoehler@. Tested by gkoehler@: this patch has
survived four kernel-release-upgrade cycles on a Raptor Talos II
T2P9S01 sporting a quad-core POWER9 CPU.

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

ok gkoehler@ mlarkin@

show more ...


# 63a4e21d 05-Nov-2022 cheloha <cheloha@openbsd.org>

powerpc64: TimeBase: add userspace timecounting support

Tested by gkoehler@.

ok gkoehler@


# 5cbf2c1d 11-Aug-2022 cheloha <cheloha@openbsd.org>

powerpc64: cpu_initclocks: do tc_init(9) before cpu_startclock()

In the future, the clock interrupt will need a working timecounter to
accurately reschedule itself.

Move tc_init(9) up before cpu_st

powerpc64: cpu_initclocks: do tc_init(9) before cpu_startclock()

In the future, the clock interrupt will need a working timecounter to
accurately reschedule itself.

Move tc_init(9) up before cpu_startclock().

kettenis@ notes several other platforms need this same change. Maybe
we can do the rest all at once.

Tested by kettenis@.

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

ok kettenis@

show more ...


# f27ca60c 09-Aug-2022 cheloha <cheloha@openbsd.org>

powerpc64: trigger deferred DEC interrupts from splx(9)

In order to move to a machine-independent clock interrupt subsystem,
the powerpc64 clock interrupt code needs to work without knowing
anything

powerpc64: trigger deferred DEC interrupts from splx(9)

In order to move to a machine-independent clock interrupt subsystem,
the powerpc64 clock interrupt code needs to work without knowing
anything about the clock interrupt schedule.

The easiest way to do this is, if the DEC fires while the CPU's IPL is
at or above IPL_CLOCK, to postpone clock interrupt work until the
clock interrupt is logically unmasked from splx(9).

Because we no longer defer work until the next tick, we don't need to
keep track of pending statclock ticks in the cpu_info struct.

With input from kettenis@.

Graciously compiled and tested by gkoehler@ and kettenis@.

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

ok kettenis@ gkoehler@.

show more ...


# 8611d3cd 23-Feb-2021 cheloha <cheloha@openbsd.org>

timecounting: use C99-style initialization for all timecounter structs

The timecounter struct is large and I think it may change in the
future. Changing it later will be easier if we use C99-style

timecounting: use C99-style initialization for all timecounter structs

The timecounter struct is large and I think it may change in the
future. Changing it later will be easier if we use C99-style
initialization for all timecounter structs. It also makes reading the
code a bit easier.

For reasons I cannot explain, switching to C99-style initialization
sometimes changes the hash of the resulting object file, even though
the resulting struct should be the same. So there is a binary change
here, but only sometimes. No behavior should change in either case.

I can't compile-test this everywhere but I have been staring at the
diff for days now and I'm relatively confident this will not break
compilation. Fingers crossed.

ok gnezdo@

show more ...


# 0b0a47ac 12-Jul-2020 naddy <naddy@openbsd.org>

The PowerPC/Power ISA Time Base is a 64-bit register, so we can use the
full lower 32 bits for the timecounter. ok kettenis@


# ff56acc2 10-Jun-2020 kettenis <kettenis@openbsd.org>

Add clock interrupt support, adapted from the randomized dual clock
implementation from Dale Rahn but relicensed (with his permission)
under our standard ISC license.