Skip to content

Commit b1f4c36

Browse files
Baoquan HeJonathan Corbet
authored andcommitted
Documentation: kdump: update kdump guide
Some parts of the guide are aged, hence need be updated. 1) The backup area of the 1st 640K on X86_64 has been removed by below commits, update the description accordingly. commit 7c321eb ("x86/kdump: Remove the backup region handling") commit 6f599d8 ("x86/kdump: Always reserve the low 1M when the crashkernel option is specified") 2) Sort out the descripiton of "crashkernel syntax" part. 3) And some other minor cleanups. Signed-off-by: Baoquan He <bhe@redhat.com> Acked-by: Dave Young <dyoung@redhat.com> Link: https://lore.kernel.org/r/20210609083218.GB591017@MiWiFi-R3L-srv [jc: added blank line to fix added build warning] Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent d7c176e commit b1f4c36

1 file changed

Lines changed: 109 additions & 61 deletions

File tree

Documentation/admin-guide/kdump/kdump.rst

Lines changed: 109 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Documentation for Kdump - The kexec-based Crash Dumping Solution
33
================================================================
44

5-
This document includes overview, setup and installation, and analysis
5+
This document includes overview, setup, installation, and analysis
66
information.
77

88
Overview
@@ -13,9 +13,9 @@ dump of the system kernel's memory needs to be taken (for example, when
1313
the system panics). The system kernel's memory image is preserved across
1414
the reboot and is accessible to the dump-capture kernel.
1515

16-
You can use common commands, such as cp and scp, to copy the
17-
memory image to a dump file on the local disk, or across the network to
18-
a remote system.
16+
You can use common commands, such as cp, scp or makedumpfile to copy
17+
the memory image to a dump file on the local disk, or across the network
18+
to a remote system.
1919

2020
Kdump and kexec are currently supported on the x86, x86_64, ppc64, ia64,
2121
s390x, arm and arm64 architectures.
@@ -26,13 +26,15 @@ the dump-capture kernel. This ensures that ongoing Direct Memory Access
2626
The kexec -p command loads the dump-capture kernel into this reserved
2727
memory.
2828

29-
On x86 machines, the first 640 KB of physical memory is needed to boot,
30-
regardless of where the kernel loads. Therefore, kexec backs up this
31-
region just before rebooting into the dump-capture kernel.
29+
On x86 machines, the first 640 KB of physical memory is needed for boot,
30+
regardless of where the kernel loads. For simpler handling, the whole
31+
low 1M is reserved to avoid any later kernel or device driver writing
32+
data into this area. Like this, the low 1M can be reused as system RAM
33+
by kdump kernel without extra handling.
3234

33-
Similarly on PPC64 machines first 32KB of physical memory is needed for
34-
booting regardless of where the kernel is loaded and to support 64K page
35-
size kexec backs up the first 64KB memory.
35+
On PPC64 machines first 32KB of physical memory is needed for booting
36+
regardless of where the kernel is loaded and to support 64K page size
37+
kexec backs up the first 64KB memory.
3638

3739
For s390x, when kdump is triggered, the crashkernel region is exchanged
3840
with the region [0, crashkernel region size] and then the kdump kernel
@@ -46,14 +48,14 @@ passed to the dump-capture kernel through the elfcorehdr= boot
4648
parameter. Optionally the size of the ELF header can also be passed
4749
when using the elfcorehdr=[size[KMG]@]offset[KMG] syntax.
4850

49-
5051
With the dump-capture kernel, you can access the memory image through
5152
/proc/vmcore. This exports the dump as an ELF-format file that you can
52-
write out using file copy commands such as cp or scp. Further, you can
53-
use analysis tools such as the GNU Debugger (GDB) and the Crash tool to
54-
debug the dump file. This method ensures that the dump pages are correctly
55-
ordered.
56-
53+
write out using file copy commands such as cp or scp. You can also use
54+
makedumpfile utility to analyze and write out filtered contents with
55+
options, e.g with '-d 31' it will only write out kernel data. Further,
56+
you can use analysis tools such as the GNU Debugger (GDB) and the Crash
57+
tool to debug the dump file. This method ensures that the dump pages are
58+
correctly ordered.
5759

5860
Setup and Installation
5961
======================
@@ -125,9 +127,18 @@ dump-capture kernels for enabling kdump support.
125127
System kernel config options
126128
----------------------------
127129

128-
1) Enable "kexec system call" in "Processor type and features."::
130+
1) Enable "kexec system call" or "kexec file based system call" in
131+
"Processor type and features."::
132+
133+
CONFIG_KEXEC=y or CONFIG_KEXEC_FILE=y
134+
135+
And both of them will select KEXEC_CORE::
129136

130-
CONFIG_KEXEC=y
137+
CONFIG_KEXEC_CORE=y
138+
139+
Subsequently, CRASH_CORE is selected by KEXEC_CORE::
140+
141+
CONFIG_CRASH_CORE=y
131142

132143
2) Enable "sysfs file system support" in "Filesystem" -> "Pseudo
133144
filesystems." This is usually enabled by default::
@@ -175,17 +186,19 @@ Dump-capture kernel config options (Arch Dependent, i386 and x86_64)
175186

176187
CONFIG_HIGHMEM4G
177188

178-
2) On i386 and x86_64, disable symmetric multi-processing support
179-
under "Processor type and features"::
189+
2) With CONFIG_SMP=y, usually nr_cpus=1 need specified on the kernel
190+
command line when loading the dump-capture kernel because one
191+
CPU is enough for kdump kernel to dump vmcore on most of systems.
180192

181-
CONFIG_SMP=n
193+
However, you can also specify nr_cpus=X to enable multiple processors
194+
in kdump kernel. In this case, "disable_cpu_apicid=" is needed to
195+
tell kdump kernel which cpu is 1st kernel's BSP. Please refer to
196+
admin-guide/kernel-parameters.txt for more details.
182197

183-
(If CONFIG_SMP=y, then specify maxcpus=1 on the kernel command line
184-
when loading the dump-capture kernel, see section "Load the Dump-capture
185-
Kernel".)
198+
With CONFIG_SMP=n, the above things are not related.
186199

187-
3) If one wants to build and use a relocatable kernel,
188-
Enable "Build a relocatable kernel" support under "Processor type and
200+
3) A relocatable kernel is suggested to be built by default. If not yet,
201+
enable "Build a relocatable kernel" support under "Processor type and
189202
features"::
190203

191204
CONFIG_RELOCATABLE=y
@@ -232,7 +245,7 @@ Dump-capture kernel config options (Arch Dependent, ia64)
232245
as a dump-capture kernel if desired.
233246

234247
The crashkernel region can be automatically placed by the system
235-
kernel at run time. This is done by specifying the base address as 0,
248+
kernel at runtime. This is done by specifying the base address as 0,
236249
or omitting it all together::
237250

238251
crashkernel=256M@0
@@ -241,10 +254,6 @@ Dump-capture kernel config options (Arch Dependent, ia64)
241254

242255
crashkernel=256M
243256

244-
If the start address is specified, note that the start address of the
245-
kernel will be aligned to 64Mb, so if the start address is not then
246-
any space below the alignment point will be wasted.
247-
248257
Dump-capture kernel config options (Arch Dependent, arm)
249258
----------------------------------------------------------
250259

@@ -260,46 +269,82 @@ Dump-capture kernel config options (Arch Dependent, arm64)
260269
on non-VHE systems even if it is configured. This is because the CPU
261270
will not be reset to EL2 on panic.
262271

263-
Extended crashkernel syntax
272+
crashkernel syntax
264273
===========================
274+
1) crashkernel=size@offset
265275

266-
While the "crashkernel=size[@offset]" syntax is sufficient for most
267-
configurations, sometimes it's handy to have the reserved memory dependent
268-
on the value of System RAM -- that's mostly for distributors that pre-setup
269-
the kernel command line to avoid a unbootable system after some memory has
270-
been removed from the machine.
276+
Here 'size' specifies how much memory to reserve for the dump-capture kernel
277+
and 'offset' specifies the beginning of this reserved memory. For example,
278+
"crashkernel=64M@16M" tells the system kernel to reserve 64 MB of memory
279+
starting at physical address 0x01000000 (16MB) for the dump-capture kernel.
271280

272-
The syntax is::
281+
The crashkernel region can be automatically placed by the system
282+
kernel at run time. This is done by specifying the base address as 0,
283+
or omitting it all together::
273284

274-
crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset]
275-
range=start-[end]
285+
crashkernel=256M@0
276286

277-
For example::
287+
or::
278288

279-
crashkernel=512M-2G:64M,2G-:128M
289+
crashkernel=256M
280290

281-
This would mean:
291+
If the start address is specified, note that the start address of the
292+
kernel will be aligned to a value (which is Arch dependent), so if the
293+
start address is not then any space below the alignment point will be
294+
wasted.
282295

283-
1) if the RAM is smaller than 512M, then don't reserve anything
284-
(this is the "rescue" case)
285-
2) if the RAM size is between 512M and 2G (exclusive), then reserve 64M
286-
3) if the RAM size is larger than 2G, then reserve 128M
296+
2) range1:size1[,range2:size2,...][@offset]
287297

298+
While the "crashkernel=size[@offset]" syntax is sufficient for most
299+
configurations, sometimes it's handy to have the reserved memory dependent
300+
on the value of System RAM -- that's mostly for distributors that pre-setup
301+
the kernel command line to avoid a unbootable system after some memory has
302+
been removed from the machine.
288303

304+
The syntax is::
289305

290-
Boot into System Kernel
291-
=======================
306+
crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset]
307+
range=start-[end]
308+
309+
For example::
310+
311+
crashkernel=512M-2G:64M,2G-:128M
292312

313+
This would mean:
314+
315+
1) if the RAM is smaller than 512M, then don't reserve anything
316+
(this is the "rescue" case)
317+
2) if the RAM size is between 512M and 2G (exclusive), then reserve 64M
318+
3) if the RAM size is larger than 2G, then reserve 128M
319+
320+
3) crashkernel=size,high and crashkernel=size,low
321+
322+
If memory above 4G is preferred, crashkernel=size,high can be used to
323+
fulfill that. With it, physical memory is allowed to be allocated from top,
324+
so could be above 4G if system has more than 4G RAM installed. Otherwise,
325+
memory region will be allocated below 4G if available.
326+
327+
When crashkernel=X,high is passed, kernel could allocate physical memory
328+
region above 4G, low memory under 4G is needed in this case. There are
329+
three ways to get low memory:
330+
331+
1) Kernel will allocate at least 256M memory below 4G automatically
332+
if crashkernel=Y,low is not specified.
333+
2) Let user specify low memory size instead.
334+
3) Specified value 0 will disable low memory allocation::
335+
336+
crashkernel=0,low
337+
338+
Boot into System Kernel
339+
-----------------------
293340
1) Update the boot loader (such as grub, yaboot, or lilo) configuration
294341
files as necessary.
295342

296-
2) Boot the system kernel with the boot parameter "crashkernel=Y@X",
297-
where Y specifies how much memory to reserve for the dump-capture kernel
298-
and X specifies the beginning of this reserved memory. For example,
299-
"crashkernel=64M@16M" tells the system kernel to reserve 64 MB of memory
300-
starting at physical address 0x01000000 (16MB) for the dump-capture kernel.
343+
2) Boot the system kernel with the boot parameter "crashkernel=Y@X".
301344

302-
On x86 and x86_64, use "crashkernel=64M@16M".
345+
On x86 and x86_64, use "crashkernel=Y[@X]". Most of the time, the
346+
start address 'X' is not necessary, kernel will search a suitable
347+
area. Unless an explicit start address is expected.
303348

304349
On ppc64, use "crashkernel=128M@32M".
305350

@@ -331,8 +376,8 @@ of dump-capture kernel. Following is the summary.
331376

332377
For i386 and x86_64:
333378

334-
- Use vmlinux if kernel is not relocatable.
335379
- Use bzImage/vmlinuz if kernel is relocatable.
380+
- Use vmlinux if kernel is not relocatable.
336381

337382
For ppc64:
338383

@@ -392,23 +437,23 @@ loading dump-capture kernel.
392437

393438
For i386, x86_64 and ia64:
394439

395-
"1 irqpoll maxcpus=1 reset_devices"
440+
"1 irqpoll nr_cpus=1 reset_devices"
396441

397442
For ppc64:
398443

399444
"1 maxcpus=1 noirqdistrib reset_devices"
400445

401446
For s390x:
402447

403-
"1 maxcpus=1 cgroup_disable=memory"
448+
"1 nr_cpus=1 cgroup_disable=memory"
404449

405450
For arm:
406451

407452
"1 maxcpus=1 reset_devices"
408453

409454
For arm64:
410455

411-
"1 maxcpus=1 reset_devices"
456+
"1 nr_cpus=1 reset_devices"
412457

413458
Notes on loading the dump-capture kernel:
414459

@@ -488,6 +533,10 @@ the following command::
488533

489534
cp /proc/vmcore <dump-file>
490535

536+
You can also use makedumpfile utility to write out the dump file
537+
with specified options to filter out unwanted contents, e.g::
538+
539+
makedumpfile -l --message-level 1 -d 31 /proc/vmcore <dump-file>
491540

492541
Analysis
493542
========
@@ -535,8 +584,7 @@ This will cause a kdump to occur at the add_taint()->panic() call.
535584
Contact
536585
=======
537586

538-
- Vivek Goyal (vgoyal@redhat.com)
539-
- Maneesh Soni (maneesh@in.ibm.com)
587+
- kexec@lists.infradead.org
540588

541589
GDB macros
542590
==========

0 commit comments

Comments
 (0)