[PATCH v2 0/2] sysfs: add counters for lockups and stalls

From: Max Kellermann
Date: Sun May 04 2025 - 14:08:46 EST


Commits 9db89b411170 ("exit: Expose "oops_count" to sysfs") and
8b05aa263361 ("panic: Expose "warn_count" to sysfs") added counters
for oopses and warnings to sysfs, and these two patches do the same
for hard/soft lockups and RCU stalls.

All of these counters are useful for monitoring tools to detect
whether the machine is healthy. If the kernel has experienced a
lockup or a stall, it's probably due to a kernel bug, and I'd like to
detect that quickly and easily. There is currently no way to detect
that, other than parsing dmesg. Or observing indirect effects: such
as certain tasks not responding, but then I need to observe all tasks,
and it may take a while until these effects become visible/measurable.
I'd rather be able to detect the primary cause more quickly, possibly
before everything falls apart.

Max Kellermann (2):
kernel/watchdog: add /sys/kernel/{hard,soft}lockup_count
kernel/rcu/tree_stall: add /sys/kernel/rcu_stall_count

.../ABI/testing/sysfs-kernel-hardlockup_count | 7 +++
.../ABI/testing/sysfs-kernel-rcu_stall_count | 6 +++
.../ABI/testing/sysfs-kernel-softlockup_count | 7 +++
kernel/rcu/tree_stall.h | 26 +++++++++
kernel/watchdog.c | 53 +++++++++++++++++++
5 files changed, 99 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-kernel-hardlockup_count
create mode 100644 Documentation/ABI/testing/sysfs-kernel-rcu_stall_count
create mode 100644 Documentation/ABI/testing/sysfs-kernel-softlockup_count

--
2.47.2