diff options
author | Scott Soule Cheloha <cheloha@cvs.openbsd.org> | 2023-07-25 18:16:22 +0000 |
---|---|---|
committer | Scott Soule Cheloha <cheloha@cvs.openbsd.org> | 2023-07-25 18:16:22 +0000 |
commit | bc8a793106e952cd91ec4baf3cb84cb901cd2dc6 (patch) | |
tree | 078c0877aabd4a2416bc033d760737e2be4209b4 /sys/arch/sh | |
parent | b9f6c71d7d784b07b3531ac9427106ce2e04e2a2 (diff) |
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@.
Diffstat (limited to 'sys/arch/sh')
-rw-r--r-- | sys/arch/sh/include/cpu.h | 3 | ||||
-rw-r--r-- | sys/arch/sh/sh/clock.c | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/sys/arch/sh/include/cpu.h b/sys/arch/sh/include/cpu.h index 8bd445f1737..a080751e833 100644 --- a/sys/arch/sh/include/cpu.h +++ b/sys/arch/sh/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.34 2022/12/06 01:19:35 cheloha Exp $ */ +/* $OpenBSD: cpu.h,v 1.35 2023/07/25 18:16:21 cheloha Exp $ */ /* $NetBSD: cpu.h,v 1.41 2006/01/21 04:24:12 uwe Exp $ */ /*- @@ -68,6 +68,7 @@ struct cpu_info { #endif #ifdef GPROF struct gmonparam *ci_gmon; + struct clockintr *ci_gmonclock; #endif int ci_want_resched; diff --git a/sys/arch/sh/sh/clock.c b/sys/arch/sh/sh/clock.c index 409a1833482..2e3a8b62ee3 100644 --- a/sys/arch/sh/sh/clock.c +++ b/sys/arch/sh/sh/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.14 2023/04/10 04:21:20 jsg Exp $ */ +/* $OpenBSD: clock.c,v 1.15 2023/07/25 18:16:21 cheloha Exp $ */ /* $NetBSD: clock.c,v 1.32 2006/09/05 11:09:36 uwe Exp $ */ /*- @@ -203,7 +203,6 @@ sh_clock_get_pclock(void) void setstatclockrate(int newhz) { - clockintr_setstatclockrate(newhz); } u_int |