# What is kernel soft lockup?

**URL:** <https://linux-tips.com/t/what-is-kernel-soft-lockup/78>\
**Category:** Kernel\
**Created:** [February 18, 2015, 10:21pm UTC](https://linux-tips.com/t/what-is-kernel-soft-lockup/78 "2015-02-18T22:21:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaskoX](https://linux-tips.com/user_avatar/linux-tips.com/raskox/32/92_2.png) [@RaskoX](https://linux-tips.com/u/RaskoX)\
**Post date:** [February 18, 2015, 10:21pm UTC](https://linux-tips.com/t/what-is-kernel-soft-lockup/78/1 "2015-02-18T22:21:24Z")

</div>

I’m continuously getting errors from kernel on one of the my system as below:

```
BUG: soft lockup - CPU#0 stuck for 15s!
...
BUG: soft lockup - CPU#2 stuck for 24s!

```

As you can see, cpu id and duration changes but problem is same. What is the main reason for this?

---

<div class="post-metadata">

**Author:** ![demirten](https://linux-tips.com/user_avatar/linux-tips.com/demirten/32/64_2.png) [@demirten](https://linux-tips.com/u/demirten)\
**Post date:** [February 20, 2015, 3:07pm UTC](https://linux-tips.com/t/what-is-kernel-soft-lockup/78/2 "2015-02-20T15:07:51Z")

</div>

Linux kernel starts a watchdog thread for each of the CPU core in the system. You can see this threads:

```
$ ps uax | grep watchdog
root 10 0.0 0.0 0 0 ? S Feb19 0:00 [watchdog/0]
root 11 0.0 0.0 0 0 ? S Feb19 0:00 [watchdog/1]
root 16 0.0 0.0 0 0 ? S Feb19 0:00 [watchdog/2]
root 21 0.0 0.0 0 0 ? S Feb19 0:00 [watchdog/3]

```

In above example we can see that total of 4 watchdog threads created by the kernel itself.

Watchdog tasks are high priority kernel threads that gets current timestamp every time it is scheduled and save the value in a per-CPU data structure.

If that timestamp is not updated for `2 x watchdog_thresh seconds` (the softlockup threshold) the _softlockup detector_ will dump useful debug information to the system log, after which it will call panic (through _kernel.softlockup\_panic_ sysctl variable) if it was instructed to do so or resume execution of  
other kernel code.

User mode processes can not make soft lockups, they are always re-scheduled by the kernel. Soft lockups only occurs in kernel mode codes which can be a buggy driver etc.
