clockintr: protect struct clockintr_queue with a mutex
authorcheloha <cheloha@openbsd.org>
Mon, 3 Apr 2023 00:20:24 +0000 (00:20 +0000)
committercheloha <cheloha@openbsd.org>
Mon, 3 Apr 2023 00:20:24 +0000 (00:20 +0000)
commit2137d3d7e6d6c7d63479ee572aaf6f862e03bc86
tree284db0ce832ec62fbcd3558ab9926b4cdef13e35
parent75449f5134c73bda76c8ec4a89da52e45c138e25
clockintr: protect struct clockintr_queue with a mutex

Add a mutex (cq_mtx) to stuct clockintr_queue so that arbitrary CPUs
can manipulate clock interrupts established on arbitrary CPU queues.

Refactor the bulk of clockintr_schedule() into clockintr_schedule_locked()
so we can reuse it from within the mutex.

Tested by mlarkin@.  Neat bug found by mlarkin@.  With tweaks from
kettenis@.

ok kettenis@
sys/kern/kern_clockintr.c
sys/sys/clockintr.h