* Schedule binuptime of the next event on all CPUs. */
| 265 | * Schedule binuptime of the next event on all CPUs. |
| 266 | */ |
| 267 | static sbintime_t |
| 268 | getnextevent(void) |
| 269 | { |
| 270 | struct pcpu_state *state; |
| 271 | sbintime_t event; |
| 272 | #ifdef SMP |
| 273 | int cpu; |
| 274 | #endif |
| 275 | #ifdef KTR |
| 276 | int c; |
| 277 | |
| 278 | c = -1; |
| 279 | #endif |
| 280 | state = DPCPU_PTR(timerstate); |
| 281 | event = state->nextevent; |
| 282 | #ifdef SMP |
| 283 | if ((timer->et_flags & ET_FLAGS_PERCPU) == 0) { |
| 284 | CPU_FOREACH(cpu) { |
| 285 | state = DPCPU_ID_PTR(cpu, timerstate); |
| 286 | if (event > state->nextevent) { |
| 287 | event = state->nextevent; |
| 288 | #ifdef KTR |
| 289 | c = cpu; |
| 290 | #endif |
| 291 | } |
| 292 | } |
| 293 | } |
| 294 | #endif |
| 295 | CTR4(KTR_SPARE2, "next at %d: next %d.%08x by %d", |
| 296 | curcpu, (int)(event >> 32), (u_int)(event & 0xffffffff), c); |
| 297 | return (event); |
| 298 | } |
| 299 | |
| 300 | /* Hardware timer callback function. */ |
| 301 | static void |