lockup detector in kernel

Soft lockup and hardlockup

Doc

1. 抢占被长时间关闭而导致进程无法调度(soft lockup)

2. 中断被长时间关闭而导致更严重的问题(hard lockup)

More info please refer to Documentations/lockup_watchdogs.txt

Code

Implementedin kernel/watchdog.c, based on 3.14 code

watchdog_thresh= 10s

1.     系统起来的时候,为每一个cpu创建一个线程watchdog/0, watchdog/1, etc.

2.   每一个线程per_cpu创建一个hrtimer, 并且hrtimer的function watchdog_timer_fn每sample_period(watchdog_thresh*2/5=4s)执行一次

3.   在watchdog_timer_fn中,每3次sample_period检查next_cpu的hrtimer中断计数有无增加,如果没有,则表示next_cpu的中断被 disable了12s了,hard lockup.

4.   在watchdog_timer_fn中,检查现在的时间戳与上次watchdog进程上次被调度的时间戳是否大于2*watchdog_thresh=20s,是的话,表示soft lockup.


你可能感兴趣的:(kernel)