MCPcopy Create free account
hub / github.com/F-Stack/f-stack / hardclock_device_poll

Function hardclock_device_poll

freebsd/kern/kern_poll.c:293–331  ·  view source on GitHub ↗

* Hook from hardclock. Tries to schedule a netisr, but keeps track * of lost ticks due to the previous handler taking too long. * Normally, this should not happen, because polling handler should * run for a short time. However, in some cases (e.g. when there are * changes in link status etc.) the drivers take a very long time * (even in the order of milliseconds) to reset and reconfigure the

Source from the content-addressed store, hash-verified

291 * meaning either stray interrupts or delayed events.
292 */
293void
294hardclock_device_poll(void)
295{
296 static struct timeval prev_t, t;
297 int delta;
298
299 if (poll_handlers == 0 || poll_shutting_down)
300 return;
301
302 microuptime(&t);
303 delta = (t.tv_usec - prev_t.tv_usec) +
304 (t.tv_sec - prev_t.tv_sec)*1000000;
305 if (delta * hz < 500000)
306 short_ticks++;
307 else
308 prev_t = t;
309
310 if (pending_polls > 100) {
311 /*
312 * Too much, assume it has stalled (not always true
313 * see comment above).
314 */
315 stalled++;
316 pending_polls = 0;
317 phase = 0;
318 }
319
320 if (phase <= 2) {
321 if (phase != 0)
322 suspect++;
323 phase = 1;
324 netisr_poll_scheduled = 1;
325 netisr_pollmore_scheduled = 1;
326 netisr_sched_poll();
327 phase = 2;
328 }
329 if (pending_polls++ > 0)
330 lost_polls++;
331}
332
333/*
334 * ether_poll is called from the idle loop.

Callers 2

hardclockFunction · 0.85
ff_hardclockFunction · 0.85

Calls 2

microuptimeFunction · 0.85
netisr_sched_pollFunction · 0.85

Tested by

no test coverage detected