kern_timeout.c revision 1.23 1 /* $NetBSD: kern_timeout.c,v 1.23 2007/07/10 21:12:32 ad Exp $ */
2
3 /*-
4 * Copyright (c) 2003, 2006, 2007 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe, and by Andrew Doran.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 /*
40 * Copyright (c) 2001 Thomas Nordin <nordin (at) openbsd.org>
41 * Copyright (c) 2000-2001 Artur Grabowski <art (at) openbsd.org>
42 * All rights reserved.
43 *
44 * Redistribution and use in source and binary forms, with or without
45 * modification, are permitted provided that the following conditions
46 * are met:
47 *
48 * 1. Redistributions of source code must retain the above copyright
49 * notice, this list of conditions and the following disclaimer.
50 * 2. Redistributions in binary form must reproduce the above copyright
51 * notice, this list of conditions and the following disclaimer in the
52 * documentation and/or other materials provided with the distribution.
53 * 3. The name of the author may not be used to endorse or promote products
54 * derived from this software without specific prior written permission.
55 *
56 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
57 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
58 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
59 * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
60 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
61 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
62 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
63 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
64 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
65 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
66 */
67
68 #include <sys/cdefs.h>
69 __KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.23 2007/07/10 21:12:32 ad Exp $");
70
71 /*
72 * Timeouts are kept in a hierarchical timing wheel. The c_time is the
73 * value of the global variable "hardclock_ticks" when the timeout should
74 * be called. There are four levels with 256 buckets each. See 'Scheme 7'
75 * in "Hashed and Hierarchical Timing Wheels: Efficient Data Structures
76 * for Implementing a Timer Facility" by George Varghese and Tony Lauck.
77 *
78 * Some of the "math" in here is a bit tricky. We have to beware of
79 * wrapping ints.
80 *
81 * We use the fact that any element added to the queue must be added with
82 * a positive time. That means that any element `to' on the queue cannot
83 * be scheduled to timeout further in time than INT_MAX, but c->c_time can
84 * be positive or negative so comparing it with anything is dangerous.
85 * The only way we can use the c->c_time value in any predictable way is
86 * when we calculate how far in the future `to' will timeout - "c->c_time
87 * - hardclock_ticks". The result will always be positive for future
88 * timeouts and 0 or negative for due timeouts.
89 */
90
91 #include <sys/param.h>
92 #include <sys/systm.h>
93 #include <sys/kernel.h>
94 #include <sys/lock.h>
95 #include <sys/callout.h>
96 #include <sys/mutex.h>
97 #include <sys/proc.h>
98 #include <sys/sleepq.h>
99 #include <sys/syncobj.h>
100 #include <sys/evcnt.h>
101
102 #include <machine/intr.h>
103
104 #ifdef DDB
105 #include <machine/db_machdep.h>
106 #include <ddb/db_interface.h>
107 #include <ddb/db_access.h>
108 #include <ddb/db_sym.h>
109 #include <ddb/db_output.h>
110 #endif
111
112 #define BUCKETS 1024
113 #define WHEELSIZE 256
114 #define WHEELMASK 255
115 #define WHEELBITS 8
116
117 static struct callout_circq timeout_wheel[BUCKETS]; /* Queues of timeouts */
118 static struct callout_circq timeout_todo; /* Worklist */
119
120 #define MASKWHEEL(wheel, time) (((time) >> ((wheel)*WHEELBITS)) & WHEELMASK)
121
122 #define BUCKET(rel, abs) \
123 (((rel) <= (1 << (2*WHEELBITS))) \
124 ? ((rel) <= (1 << WHEELBITS)) \
125 ? &timeout_wheel[MASKWHEEL(0, (abs))] \
126 : &timeout_wheel[MASKWHEEL(1, (abs)) + WHEELSIZE] \
127 : ((rel) <= (1 << (3*WHEELBITS))) \
128 ? &timeout_wheel[MASKWHEEL(2, (abs)) + 2*WHEELSIZE] \
129 : &timeout_wheel[MASKWHEEL(3, (abs)) + 3*WHEELSIZE])
130
131 #define MOVEBUCKET(wheel, time) \
132 CIRCQ_APPEND(&timeout_todo, \
133 &timeout_wheel[MASKWHEEL((wheel), (time)) + (wheel)*WHEELSIZE])
134
135 /*
136 * Circular queue definitions.
137 */
138
139 #define CIRCQ_INIT(list) \
140 do { \
141 (list)->cq_next_l = (list); \
142 (list)->cq_prev_l = (list); \
143 } while (/*CONSTCOND*/0)
144
145 #define CIRCQ_INSERT(elem, list) \
146 do { \
147 (elem)->cq_prev_e = (list)->cq_prev_e; \
148 (elem)->cq_next_l = (list); \
149 (list)->cq_prev_l->cq_next_l = (elem); \
150 (list)->cq_prev_l = (elem); \
151 } while (/*CONSTCOND*/0)
152
153 #define CIRCQ_APPEND(fst, snd) \
154 do { \
155 if (!CIRCQ_EMPTY(snd)) { \
156 (fst)->cq_prev_l->cq_next_l = (snd)->cq_next_l; \
157 (snd)->cq_next_l->cq_prev_l = (fst)->cq_prev_l; \
158 (snd)->cq_prev_l->cq_next_l = (fst); \
159 (fst)->cq_prev_l = (snd)->cq_prev_l; \
160 CIRCQ_INIT(snd); \
161 } \
162 } while (/*CONSTCOND*/0)
163
164 #define CIRCQ_REMOVE(elem) \
165 do { \
166 (elem)->cq_next_l->cq_prev_e = (elem)->cq_prev_e; \
167 (elem)->cq_prev_l->cq_next_e = (elem)->cq_next_e; \
168 } while (/*CONSTCOND*/0)
169
170 #define CIRCQ_FIRST(list) ((list)->cq_next_e)
171 #define CIRCQ_NEXT(elem) ((elem)->cq_next_e)
172 #define CIRCQ_LAST(elem,list) ((elem)->cq_next_l == (list))
173 #define CIRCQ_EMPTY(list) ((list)->cq_next_l == (list))
174
175 static void callout_softclock(void *);
176
177 /*
178 * All wheels are locked with the same lock (which must also block out
179 * all interrupts). Eventually this should become per-CPU.
180 */
181 kmutex_t callout_lock;
182 sleepq_t callout_sleepq;
183 void *callout_si;
184
185 static struct evcnt callout_ev_late;
186 static struct evcnt callout_ev_block;
187
188 /*
189 * callout_barrier:
190 *
191 * If the callout is already running, wait until it completes.
192 * XXX This should do priority inheritance.
193 */
194 static void
195 callout_barrier(callout_impl_t *c)
196 {
197 extern syncobj_t sleep_syncobj;
198 struct cpu_info *ci;
199 struct lwp *l;
200
201 l = curlwp;
202
203 if ((c->c_flags & CALLOUT_MPSAFE) == 0) {
204 /*
205 * Note: we must be called with the kernel lock held,
206 * as we use it to synchronize with callout_softclock().
207 */
208 ci = c->c_oncpu;
209 ci->ci_data.cpu_callout_cancel = c;
210 return;
211 }
212
213 while ((ci = c->c_oncpu) != NULL && ci->ci_data.cpu_callout == c) {
214 KASSERT(l->l_wchan == NULL);
215
216 ci->ci_data.cpu_callout_nwait++;
217 callout_ev_block.ev_count++;
218
219 lwp_lock(l);
220 lwp_unlock_to(l, &callout_lock);
221 sleepq_enqueue(&callout_sleepq, sched_kpri(l), ci,
222 "callout", &sleep_syncobj);
223 sleepq_block(0, false);
224 mutex_spin_enter(&callout_lock);
225 }
226 }
227
228 /*
229 * callout_running:
230 *
231 * Return non-zero if callout 'c' is currently executing.
232 */
233 static inline bool
234 callout_running(callout_impl_t *c)
235 {
236 struct cpu_info *ci;
237
238 if ((ci = c->c_oncpu) == NULL)
239 return false;
240 if (ci->ci_data.cpu_callout != c)
241 return false;
242 if (c->c_onlwp == curlwp)
243 return false;
244 return true;
245 }
246
247 /*
248 * callout_startup:
249 *
250 * Initialize the callout facility, called at system startup time.
251 */
252 void
253 callout_startup(void)
254 {
255 int b;
256
257 KASSERT(sizeof(callout_impl_t) <= sizeof(callout_t));
258
259 CIRCQ_INIT(&timeout_todo);
260 for (b = 0; b < BUCKETS; b++)
261 CIRCQ_INIT(&timeout_wheel[b]);
262
263 mutex_init(&callout_lock, MUTEX_SPIN, IPL_SCHED);
264 sleepq_init(&callout_sleepq, &callout_lock);
265
266 evcnt_attach_dynamic(&callout_ev_late, EVCNT_TYPE_MISC,
267 NULL, "callout", "late");
268 evcnt_attach_dynamic(&callout_ev_block, EVCNT_TYPE_MISC,
269 NULL, "callout", "block waiting");
270 }
271
272 /*
273 * callout_startup2:
274 *
275 * Complete initialization once soft interrupts are available.
276 */
277 void
278 callout_startup2(void)
279 {
280
281 callout_si = softintr_establish(IPL_SOFTCLOCK,
282 callout_softclock, NULL);
283 if (callout_si == NULL)
284 panic("callout_startup2: unable to register softclock intr");
285 }
286
287 /*
288 * callout_init:
289 *
290 * Initialize a callout structure.
291 */
292 void
293 callout_init(callout_t *cs, u_int flags)
294 {
295 callout_impl_t *c = (callout_impl_t *)cs;
296
297 KASSERT((flags & ~CALLOUT_FLAGMASK) == 0);
298
299 memset(c, 0, sizeof(*c));
300 c->c_flags = flags;
301 c->c_magic = CALLOUT_MAGIC;
302 }
303
304 /*
305 * callout_destroy:
306 *
307 * Destroy a callout structure. The callout must be stopped.
308 */
309 void
310 callout_destroy(callout_t *cs)
311 {
312 callout_impl_t *c = (callout_impl_t *)cs;
313
314 /*
315 * It's not necessary to lock in order to see the correct value
316 * of c->c_flags. If the callout could potentially have been
317 * running, the current thread should have stopped it.
318 */
319 KASSERT((c->c_flags & CALLOUT_PENDING) == 0);
320 if (c->c_oncpu != NULL) {
321 KASSERT(
322 ((struct cpu_info *)c->c_oncpu)->ci_data.cpu_callout != c);
323 }
324 KASSERT(c->c_magic == CALLOUT_MAGIC);
325
326 c->c_magic = 0;
327 }
328
329
330 /*
331 * callout_reset:
332 *
333 * Reset a callout structure with a new function and argument, and
334 * schedule it to run.
335 */
336 void
337 callout_reset(callout_t *cs, int to_ticks, void (*func)(void *), void *arg)
338 {
339 callout_impl_t *c = (callout_impl_t *)cs;
340 int old_time;
341
342 KASSERT(to_ticks >= 0);
343 KASSERT(c->c_magic == CALLOUT_MAGIC);
344 KASSERT(func != NULL);
345
346 mutex_spin_enter(&callout_lock);
347
348 /* Initialize the time here, it won't change. */
349 old_time = c->c_time;
350 c->c_time = to_ticks + hardclock_ticks;
351 c->c_flags &= ~CALLOUT_FIRED;
352
353 c->c_func = func;
354 c->c_arg = arg;
355
356 /*
357 * If this timeout is already scheduled and now is moved
358 * earlier, reschedule it now. Otherwise leave it in place
359 * and let it be rescheduled later.
360 */
361 if ((c->c_flags & CALLOUT_PENDING) != 0) {
362 if (c->c_time - old_time < 0) {
363 CIRCQ_REMOVE(&c->c_list);
364 CIRCQ_INSERT(&c->c_list, &timeout_todo);
365 }
366 } else {
367 c->c_flags |= CALLOUT_PENDING;
368 CIRCQ_INSERT(&c->c_list, &timeout_todo);
369 }
370
371 mutex_spin_exit(&callout_lock);
372 }
373
374 /*
375 * callout_schedule:
376 *
377 * Schedule a callout to run. The function and argument must
378 * already be set in the callout structure.
379 */
380 void
381 callout_schedule(callout_t *cs, int to_ticks)
382 {
383 callout_impl_t *c = (callout_impl_t *)cs;
384 int old_time;
385
386 KASSERT(to_ticks >= 0);
387 KASSERT(c->c_magic == CALLOUT_MAGIC);
388 KASSERT(c->c_func != NULL);
389
390 mutex_spin_enter(&callout_lock);
391
392 /* Initialize the time here, it won't change. */
393 old_time = c->c_time;
394 c->c_time = to_ticks + hardclock_ticks;
395 c->c_flags &= ~CALLOUT_FIRED;
396
397 /*
398 * If this timeout is already scheduled and now is moved
399 * earlier, reschedule it now. Otherwise leave it in place
400 * and let it be rescheduled later.
401 */
402 if ((c->c_flags & CALLOUT_PENDING) != 0) {
403 if (c->c_time - old_time < 0) {
404 CIRCQ_REMOVE(&c->c_list);
405 CIRCQ_INSERT(&c->c_list, &timeout_todo);
406 }
407 } else {
408 c->c_flags |= CALLOUT_PENDING;
409 CIRCQ_INSERT(&c->c_list, &timeout_todo);
410 }
411
412 mutex_spin_exit(&callout_lock);
413 }
414
415 /*
416 * callout_stop:
417 *
418 * Cancel a pending callout.
419 */
420 bool
421 callout_stop(callout_t *cs)
422 {
423 callout_impl_t *c = (callout_impl_t *)cs;
424 bool expired;
425
426 KASSERT(c->c_magic == CALLOUT_MAGIC);
427
428 mutex_spin_enter(&callout_lock);
429
430 if (callout_running(c))
431 callout_barrier(c);
432
433 if ((c->c_flags & CALLOUT_PENDING) != 0)
434 CIRCQ_REMOVE(&c->c_list);
435
436 expired = ((c->c_flags & CALLOUT_FIRED) != 0);
437 c->c_flags &= ~(CALLOUT_PENDING|CALLOUT_FIRED);
438
439 mutex_spin_exit(&callout_lock);
440
441 return expired;
442 }
443
444 void
445 callout_setfunc(callout_t *cs, void (*func)(void *), void *arg)
446 {
447 callout_impl_t *c = (callout_impl_t *)cs;
448
449 KASSERT(c->c_magic == CALLOUT_MAGIC);
450
451 mutex_spin_enter(&callout_lock);
452 c->c_func = func;
453 c->c_arg = arg;
454 mutex_spin_exit(&callout_lock);
455 }
456
457 bool
458 callout_expired(callout_t *cs)
459 {
460 callout_impl_t *c = (callout_impl_t *)cs;
461 bool rv;
462
463 KASSERT(c->c_magic == CALLOUT_MAGIC);
464
465 mutex_spin_enter(&callout_lock);
466 rv = ((c->c_flags & CALLOUT_FIRED) != 0);
467 mutex_spin_exit(&callout_lock);
468
469 return rv;
470 }
471
472 bool
473 callout_active(callout_t *cs)
474 {
475 callout_impl_t *c = (callout_impl_t *)cs;
476 bool rv;
477
478 KASSERT(c->c_magic == CALLOUT_MAGIC);
479
480 mutex_spin_enter(&callout_lock);
481 rv = ((c->c_flags & (CALLOUT_PENDING|CALLOUT_FIRED)) != 0);
482 mutex_spin_exit(&callout_lock);
483
484 return rv;
485 }
486
487 bool
488 callout_pending(callout_t *cs)
489 {
490 callout_impl_t *c = (callout_impl_t *)cs;
491 bool rv;
492
493 KASSERT(c->c_magic == CALLOUT_MAGIC);
494
495 mutex_spin_enter(&callout_lock);
496 rv = ((c->c_flags & CALLOUT_PENDING) != 0);
497 mutex_spin_exit(&callout_lock);
498
499 return rv;
500 }
501
502 bool
503 callout_invoking(callout_t *cs)
504 {
505 callout_impl_t *c = (callout_impl_t *)cs;
506 bool rv;
507
508 KASSERT(c->c_magic == CALLOUT_MAGIC);
509
510 mutex_spin_enter(&callout_lock);
511 rv = ((c->c_flags & CALLOUT_INVOKING) != 0);
512 mutex_spin_exit(&callout_lock);
513
514 return rv;
515 }
516
517 void
518 callout_ack(callout_t *cs)
519 {
520 callout_impl_t *c = (callout_impl_t *)cs;
521
522 KASSERT(c->c_magic == CALLOUT_MAGIC);
523
524 mutex_spin_enter(&callout_lock);
525 c->c_flags &= ~CALLOUT_INVOKING;
526 mutex_spin_exit(&callout_lock);
527 }
528
529 /*
530 * This is called from hardclock() once every tick.
531 * We schedule callout_softclock() if there is work
532 * to be done.
533 */
534 void
535 callout_hardclock(void)
536 {
537 int needsoftclock;
538
539 mutex_spin_enter(&callout_lock);
540
541 MOVEBUCKET(0, hardclock_ticks);
542 if (MASKWHEEL(0, hardclock_ticks) == 0) {
543 MOVEBUCKET(1, hardclock_ticks);
544 if (MASKWHEEL(1, hardclock_ticks) == 0) {
545 MOVEBUCKET(2, hardclock_ticks);
546 if (MASKWHEEL(2, hardclock_ticks) == 0)
547 MOVEBUCKET(3, hardclock_ticks);
548 }
549 }
550
551 needsoftclock = !CIRCQ_EMPTY(&timeout_todo);
552 mutex_spin_exit(&callout_lock);
553
554 if (needsoftclock)
555 softintr_schedule(callout_si);
556 }
557
558 /* ARGSUSED */
559 static void
560 callout_softclock(void *v)
561 {
562 callout_impl_t *c;
563 struct cpu_info *ci;
564 void (*func)(void *);
565 void *arg;
566 u_int mpsafe, count;
567 lwp_t *l;
568
569 l = curlwp;
570 ci = l->l_cpu;
571
572 mutex_spin_enter(&callout_lock);
573
574 while (!CIRCQ_EMPTY(&timeout_todo)) {
575 c = CIRCQ_FIRST(&timeout_todo);
576 KASSERT(c->c_magic == CALLOUT_MAGIC);
577 KASSERT(c->c_func != NULL);
578 CIRCQ_REMOVE(&c->c_list);
579
580 /* If due run it, otherwise insert it into the right bucket. */
581 if (c->c_time - hardclock_ticks > 0) {
582 CIRCQ_INSERT(&c->c_list,
583 BUCKET((c->c_time - hardclock_ticks), c->c_time));
584 } else {
585 if (c->c_time - hardclock_ticks < 0)
586 callout_ev_late.ev_count++;
587
588 c->c_flags ^= (CALLOUT_PENDING | CALLOUT_FIRED);
589 mpsafe = (c->c_flags & CALLOUT_MPSAFE);
590 func = c->c_func;
591 arg = c->c_arg;
592 c->c_oncpu = ci;
593 c->c_onlwp = l;
594
595 mutex_spin_exit(&callout_lock);
596 if (!mpsafe) {
597 KERNEL_LOCK(1, curlwp);
598 if (ci->ci_data.cpu_callout_cancel != c)
599 (*func)(arg);
600 KERNEL_UNLOCK_ONE(curlwp);
601 } else
602 (*func)(arg);
603 mutex_spin_enter(&callout_lock);
604
605 /*
606 * We can't touch 'c' here because it might be
607 * freed already. If LWPs waiting for callout
608 * to complete, awaken them.
609 */
610 ci->ci_data.cpu_callout_cancel = NULL;
611 ci->ci_data.cpu_callout = NULL;
612 if ((count = ci->ci_data.cpu_callout_nwait) != 0) {
613 ci->ci_data.cpu_callout_nwait = 0;
614 /* sleepq_wake() drops the lock. */
615 sleepq_wake(&callout_sleepq, ci, count);
616 mutex_spin_enter(&callout_lock);
617 }
618 }
619 }
620
621 mutex_spin_exit(&callout_lock);
622 }
623
624 #ifdef DDB
625 static void
626 db_show_callout_bucket(struct callout_circq *bucket)
627 {
628 callout_impl_t *c;
629 db_expr_t offset;
630 const char *name;
631 static char question[] = "?";
632
633 if (CIRCQ_EMPTY(bucket))
634 return;
635
636 for (c = CIRCQ_FIRST(bucket); /*nothing*/; c = CIRCQ_NEXT(&c->c_list)) {
637 db_find_sym_and_offset((db_addr_t)(intptr_t)c->c_func, &name,
638 &offset);
639 name = name ? name : question;
640 #ifdef _LP64
641 #define POINTER_WIDTH "%16lx"
642 #else
643 #define POINTER_WIDTH "%8lx"
644 #endif
645 db_printf("%9d %2d/%-4d " POINTER_WIDTH " %s\n",
646 c->c_time - hardclock_ticks,
647 (int)((bucket - timeout_wheel) / WHEELSIZE),
648 (int)(bucket - timeout_wheel), (u_long) c->c_arg, name);
649
650 if (CIRCQ_LAST(&c->c_list, bucket))
651 break;
652 }
653 }
654
655 void
656 db_show_callout(db_expr_t addr, bool haddr, db_expr_t count, const char *modif)
657 {
658 int b;
659
660 db_printf("hardclock_ticks now: %d\n", hardclock_ticks);
661 #ifdef _LP64
662 db_printf(" ticks wheel arg func\n");
663 #else
664 db_printf(" ticks wheel arg func\n");
665 #endif
666
667 /*
668 * Don't lock the callwheel; all the other CPUs are paused
669 * anyhow, and we might be called in a circumstance where
670 * some other CPU was paused while holding the lock.
671 */
672
673 db_show_callout_bucket(&timeout_todo);
674 for (b = 0; b < BUCKETS; b++)
675 db_show_callout_bucket(&timeout_wheel[b]);
676 }
677 #endif /* DDB */
678