dissertation/sys/ddb
cheloha 329e348033 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@
2022-11-05 19:29:45 +00:00
..
db_access.c db_addr_t -> vaddr_t 2019-11-07 13:16:25 +00:00
db_access.h Separate the stack trace saving interface from ddb. The saving does not 2020-01-20 15:58:23 +00:00
db_break.c sick of the CMU, let's make this KNF 2020-10-15 03:13:59 +00:00
db_break.h db_addr_t -> vaddr_t 2019-11-07 13:16:25 +00:00
db_command.c clockintr(9): initial commit 2022-11-05 19:29:45 +00:00
db_command.h ddb: constify command tables 2022-04-14 19:47:10 +00:00
db_ctf.c db_ctf_decompress: use size_t not off_t for length parameter 2022-08-14 14:57:38 +00:00
db_dwarf.c
db_elf.c spelling 2021-03-12 10:22:46 +00:00
db_elf.h
db_examine.c If the kernel panics due to SMEP or SMAP, print correct stack trace 2020-01-09 15:18:58 +00:00
db_expr.c sick of the CMU, let's make this KNF 2020-10-15 03:13:59 +00:00
db_extern.h db_addr_t -> vaddr_t 2019-11-07 13:16:25 +00:00
db_hangman.c sick of the CMU, let's make this KNF 2020-10-15 03:13:59 +00:00
db_input.c sick of the CMU, let's make this KNF 2020-10-15 03:13:59 +00:00
db_interface.h clockintr(9): initial commit 2022-11-05 19:29:45 +00:00
db_lex.c sick of the CMU, let's make this KNF 2020-10-15 03:13:59 +00:00
db_lex.h
db_output.c Prevent interleaved stack traces in ddb from multiple CPUs. Check 2021-06-10 12:33:48 +00:00
db_output.h ddb: when a new wsdisplay console attaches, resize ddb cols/rows to it 2021-02-09 14:37:13 +00:00
db_prof.c add kprobes provider for dt 2021-09-03 16:45:44 +00:00
db_rint.c Add db_rint(), an MI interface to db_enter() copied from kdbrint() in vax code 2022-07-12 17:12:31 +00:00
db_run.c sick of the CMU, let's make this KNF 2020-10-15 03:13:59 +00:00
db_run.h Substitute boolean_t/TRUE/FALSE by int/1/0. 2019-11-06 07:30:08 +00:00
db_sym.c fix scentence in db_printsym comment 2021-07-09 20:59:17 +00:00
db_sym.h use NULL not 0 for pointer values in kern 2021-10-24 00:02:24 +00:00
db_trap.c Substitute boolean_t/TRUE/FALSE by int/1/0. 2019-11-06 07:30:08 +00:00
db_usrreq.c Finish converting ddb_sysctl to sysctl_int_bounded 2021-01-09 20:58:12 +00:00
db_var.h sick of the CMU, let's make this KNF 2020-10-15 03:13:59 +00:00
db_variables.c sick of the CMU, let's make this KNF 2020-10-15 03:13:59 +00:00
db_variables.h
db_watch.c sick of the CMU, let's make this KNF 2020-10-15 03:13:59 +00:00
db_watch.h db_addr_t -> vaddr_t 2019-11-07 13:16:25 +00:00