Skip to content

Commit b1f02f0

Browse files
superm1rafaeljw
authored andcommitted
Documentation: power: Add document on debugging shutdown hangs
If the kernel hangs while shutting down, ideally a UART log should be captured to debug the problem. However if one isn't available, users can use the pstore functionality to retrieve logs. Add a document explaining how this works to make it more accessible to users. Tested-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org> Link: https://patch.msgid.link/20251025004341.2386868-1-superm1@kernel.org Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 1cf9c4f commit b1f02f0

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

Documentation/power/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Power Management
1919
power_supply_class
2020
runtime_pm
2121
s2ram
22+
shutdown-debugging
2223
suspend-and-cpuhotplug
2324
suspend-and-interrupts
2425
swsusp-and-swap-files
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
Debugging Kernel Shutdown Hangs with pstore
4+
+++++++++++++++++++++++++++++++++++++++++++
5+
6+
Overview
7+
========
8+
If the system hangs while shutting down, the kernel logs may need to be
9+
retrieved to debug the issue.
10+
11+
On systems that have a UART available, it is best to configure the kernel to use
12+
this UART for kernel console output.
13+
14+
If a UART isn't available, the ``pstore`` subsystem provides a mechanism to
15+
persist this data across a system reset, allowing it to be retrieved on the next
16+
boot.
17+
18+
Kernel Configuration
19+
====================
20+
To enable ``pstore`` and enable saving kernel ring buffer logs, set the
21+
following kernel configuration options:
22+
23+
* ``CONFIG_PSTORE=y``
24+
* ``CONFIG_PSTORE_CONSOLE=y``
25+
26+
Additionally, enable a backend to store the data. Depending upon your platform
27+
some options include:
28+
29+
* ``CONFIG_EFI_VARS_PSTORE=y``
30+
* ``CONFIG_PSTORE_RAM=y``
31+
* ``CONFIG_PSTORE_FIRMWARE=y``
32+
* ``CONFIG_PSTORE_BLK=y``
33+
34+
Kernel Command-line Parameters
35+
==============================
36+
Add these parameters to your kernel command line:
37+
38+
* ``printk.always_kmsg_dump=Y``
39+
* Forces the kernel to dump the entire message buffer to pstore during
40+
shutdown
41+
* ``efi_pstore.pstore_disable=N``
42+
* For EFI-based systems, ensures the EFI backend is active
43+
44+
Userspace Interaction and Log Retrieval
45+
=======================================
46+
On the next boot after a hang, pstore logs will be available in the pstore
47+
filesystem (``/sys/fs/pstore``) and can be retrieved by userspace.
48+
49+
On systemd systems, the ``systemd-pstore`` service will help do the following:
50+
51+
#. Locate pstore data in ``/sys/fs/pstore``
52+
#. Read and save it to ``/var/lib/systemd/pstore``
53+
#. Clear pstore data for the next event

0 commit comments

Comments
 (0)