Linux-parisc archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: kexec@lists.infradead.org, x86@kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org,
	linux-parisc@vger.kernel.org, Baoquan He <bhe@redhat.com>
Subject: [PATCH 0/7] kexec_file: print out debugging message if required
Date: Tue, 14 Nov 2023 23:32:46 +0800	[thread overview]
Message-ID: <20231114153253.241262-1-bhe@redhat.com> (raw)

Currently, specifying '-d' will print a lot of debugging information
about 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 via pr_debug().

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 dev to add if they think
it's needed.

Test:
======
I did testing on x86_64 and arm64. 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
---------------------------------------------------------------------------

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        |  2 +-
 arch/arm64/kernel/machine_kexec.c      | 24 ++++++------------------
 arch/arm64/kernel/machine_kexec_file.c |  6 +++---
 arch/parisc/kernel/kexec_file.c        |  6 +++---
 arch/powerpc/kexec/elf_64.c            |  8 ++++----
 arch/powerpc/kexec/file_load_64.c      | 14 +++++++-------
 arch/riscv/kernel/elf_kexec.c          |  9 +++++----
 arch/riscv/kernel/machine_kexec.c      | 26 --------------------------
 arch/x86/kernel/crash.c                |  2 +-
 arch/x86/kernel/kexec-bzimage64.c      | 23 ++++++++++++++---------
 include/linux/kexec.h                  | 14 +++++++++++++-
 include/uapi/linux/kexec.h             |  1 +
 kernel/crash_core.c                    |  3 ++-
 kernel/kexec_file.c                    | 12 +++++++++++-
 security/integrity/ima/ima_kexec.c     |  2 +-
 15 files changed, 72 insertions(+), 80 deletions(-)

-- 
2.41.0


             reply	other threads:[~2023-11-14 15:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-14 15:32 Baoquan He [this message]
2023-11-14 15:32 ` [PATCH 1/7] kexec_file: add kexec_file flag to control debug printing Baoquan He
2023-11-14 16:03   ` Joe Perches
2023-11-15  0:58     ` Baoquan He
2023-11-15 12:51   ` [PATCH v2 " Baoquan He
2023-11-14 15:32 ` [PATCH 2/7] kexec_file: print out debugging message if required Baoquan He
2023-11-15 21:04   ` kernel test robot
2023-11-17  9:14     ` Baoquan He
2023-11-17  9:37       ` Liu, Yujie
2023-11-17 14:01         ` bhe
2023-11-23 13:49           ` bhe
2023-11-23 15:41             ` Nathan Chancellor
2023-11-24  1:56               ` bhe
2023-11-24  1:18             ` Yujie Liu
2023-11-24  1:57               ` bhe
2023-11-15 21:57   ` kernel test robot
2023-11-17  8:21     ` Baoquan He
2023-11-14 15:32 ` [PATCH 3/7] kexec_file, x86: " Baoquan He
2023-11-14 15:32 ` [PATCH 4/7] kexec_file, arm64: " Baoquan He
2023-11-15 16:58   ` kernel test robot
2023-11-17  0:55     ` Baoquan He
2023-11-14 15:32 ` [PATCH 5/7] kexec_file, ricv: " Baoquan He
2023-11-14 15:32 ` [PATCH 6/7] kexec_file, power: " Baoquan He
2023-11-14 15:32 ` [PATCH 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=20231114153253.241262-1-bhe@redhat.com \
    --to=bhe@redhat.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=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 read-only IMAP folder(s) and NNTP newsgroup(s).