#
949c1c4e |
| 07-Nov-2024 |
miod <miod@openbsd.org> |
Constify strings in symbol-related ddb interfaces, and make the iterator callback interface a bit simpler. ok beck@ claudio@ mpi@
|
#
c737cf90 |
| 25-Feb-2024 |
cheloha <cheloha@openbsd.org> |
clockintr: rename "struct clockintr_queue" to "struct clockqueue"
The code has outgrown the original name for this struct. Both the external and internal APIs have used the "clockqueue" namespace f
clockintr: rename "struct clockintr_queue" to "struct clockqueue"
The code has outgrown the original name for this struct. Both the external and internal APIs have used the "clockqueue" namespace for some time when operating on it, and that name is eyeball-consistent with "clockintr" and "clockrequest", so "clockqueue" it is.
show more ...
|
#
2caeedbf |
| 25-Feb-2024 |
cheloha <cheloha@openbsd.org> |
clockintr.h, kern_clockintr.c: add 2023, 2024 to copyright range
|
#
2b39aa20 |
| 24-Feb-2024 |
cheloha <cheloha@openbsd.org> |
clockintr: rename clockqueue_reset_intrclock to clockqueue_intrclock_reprogram
The function should be in the clockqueue_intrclock namespace. Also, "reprogram" is a better word for what the function
clockintr: rename clockqueue_reset_intrclock to clockqueue_intrclock_reprogram
The function should be in the clockqueue_intrclock namespace. Also, "reprogram" is a better word for what the function actually does.
show more ...
|
#
8434116f |
| 12-Feb-2024 |
cheloha <cheloha@openbsd.org> |
kernel: disable hardclock() on secondary CPUs
There is no useful work left for secondary CPUs to do in hardclock(). Disable cq_hardclock on secondary CPUs and remove the now-unnecessary early-return
kernel: disable hardclock() on secondary CPUs
There is no useful work left for secondary CPUs to do in hardclock(). Disable cq_hardclock on secondary CPUs and remove the now-unnecessary early-return from hardclock().
This change reduces every system's normal clock interrupt rate by (HZ - HZ/10) per secondary CPU. For example, an 8-core machine with a HZ=100 kernel should see its clock interrupt rate drop from ~1600 to ~960.
Thread: https://marc.info/?l=openbsd-tech&m=170750140915898&w=2
ok kettenis@
show more ...
|
#
0d53143d |
| 09-Feb-2024 |
cheloha <cheloha@openbsd.org> |
clockintr: add clockintr_unbind()
The clockintr_unbind() function cancels any pending execution of the given clock interrupt object's callback and severs the binding between the object and its host
clockintr: add clockintr_unbind()
The clockintr_unbind() function cancels any pending execution of the given clock interrupt object's callback and severs the binding between the object and its host CPU. Upon return from clockintr_unbind(), the clock interrupt object may be rebound with a call to clockintr_bind().
The optional CL_BARRIER flag tells clockintr_unbind() to block if the clockintr's callback function is executing at the moment of the call. This is useful when the clockintr's arg is a shared reference and the caller needs to be certain the reference is inactive.
Now that clockintrs can be bound and unbound repeatedly, there is more room for error. To help catch programmer errors, clockintr_unbind() sets cl_queue to NULL. Calls to other API functions after a clockintr is unbound will then fault on a NULL dereference. clockintr_bind() also KASSERTs that cl_queue is NULL to ensure the clockintr is not already bound. These checks are not perfect, but they do catch some common errors.
With input from mpi@.
Thread: https://marc.info/?l=openbsd-tech&m=170629367121800&w=2
ok mpi@
show more ...
|
#
34cee562 |
| 09-Feb-2024 |
cheloha <cheloha@openbsd.org> |
clockintr: refactor clockintr_cancel() into clockintr_cancel_locked()
Move the mutex-protected portions of clockintr_cancel() into a separate function, clockintr_cancel_locked(), so that the code ca
clockintr: refactor clockintr_cancel() into clockintr_cancel_locked()
Move the mutex-protected portions of clockintr_cancel() into a separate function, clockintr_cancel_locked(), so that the code can be reused by other callers.
Thread: https://marc.info/?l=openbsd-tech&m=170629367121800&w=2
ok mpi@
show more ...
|
#
1d970828 |
| 24-Jan-2024 |
cheloha <cheloha@openbsd.org> |
clockintr: switch from callee- to caller-allocated clockintr structs
Currently, clockintr_establish() calls malloc(9) to allocate a clockintr struct on behalf of the caller. mpi@ says this behavior
clockintr: switch from callee- to caller-allocated clockintr structs
Currently, clockintr_establish() calls malloc(9) to allocate a clockintr struct on behalf of the caller. mpi@ says this behavior is incompatible with dt(4). In particular, calling malloc(9) during the initialization of a PCB outside of dt_pcb_alloc() is (a) awkward and (b) may conflict with future changes/optimizations to PCB allocation.
To side-step the problem, this patch changes the clockintr subsystem to use caller-allocated clockintr structs instead of callee-allocated structs.
clockintr_establish() is named after softintr_establish(), which uses malloc(9) internally to create softintr objects. The clockintr subsystem is no longer using malloc(9), so the "establish" naming is no longer apt. To avoid confusion, this patch also renames "clockintr_establish" to "clockintr_bind".
Requested by mpi@. Tweaked by mpi@.
Thread: https://marc.info/?l=openbsd-tech&m=170597126103504&w=2
ok claudio@ mlarkin@ mpi@
show more ...
|
#
89b5be12 |
| 15-Jan-2024 |
cheloha <cheloha@openbsd.org> |
clockintr: move CLST_IGNORE_REQUESTS from cl_flags to cq_flags
In the near future, we will add support for destroying clockintr objects. When this happens, it will no longer be safe to dereference
clockintr: move CLST_IGNORE_REQUESTS from cl_flags to cq_flags
In the near future, we will add support for destroying clockintr objects. When this happens, it will no longer be safe to dereference the pointer to the expired clockintr during the dispatch loop in clockintr_dispatch() after reentering cq_mtx. This means we will not be able to safely check for the CLST_IGNORE_REQUESTS flag.
So replace the CLST_IGNORE_REQUESTS flag in cl_flags with the CQ_IGNORE_REQUESTS flag in cq_flags. The semantics are the same. Both cl_flags and cq_flags are protected by cq_mtx.
Note that we cannot move the CLST_IGNORE_REQUESTS flag to cr_flags in struct clockrequest: that member is owned by the dispatching CPU and is not mutated with atomic operations.
show more ...
|
#
106c68c4 |
| 17-Oct-2023 |
cheloha <cheloha@openbsd.org> |
clockintr: move callback-specific API behaviors to "clockrequest" namespace
The API's behavior when invoked from a callback function is impossible to document. Move the special behavior into a dist
clockintr: move callback-specific API behaviors to "clockrequest" namespace
The API's behavior when invoked from a callback function is impossible to document. Move the special behavior into a distinct namespace, "clockrequest".
- Add a 'struct clockrequest'. Basically a stripped-down 'struct clockintr' for exclusive use during clockintr_dispatch(). - In clockintr_queue, replace the "cq_shadow" clockintr with a "cq_request" clockrequest. They serve the same purpose. - CLST_SHADOW_PENDING -> CR_RESCHEDULE; different namespace, same meaning. - CLST_IGNORE_SHADOW -> CLST_IGNORE_REQUEST; same meaning. - Move shadow branch in clockintr_advance() to clockrequest_advance(). - clockintr_request_random() becomes clockrequest_advance_random(). - Delete dead shadow branches in clockintr_cancel(), clockintr_schedule(). - Callback functions now get a clockrequest pointer instead of a special clockintr pointer: update all prototypes, callers.
No functional change intended.
show more ...
|
#
67b188dd |
| 11-Oct-2023 |
cheloha <cheloha@openbsd.org> |
clockintr: move clockintr_schedule() into public API
Prototype clockintr_schedule() in <sys/clockintr.h>.
|
#
cbdb8ca3 |
| 11-Oct-2023 |
cheloha <cheloha@openbsd.org> |
clockintr_stagger: rename parameters: "n" -> "numer", "count" -> "denom"
Rename these parameters to align the code with the forthcoming manpage. No functional change.
|
#
799b5cc6 |
| 08-Oct-2023 |
cheloha <cheloha@openbsd.org> |
clockintr: move intrclock wrappers from sys/clockintr.h to kern_clockintr.c
intrclock_rearm() and intrclock_trigger() are not part of the public API, so there's no reason to implement them in sys/cl
clockintr: move intrclock wrappers from sys/clockintr.h to kern_clockintr.c
intrclock_rearm() and intrclock_trigger() are not part of the public API, so there's no reason to implement them in sys/clockintr.h. Move them to kern_clockintr.c.
show more ...
|
#
3973774f |
| 25-Sep-2023 |
cheloha <cheloha@openbsd.org> |
ddb(4): clockintr: print cl_arg address when displaying a clockintr
|
#
d54b5b53 |
| 24-Sep-2023 |
cheloha <cheloha@openbsd.org> |
kern_clockintr.c: remove extra newline
|
#
649d9dd9 |
| 17-Sep-2023 |
cheloha <cheloha@openbsd.org> |
clockintr.h: forward-declare "struct cpu_info" for clockintr_establish()
With input from claudio@ and deraadt@.
|
#
9c0655ba |
| 17-Sep-2023 |
cheloha <cheloha@openbsd.org> |
struct clockintr_queue: rename "cq_est" to "cq_all"
"cq_all" is a more obvious name than "cq_est". It's the list of all established clockintrs. Duh.
|
#
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 ...
|
#
40ed9249 |
| 15-Sep-2023 |
deraadt <deraadt@openbsd.org> |
work around cpu.h not coming into early scope on all arch
|
#
061f668f |
| 14-Sep-2023 |
cheloha <cheloha@openbsd.org> |
clockintr: move hz(9)-based initialization out to initclocks()
To separate the hardclock from the clock interrupt subsystem we'll need to move all related state out first.
hz(9) is set when we retu
clockintr: move hz(9)-based initialization out to initclocks()
To separate the hardclock from the clock interrupt subsystem we'll need to move all related state out first.
hz(9) is set when we return from cpu_initclocks(), so it's safe to move hardclock_period and roundrobin_period initialization out into initclocks(). Move hardclock_period itself out into kern_clock.c alongside the statclock variables.
show more ...
|
#
a332869a |
| 14-Sep-2023 |
cheloha <cheloha@openbsd.org> |
clockintr, scheduler: move statclock handle from clockintr_queue to schedstate_percpu
Move the statclock handle from clockintr_queue.cq_statclock to schedstate_percpu.spc_statclock. Establish spc_s
clockintr, scheduler: move statclock handle from clockintr_queue to schedstate_percpu
Move the statclock handle from clockintr_queue.cq_statclock to schedstate_percpu.spc_statclock. Establish spc_statclock during sched_init_cpu() alongside the other scheduler clock interrupts.
Thread: https://marc.info/?l=openbsd-tech&m=169428749720476&w=2
show more ...
|
#
f36eae22 |
| 14-Sep-2023 |
cheloha <cheloha@openbsd.org> |
clockintr, statclock: eliminate clockintr_statclock() wrapper
- Move remaining statclock variables from kern_clockintr.c to kern_clock.c. Move statclock variable initialization from clockintr_i
clockintr, statclock: eliminate clockintr_statclock() wrapper
- Move remaining statclock variables from kern_clockintr.c to kern_clock.c. Move statclock variable initialization from clockintr_init() into initclocks().
- Change statclock() prototype to make it a legal clockintr callback function and establish the handle with statclock() instead clockintr_statclock().
- Merge the contents of clockintr_statclock() into statclock(). statclock() can now reschedule itself and handles multiple expirations transparently.
- Make statclock_avg visible from sys/systm.h so that clockintr_cpu_init() can use it to advance the statclock across suspend/hibernate.
Thread: https://marc.info/?l=openbsd-tech&m=169428749720476&w=2
show more ...
|
#
7cfaf107 |
| 14-Sep-2023 |
cheloha <cheloha@openbsd.org> |
clockintr: move clockintr_advance_random() prototype into sys/clockintr.h
statclock() is going to need this. Move the prototype into the public API.
Thread: https://marc.info/?l=openbsd-tech&m=169
clockintr: move clockintr_advance_random() prototype into sys/clockintr.h
statclock() is going to need this. Move the prototype into the public API.
Thread: https://marc.info/?l=openbsd-tech&m=169428749720476&w=2
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 ...
|
#
a3464c93 |
| 10-Sep-2023 |
cheloha <cheloha@openbsd.org> |
clockintr: support an arbitrary callback function argument
Callers can now provide an argument pointer to clockintr_establish(). The pointer is kept in a new struct clockintr member, cl_arg. The po
clockintr: support an arbitrary callback function argument
Callers can now provide an argument pointer to clockintr_establish(). The pointer is kept in a new struct clockintr member, cl_arg. The pointer is passed as the third parameter to clockintr.cl_func when it is executed during clockintr_dispatch(). Like the callback function, the callback argument is immutable after the clockintr is established.
At present, nothing uses this. All current clockintr_establish() callers pass a NULL arg pointer. However, I am confident that dt(4)'s profile provider will need this in the near future.
Requested by dlg@ back in March.
show more ...
|