help in developing soft and hardlockup detection tool

Peter Teoh htmldeveloper at
Sun Dec 15 20:25:21 EST 2013

i think the logic is not possible and does not make sense.   essentially
you cannot disable interrupt and loop for 11 seconds and reenable interrupt
after that.    this is because the timer is not going to trigger you once
the interrupt is disabled.   but u can of course do some pre-calculation:
for your CPU, for platform, do a precise low level accurate timing of CPU
to assess how many instructions of a certain types is need to achieve a
duration, say 1 microsecond.   then you implement a deterministic loop of 1
million loop to exactly implement a timing delay of 1 second for ONE cpu.
you can disable interrupt before entering that deterministic loop.   and
once out of loop, u can enable interrupt again.

the whole operation has to be precisely calculated and extrapolated from
microseconds to seconds, and it really varies from CPU to CPU, or even same
CPU in different platform.   and btw, normal kernel operation is always
with interrupt enabled, so all performance timestamping measurement will be
very different in your constraint of disabling interrupt, which u are
trying to do to simulate hardlockup.

On Sun, Dec 15, 2013 at 4:27 PM, Vipul Jain <vipulsj at> wrote:

> Hi,
> I would like to write a kernel module that will induce the softlockup and
> hardlockup on the cpu core(s). Below is my logic and was wondering if some
> one can help me verify and guide me creating a thread and other stuff for
> implementing the logic.
> softlockup:
> on given cpu number.
> 1. disable kernel preemption
> 2. keep looping for 21 seconds (as per kernel Documentation it takes 20
> seconds to detect and I would like to recover the system once its detected).
> 3. release the cpu
> hardlockup
> on given cpu number.
> 1. disable interrrupts.
> 2. keep looping for 11 seconds.
> 3. enable interrupts and release cpu.
> Regards,
> Vipul.
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at

Peter Teoh
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Kernelnewbies mailing list