diff options
author | Scott Soule Cheloha <cheloha@cvs.openbsd.org> | 2022-11-05 19:29:47 +0000 |
---|---|---|
committer | Scott Soule Cheloha <cheloha@cvs.openbsd.org> | 2022-11-05 19:29:47 +0000 |
commit | 02dc962cf694b58ab04d3ec0483b539051ebe369 (patch) | |
tree | bca3746ada93fd48e98b668683df00c57f875a63 /sys/ddb | |
parent | ad7e72bf7a6d51934c476167fdfaf12af2d75e30 (diff) |
clockintr(9): initial commit
clockintr(9) is a machine-independent clock interrupt scheduler. It
emulates most of what the machine-dependent clock interrupt code is
doing on every platform. Every CPU has a work schedule based on the
system uptime clock. For now, every CPU has a hardclock(9) and a
statclock(). If schedhz is set, every CPU has a schedclock(), too.
This commit only contains the MI pieces. All code is conditionally
compiled with __HAVE_CLOCKINTR. This commit changes no behavior yet.
At a high level, clockintr(9) is configured and used as follows:
1. During boot, the primary CPU calls clockintr_init(9). Global state
is initialized.
2. Primary CPU calls clockintr_cpu_init(9). Local, per-CPU state is
initialized. An "intrclock" struct may be installed, too.
3. Secondary CPUs call clockintr_cpu_init(9) to initialize their
local state.
4. All CPUs repeatedly call clockintr_dispatch(9) from the MD clock
interrupt handler. The CPUs complete work and rearm their local
interrupt clock, if any, during the dispatch.
5. Repeat step (4) until the system shuts down, suspends, or hibernates.
6. During resume, the primary CPU calls inittodr(9) and advances the
system uptime.
7. Go to step (2). This time around, clockintr_cpu_init(9) also
advances the work schedule on the calling CPU to skip events that
expired during suspend. This prevents a "thundering herd" of
useless work during the first clock interrupt.
In the long term, we need an MI clock interrupt scheduler in order to
(1) provide control over the clock interrupt to MI subsystems like
timeout(9) and dt(4) to improve their accuracy, (2) provide drivers
like acpicpu(4) a means for slowing or stopping the clock interrupt on
idle CPUs to conserve power, and (3) reduce the amount of duplicated
code in the MD clock interrupt code.
Before we can do any of that, though, we need to switch every platform
over to using clockintr(9) and do some cleanup.
Prompted by "the vmm(4) time bug," among other problems, and a
discussion at a2k19 on the subject. Lots of design input from
kettenis@. Early versions reviewed by kettenis@ and mlarkin@.
Platform-specific help and testing from kettenis@, gkoehler@,
mlarkin@, miod@, aoyama@, visa@, and dv@. Babysitting and spiritual
guidance from mlarkin@ and kettenis@.
Link: https://marc.info/?l=openbsd-tech&m=166697497302283&w=2
ok kettenis@ mlarkin@
Diffstat (limited to 'sys/ddb')
-rw-r--r-- | sys/ddb/db_command.c | 5 | ||||
-rw-r--r-- | sys/ddb/db_interface.h | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index bb369832baa..a8f60c9249b 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_command.c,v 1.96 2022/07/29 17:47:11 semarie Exp $ */ +/* $OpenBSD: db_command.c,v 1.97 2022/11/05 19:29:45 cheloha Exp $ */ /* $NetBSD: db_command.c,v 1.20 1996/03/30 22:30:05 christos Exp $ */ /* @@ -597,6 +597,9 @@ db_bcstats_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif const struct db_command db_show_all_cmds[] = { { "procs", db_show_all_procs, 0, NULL }, { "callout", db_show_callout, 0, NULL }, +#ifdef __HAVE_CLOCKINTR + { "clockintr", db_show_all_clockintr, 0, NULL }, +#endif { "pools", db_show_all_pools, 0, NULL }, { "mounts", db_show_all_mounts, 0, NULL }, { "vnodes", db_show_all_vnodes, 0, NULL }, diff --git a/sys/ddb/db_interface.h b/sys/ddb/db_interface.h index 50a337dc9f7..fabc8fd1879 100644 --- a/sys/ddb/db_interface.h +++ b/sys/ddb/db_interface.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_interface.h,v 1.24 2022/07/29 17:47:11 semarie Exp $ */ +/* $OpenBSD: db_interface.h,v 1.25 2022/11/05 19:29:45 cheloha Exp $ */ /* $NetBSD: db_interface.h,v 1.1 1996/02/05 01:57:03 christos Exp $ */ /* @@ -43,6 +43,11 @@ vaddr_t db_disasm(vaddr_t, int); void db_kill_cmd(db_expr_t, int, db_expr_t, char *); void db_show_all_procs(db_expr_t, int, db_expr_t, char *); +/* kern/kern_clockintr.c */ +#ifdef __HAVE_CLOCKINTR +void db_show_all_clockintr(db_expr_t, int, db_expr_t, char *); +#endif + /* kern/kern_timeout.c */ void db_show_callout(db_expr_t, int, db_expr_t, char *); |