From: Baoquan He <bhe@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Baoquan He <bhe@redhat.com>,
linux-parisc@vger.kernel.org, x86@kernel.org,
kexec@lists.infradead.org, nathan@kernel.org, joe@perches.com,
linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org,
akpm@linux-foundation.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 0/7] kexec_file: print out debugging message if required
Date: Thu, 30 Nov 2023 10:39:48 +0800 [thread overview]
Message-ID: <20231130023955.5257-1-bhe@redhat.com> (raw)
Currently, specifying '-d' on kexec command will print a lot of debugging
informationabout kexec/kdump loading with kexec_load interface.
However, kexec_file_load prints nothing even though '-d' is specified.
It's very inconvenient to debug or analyze the kexec/kdump loading when
something wrong happened with kexec/kdump itself or develper want to
check the kexec/kdump loading.
In this patchset, a kexec_file flag is KEXEC_FILE_DEBUG added and checked
in code. If it's passed in, debugging message of kexec_file code will be
printed out and can be seen from console and dmesg. Otherwise, the
debugging message is printed like beofre when pr_debug() is taken.
Note:
****
=====
1) The code in kexec-tools utility also need be changed to support
passing KEXEC_FILE_DEBUG to kernel when 'kexec -s -d' is specified.
The patch link is here:
=========
[PATCH] kexec_file: add kexec_file flag to support debug printing
http://lists.infradead.org/pipermail/kexec/2023-November/028505.html
2) s390 also has kexec_file code, while I am not sure what debugging
information is necessary. So leave it to s390 developer.
Test:
****
====
Testing was done in v1 on x86_64 and arm64. For v3, tested on x86_64
again. And on x86_64, the printed messages look like below:
--------------------------------------------------------------
kexec measurement buffer for the loaded kernel at 0x207fffe000.
Loaded purgatory at 0x207fff9000
Loaded boot_param, command line and misc at 0x207fff3000 bufsz=0x1180 memsz=0x1180
Loaded 64bit kernel at 0x207c000000 bufsz=0xc88200 memsz=0x3c4a000
Loaded initrd at 0x2079e79000 bufsz=0x2186280 memsz=0x2186280
Final command line is: root=/dev/mapper/fedora_intel--knightslanding--lb--02-root ro
rd.lvm.lv=fedora_intel-knightslanding-lb-02/root console=ttyS0,115200N81 crashkernel=256M
E820 memmap:
0000000000000000-000000000009a3ff (1)
000000000009a400-000000000009ffff (2)
00000000000e0000-00000000000fffff (2)
0000000000100000-000000006ff83fff (1)
000000006ff84000-000000007ac50fff (2)
......
000000207fff6150-000000207fff615f (128)
000000207fff6160-000000207fff714f (1)
000000207fff7150-000000207fff715f (128)
000000207fff7160-000000207fff814f (1)
000000207fff8150-000000207fff815f (128)
000000207fff8160-000000207fffffff (1)
nr_segments = 5
segment[0]: buf=0x000000004e5ece74 bufsz=0x211 mem=0x207fffe000 memsz=0x1000
segment[1]: buf=0x000000009e871498 bufsz=0x4000 mem=0x207fff9000 memsz=0x5000
segment[2]: buf=0x00000000d879f1fe bufsz=0x1180 mem=0x207fff3000 memsz=0x2000
segment[3]: buf=0x000000001101cd86 bufsz=0xc88200 mem=0x207c000000 memsz=0x3c4a000
segment[4]: buf=0x00000000c6e38ac7 bufsz=0x2186280 mem=0x2079e79000 memsz=0x2187000
kexec_file_load: type:0, start:0x207fff91a0 head:0x109e004002 flags:0x8
---------------------------------------------------------------------------
History:
********
=========
v2->v3:
- Adjust all the indentation of continuation line to the open parenthesis
for all kexec_dprintk() call sites. Thank Joe to point this out.
- Fix the LKP report that macro kexec_dprintk() is invalid when
CONFIG_KEXEC=Y, CONFIG_KEXEC_FILE=n, CONFIG_CRASH_DUMP=y.
v1->v2:
- Take the new format of kexec_dprintk() suggested by Joe which can
reduce kernel text size.
- Fix building error of patch 2 in kernel/crash_core.c reported by LKP.
- Fix building warning on arm64 in patch 4 reported by LKP.
Baoquan He (7):
kexec_file: add kexec_file flag to control debug printing
kexec_file: print out debugging message if required
kexec_file, x86: print out debugging message if required
kexec_file, arm64: print out debugging message if required
kexec_file, ricv: print out debugging message if required
kexec_file, power: print out debugging message if required
kexec_file, parisc: print out debugging message if required
arch/arm64/kernel/kexec_image.c | 6 +++---
arch/arm64/kernel/machine_kexec.c | 26 ++++++--------------------
arch/arm64/kernel/machine_kexec_file.c | 12 ++++++------
arch/parisc/kernel/kexec_file.c | 8 ++++----
arch/powerpc/kexec/elf_64.c | 8 ++++----
arch/powerpc/kexec/file_load_64.c | 18 +++++++++---------
arch/riscv/kernel/elf_kexec.c | 11 ++++++-----
arch/riscv/kernel/machine_kexec.c | 26 --------------------------
arch/x86/kernel/crash.c | 4 ++--
arch/x86/kernel/kexec-bzimage64.c | 23 ++++++++++++++---------
include/linux/kexec.h | 9 ++++++++-
include/uapi/linux/kexec.h | 1 +
kernel/crash_core.c | 9 ++++++---
kernel/kexec_core.c | 2 ++
kernel/kexec_file.c | 14 +++++++++++---
security/integrity/ima/ima_kexec.c | 4 ++--
16 files changed, 84 insertions(+), 97 deletions(-)
--
2.41.0
next reply other threads:[~2023-11-30 2:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-30 2:39 Baoquan He [this message]
2023-11-30 2:39 ` [PATCH v3 1/7] kexec_file: add kexec_file flag to control debug printing Baoquan He
2023-11-30 2:39 ` [PATCH v3 2/7] kexec_file: print out debugging message if required Baoquan He
2023-11-30 2:52 ` Joe Perches
2023-12-04 8:43 ` Baoquan He
2023-11-30 2:39 ` [PATCH v3 3/7] kexec_file, x86: " Baoquan He
2023-11-30 2:39 ` [PATCH v3 4/7] kexec_file, arm64: " Baoquan He
2023-11-30 2:39 ` [PATCH v3 5/7] kexec_file, ricv: " Baoquan He
2023-12-01 10:38 ` Conor Dooley
2023-12-04 15:38 ` Baoquan He
2023-12-04 16:14 ` Conor Dooley
2023-12-06 15:37 ` Baoquan He
2023-12-06 16:54 ` Conor Dooley
2023-12-06 23:22 ` Baoquan He
2023-12-13 3:23 ` Baoquan He
2023-11-30 2:39 ` [PATCH v3 6/7] kexec_file, power: " Baoquan He
2023-11-30 2:39 ` [PATCH v3 7/7] kexec_file, parisc: " Baoquan He
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231130023955.5257-1-bhe@redhat.com \
--to=bhe@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=joe@perches.com \
--cc=kexec@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nathan@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).