Skip to content

Enable hung_task and lockup cases to dump system info on demand

Feng Tang lkml 2 versions – Applied

Status from this message: I queued the below, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 13 repliesApplied 3/4
  2. v13 patches 11 repliesSuperseded

Changes in v2 from the cover letter

* Add 0004 patch to add the default kernel sys_info knob (Andrew)
* Simplify the code for hung_sys_info (Petr)
* Use separate sys_info interface for hardlockup and softlockpu (Petr)
* Consider the ALL_CPU_BT handling for hardlockup case (Petr)
* Collect Reviewd-by tags.
* Put soft/hard sys_info knob into correct kernel config domain.

Patches in v2 Applied · 3/4

#Subject and filesSizeRepliesApplied
1/4docs: panic: correct some sys_ifo names in sysctl docDocumentation/admin-guide/sysctl/kernel.rst+2 -20 repliesApplied
2/4hung_task: Add hung_task_sys_info sysctl to dump sys info on task-hungDocumentation/admin-guide/sysctl/kernel.rst kernel/hung_task.c+43 -2412 replies
3/4watchdog: add sys_info sysctls to dump sys info on system lockupDocumentation/admin-guide/sysctl/kernel.rst kernel/watchdog.c+46 -31 replyApplied
4/4sys_info: add a default kernel sys_info maskDocumentation/admin-guide/sysctl/kernel.rst lib/sys_info.c+39 -10 repliesApplied

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchPetr MladekLance Yang
1/4R-b
2/4R-b R-b
3/4R-b
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/4] Enable hung_task and lockup cases to dump system info on demand

When working on kernel stability issues: panic, task-hung and soft/hard lockup are frequently met. And to debug them, user may need lots of system information at that time, like task call stacks, lock info, memory info, ftrace dump, etc.

panic case already uses sys_info() for this purpose, and has a 'panic_sys_info' sysctl(also support cmdline setup) interface to take human readable string like "tasks,mem,timers,locks,ftrace,..." to control what kinds of information is needed. Which is also helpful to debug task-hung and lockup cases.

So this patchset introduces the similar sys_info sysctl interface for task-hung and lockup cases.

Please be noted, this is mainly for debugging and the info dumping could be intrusive, like dumping call stack for all tasks when system has huge number of tasks, similarly for ftrace dump (we may add tracing_stop() and tracing_start() around it)

Locally these have been used in our bug chasing for stability issues and was helpful.

As Andrew suggested, add a configurable global 'kernel_sys_info' knob. When error scenarios like panic/hung-task/lockup etc doesn't setup their own sys_info knob and calls sys_info() with parameter "0", this global knob will take effect. It could be used for other kernel cases like OOM, which may not need one dedicated sys_info knob.

Codewise, these 4 patches are independent to each other and could be applied separately.

Please help to review, thanks!

- Feng

Changelog:

v2:
* Add 0004 patch to add the default kernel sys_info knob (Andrew)
* Simplify the code for hung_sys_info (Petr)
* Use separate sys_info interface for hardlockup and softlockpu (Petr)
* Consider the ALL_CPU_BT handling for hardlockup case (Petr)
* Collect Reviewd-by tags.
* Put soft/hard sys_info knob into correct kernel config domain.

Feng Tang (4):
docs: panic: correct some sys_ifo names in sysctl doc
hung_task: Add hung_task_sys_info sysctl to dump sys info on task-hung
watchdog: add sys_info sysctls to dump sys info on system lockup
sys_info: add a default kernel sys_info mask

 Documentation/admin-guide/sysctl/kernel.rst | 23 +++++++-
 kernel/hung_task.c                          | 62 +++++++++++++--------
 kernel/watchdog.c                           | 44 ++++++++++++++-
 lib/sys_info.c                              | 31 ++++++++++-
 4 files changed, 130 insertions(+), 30 deletions(-)

--
2.43.5