Diff. between CPU Hard-lockup and Soft-lockup

Dave Hylands dhylands at gmail.com
Tue Jan 31 11:20:46 EST 2012

Hi Devendra,

On Tue, Jan 31, 2012 at 1:28 AM, devendra rawat
<devendra.rawat.singh at gmail.com> wrote:
> Hi,
> What are the Differences between CPU Hard-lockup and Soft-lockup.

When the watchdog is enabled, there is a HW timer that counts down. If
the HW timer reaches 0, then it asserts (triggers an NMI or processor
RESET). Normally, the watchdog has something like a 30 second timeout,
and there is a watchdog thread which runs with a low real-time
priority. So that places it at a higher priority than all of the
normal threads.

The watchdog normally kicks (resets) the timer once per second. When
the timer reaches zero, then the hardlockup has considered to occur.
On some architectures, this will cause an NMI (non-maskable interrupt)
to fire. On architectures which don't support NMI, a reset will occur
(in the reset case you get no reporting of hard lockup - the processor
just reboots).

If the watchdog timer interrupt is running, but the watchdog thread is
not running for some period of time, then this is considered a soft
lockup. Because the watchdog timer interrupt is running, we know that
interrupts are enabled. The fact that the watchdog thread is not
running means either that context switching has been disabled, or some
interrupt or higher priority real-time thread is consuming 100% of the

One common reason for hard-lockup is to disable interrupts and not
reenable them.
One common reason for soft lockup is when interrupts fire continuously
(typically happens when writing a new drive and you forgot to deal
with a particular interrupt source).

Dave Hylands
Shuswap, BC, Canada

More information about the Kernelnewbies mailing list