The kernel functions that are involved in the scenario leading to the hard lockup panic are:
watchdog_timer_fn
This is a high-resolution timer function that updates a CPU-specific interrupt counter periodically while executing in interrupt context.
watchdog_overflow_callback
This function is invoked from Non-Maskable Interrupt (NMI) context. If a CPU is busy, this function executes periodically and it checks whether watchdog_timer_fn has incremented the CPU-specific counter during the past interval. If the counter has not been incremented, watchdog_overflow_callback assumes that the CPU is 'locked up' in a section of kernel code where interrupts are disabled, and a panic occurs unless 'panic on hard lockup' is explicitly disabled via the nmi_watchdog=nopanic parameter on the kernel command line.
For this watchdog mechanism it is essential that watchdog_timer_fn is invoked at a significantly higher rate than watchdog_overflow_callback, so that watchdog_timer_fn gets a chance to increment the CPU-specific interrupt counter at least once during watchdog_overflow_callback's interval for example, as shown in the following diagram:
watchdog_timer_fn executes on CPU N approx. at t1, t2, t3, etc.
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|-> time
t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16
|---------|---------|---------|---------|---------|---------|-> time
o1 o2 o3 o4 o5 o6 o7
watchdog_overflow_callback executes on CPU N approx. at o1, o2, o3, etc.
The interval for watchdog_timer_fn and watchdog_overflow_callback is derived from the /proc/sys/kernel/watchdog_thresh parameter. The value of this parameter is 10 by default. Due to a flaw in the watchdog code, only the interval for watchdog_timer_fn is adjusted if the parameter value is changed (for example, via an entry in sysctl.conf). If the new value is higher than the default, it is possible that watchdog_overflow_callback will execute at a higher rate than watchdog_timer_fn on a busy CPU, and thus watchdog_overflow_callback will not observe an increase of the CPU-specific interrupt counter, as shown in the following diagram.
watchdog_timer_fn executes on CPU N approx. at t1, t2, t3, etc.
|-----------------------|-----------------------|->
t1 t2 t3
no counter increase
|---------|---------|---------|---------|---------|---------|-> time
o1 o2 o3 o4 o5 o6 o7
watchdog_overflow_callback executes on CPU N approx. at o1, o2, o3, etc.
Hence, it is possible that the hard lockup detector yields a false positive: A panic will occur at o2 even though the CPU is actually not 'locked up'.