kexec: print out debugging message if required for kexec_load
Subsystems (3)
v3 cover kexec: print out debugging message if required for kexec_load
Overview:
=========
The commit a85ee18c7900 ("kexec_file: print out debugging message if required") has added general code printing in kexec_file_load(), but not in kexec_load().
Since kexec_load and kexec_file_load are not triggered simultaneously, we can unify the debug flag of kexec and kexec_file as kexec_dbg_print.
Next, we need to do some things in this patchset:
1. rename kexec_file_dbg_print to kexec_dbg_print
2. Add KEXEC_DEBUG
3. Initialize kexec_dbg_print for kexec
4. Fix uninitialized struct kimage *image pointer
5. Set the reset of kexec_dbg_print to kimage_free
Testing:
=========
I did testing on x86_64, arm64 and loongarch. On x86_64, the printed messages look like below:
unset CONFIG_KEXEC_FILE:
[ 81.502374] kexec: kexec_load: type:0, start:0x23fff7700 head:0x10a4b9002 flags:0x3e0010
set CONFIG_KEXEC_FILE
[ 36.774228] kexec_file: kernel: 0000000066c386c8 kernel_size: 0xd78400 [ 36.821814] kexec-bzImage64: Loaded purgatory at 0x23fffb000 [ 36.821826] kexec-bzImage64: Loaded boot_param, command line and misc at 0x23fff9000 bufsz=0x12d0 memsz=0x2000 [ 36.821829] kexec-bzImage64: Loaded 64bit kernel at 0x23d400000 bufsz=0xd73400 memsz=0x2ab7000 [ 36.821918] kexec-bzImage64: Loaded initrd at 0x23bd0b000 bufsz=0x16f40a8 memsz=0x16f40a8 [ 36.821920] kexec-bzImage64: Final command line is: root=/dev/mapper/test-root crashkernel=auto rd.lvm.lv=test/root [ 36.821925] kexec-bzImage64: E820 memmap: [ 36.821926] kexec-bzImage64: 0000000000000000-000000000009ffff (1) [ 36.821928] kexec-bzImage64: 0000000000100000-0000000000811fff (1) [ 36.821930] kexec-bzImage64: 0000000000812000-0000000000812fff (2) [ 36.821931] kexec-bzImage64: 0000000000813000-00000000bee38fff (1) [ 36.821933] kexec-bzImage64: 00000000bee39000-00000000beec2fff (2) [ 36.821934] kexec-bzImage64: 00000000beec3000-00000000bf8ecfff (1) [ 36.821935] kexec-bzImage64: 00000000bf8ed000-00000000bfb6cfff (2) [ 36.821936] kexec-bzImage64: 00000000bfb6d000-00000000bfb7efff (3) [ 36.821937] kexec-bzImage64: 00000000bfb7f000-00000000bfbfefff (4) [ 36.821938] kexec-bzImage64: 00000000bfbff000-00000000bff7bfff (1) [ 36.821939] kexec-bzImage64: 00000000bff7c000-00000000bfffffff (2) [ 36.821940] kexec-bzImage64: 00000000feffc000-00000000feffffff (2) [ 36.821941] kexec-bzImage64: 00000000ffc00000-00000000ffffffff (2) [ 36.821942] kexec-bzImage64: 0000000100000000-000000023fffffff (1) [ 36.872348] kexec_file: nr_segments = 4 [ 36.872356] kexec_file: segment[0]: buf=0x000000005314ece7 bufsz=0x4000 mem=0x23fffb000 memsz=0x5000 [ 36.872370] kexec_file: segment[1]: buf=0x000000006e59b143 bufsz=0x12d0 mem=0x23fff9000 memsz=0x2000 [ 36.872374] kexec_file: segment[2]: buf=0x00000000eb7b1fc3 bufsz=0xd73400 mem=0x23d400000 memsz=0x2ab7000 [ 36.882172] kexec_file: segment[3]: buf=0x000000006af76441 bufsz=0x16f40a8 mem=0x23bd0b000 memsz=0x16f5000 [ 36.889113] kexec_file: kexec_file_load: type:0, start:0x23fffb150 head:0x101a2e002 flags:0x8
Changes in v3:
==========
- Rename kexec_core_dbg_print to kexec_dbg_print
- Remove unnecessary segments prints
- Remove patch "kexec_file: Fix the issue of mismatch between loop variable types"
Qiang Ma (3):
kexec: Fix uninitialized struct kimage *image pointer
kexec: add kexec flag to control debug printing
kexec: print out debugging message if required for kexec_load
include/linux/kexec.h | 9 +++++---- include/uapi/linux/kexec.h | 1 + kernel/kexec.c | 8 +++++++- kernel/kexec_core.c | 4 +++- kernel/kexec_file.c | 4 +--- 5 files changed, 17 insertions(+), 9 deletions(-)
Signature · 1 line
2.20.1
PATCH v3 1/3 kexec: Fix uninitialized struct kimage *image pointer
The image is initialized to NULL. Then, after calling kimage_alloc_init, we can directly goto 'out' because at this time, the kimage_free will determine whether image is a NULL pointer.
This can also prepare for the subsequent patch's kexec_core_dbg_print to be reset to zero in kimage_free.
--- kernel/kexec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/kexec.c +3 -1
@@ -95,6 +95,8 @@ static int do_kexec_load(unsigned long entry, unsigned long nr_segments,unsigned long i;int ret; + image =NULL ; +/* * Because we write directly to the reserved memory region when loading * crash kernels we need a serialization here to prevent multiple crash
@@ -129,7 +131,7 @@ static int do_kexec_load(unsigned long entry, unsigned long nr_segments, ret =kimage_alloc_init (&image, entry, nr_segments, segments, flags);if (ret) - goto out_unlock; + goto out;if (flags &KEXEC_PRESERVE_CONTEXT ) image->preserve_context =1 ;
Signature · 1 line
2.20.1
PATCH v3 2/3 kexec: add kexec flag to control debug printing
In reply to Qiang MaThe commit a85ee18c7900 ("kexec_file: print out debugging message if required") has added general code printing in kexec_file_load(), but not in kexec_load().
Since kexec_load and kexec_file_load are not triggered simultaneously, we can unify the debug flag of kexec and kexec_file as kexec_dbg_print.
Next, we need to do four things:
1. rename kexec_file_dbg_print to kexec_dbg_print
2. Add KEXEC_DEBUG
3. Initialize kexec_dbg_print for kexec
4. Set the reset of kexec_dbg_print to kimage_free
--- include/linux/kexec.h | 9 +++++---- include/uapi/linux/kexec.h | 1 + kernel/kexec.c | 1 + kernel/kexec_core.c | 4 +++- kernel/kexec_file.c | 4 +--- 5 files changed, 11 insertions(+), 8 deletions(-)
include/linux/kexec.h +5 -4
@@ -455,10 +455,11 @@ bool kexec_load_permitted(int kexec_image_type);/* List of defined/legal kexec flags */ #ifndef CONFIG_KEXEC_JUMP -#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_UPDATE_ELFCOREHDR | KEXEC_CRASH_HOTPLUG_SUPPORT) +#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_UPDATE_ELFCOREHDR | KEXEC_CRASH_HOTPLUG_SUPPORT | \ + KEXEC_DEBUG)#else #define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT | KEXEC_UPDATE_ELFCOREHDR | \ - KEXEC_CRASH_HOTPLUG_SUPPORT) + KEXEC_CRASH_HOTPLUG_SUPPORT | KEXEC_DEBUG)#endif /* List of defined/legal kexec file flags */
@@ -525,10 +526,10 @@ static inline int arch_kexec_post_alloc_pages(void *vaddr, unsigned int pages, gstatic inline void arch_kexec_pre_free_pages (void *vaddr,unsigned int pages) { }#endif -extern bool kexec_file_dbg_print; +extern bool kexec_dbg_print; #define kexec_dprintk(fmt, arg...) \ - do { if (kexec_file_dbg_print) pr_info(fmt, ##arg); } while (0) + do { if (kexec_dbg_print) pr_info(fmt, ##arg); } while (0)extern void *kimage_map_segment (struct kimage *image,unsigned long addr,unsigned long size);extern void kimage_unmap_segment (void *buffer);
include/uapi/linux/kexec.h +1 -0
@@ -14,6 +14,7 @@#define KEXEC_PRESERVE_CONTEXT 0x00000002#define KEXEC_UPDATE_ELFCOREHDR 0x00000004#define KEXEC_CRASH_HOTPLUG_SUPPORT 0x00000008 +#define KEXEC_DEBUG 0x00000010#define KEXEC_ARCH_MASK 0xffff0000/*
kernel/kexec.c +1 -0
@@ -42,6 +42,7 @@ static int kimage_alloc_init(struct kimage **rimage, unsigned long entry,if (!image)return -ENOMEM ; + kexec_dbg_print = !!(flags &KEXEC_DEBUG ); image->start = entry; image->nr_segments = nr_segments;memcpy (image->segment, segments, nr_segments *sizeof (*segments));
kernel/kexec_core.c +3 -1
@@ -53,7 +53,7 @@ atomic_t __kexec_lock = ATOMIC_INIT(0);/* Flag to indicate we are going to kexec a new kernel */ bool kexec_in_progress = false; -bool kexec_file_dbg_print; +bool kexec_dbg_print;/* * When kexec transitions to the new kernel there is a one-to-one
@@ -576,6 +576,8 @@ void kimage_free(struct kimage *image)kimage_entry_t *ptr, entry;kimage_entry_t ind =0 ; + kexec_dbg_print = false; +if (!image)return ;
kernel/kexec_file.c +1 -3
@@ -138,8 +138,6 @@ void kimage_file_post_load_cleanup(struct kimage *image)*/ kfree (image->image_loader_data); image->image_loader_data =NULL ; - - kexec_file_dbg_print = false; }#ifdef CONFIG_KEXEC_SIG
@@ -314,7 +312,7 @@ kimage_file_alloc_init(struct kimage **rimage, int kernel_fd,if (!image)return -ENOMEM ; - kexec_file_dbg_print = !!(flags &KEXEC_FILE_DEBUG ); + kexec_dbg_print = !!(flags &KEXEC_FILE_DEBUG ); image->file_mode =1 ;#ifdef CONFIG_CRASH_DUMP
Signature · 1 line
2.20.1
PATCH v3 3/3 kexec: print out debugging message if required for kexec_load
In reply to Qiang MaThe commit a85ee18c7900 ("kexec_file: print out debugging message if required") has added general code printing in kexec_file_load(), but not in kexec_load().
As a result, when using '-d' for the kexec_load interface, print nothing in the kernel space.
And print out type/start/head of kimage and flags to help debug.
--- kernel/kexec.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/kexec.c +3 -0
@@ -166,6 +166,9 @@ static int do_kexec_load(unsigned long entry, unsigned long nr_segments,if (ret) goto out; +kexec_dprintk ("kexec_load: type:%u, start:0x%lx head:0x%lx flags:0x%lx\n" , + image->type, image->start, image->head, flags); +/* Install the new kernel and uninstall the old */ image =xchg (dest_image, image);
Signature · 1 line
2.20.1
Hi,
Quoted 8 lines · Qiang Ma
Overview:
=========
The commita85ee18c7900("kexec_file: print out debugging message if required") has added general code printing inkexec_file_load(), but not inkexec_load().Since
kexec_loadandkexec_file_loadare not triggered simultaneously, we can unify the debug flag of kexec andkexec_fileaskexec_dbg_print.
As I said in your last post, this is not needed at all, you just add a not needed thing to kernel.
So NACK this patchset, unless you have reason to justify it. Sorry about it.
Thanks
Baoquan
Quoted 67 lines
Next, we need to do some things in this patchset:
1. rename
kexec_file_dbg_printtokexec_dbg_print
2. AddKEXEC_DEBUG
3. Initializekexec_dbg_printfor kexec
4. Fix uninitialized struct kimage *image pointer
5. Set the reset ofkexec_dbg_printtokimage_freeTesting:
=========
I did testing onx86_64, arm64 and loongarch. Onx86_64, the printed messages look like below:unset
CONFIG_KEXEC_FILE:[ 81.502374] kexec: kexec_load: type:0, start:0x23fff7700 head:0x10a4b9002 flags:0x3e0010set
CONFIG_KEXEC_FILE[ 36.774228] kexec_file: kernel: 0000000066c386c8 kernel_size: 0xd78400 [ 36.821814] kexec-bzImage64: Loaded purgatory at 0x23fffb000 [ 36.821826] kexec-bzImage64: Loaded boot_param, command line and misc at 0x23fff9000 bufsz=0x12d0 memsz=0x2000 [ 36.821829] kexec-bzImage64: Loaded 64bit kernel at 0x23d400000 bufsz=0xd73400 memsz=0x2ab7000 [ 36.821918] kexec-bzImage64: Loaded initrd at 0x23bd0b000 bufsz=0x16f40a8 memsz=0x16f40a8 [ 36.821920] kexec-bzImage64: Final command line is: root=/dev/mapper/test-root crashkernel=auto rd.lvm.lv=test/root [ 36.821925] kexec-bzImage64: E820 memmap: [ 36.821926] kexec-bzImage64: 0000000000000000-000000000009ffff (1) [ 36.821928] kexec-bzImage64: 0000000000100000-0000000000811fff (1) [ 36.821930] kexec-bzImage64: 0000000000812000-0000000000812fff (2) [ 36.821931] kexec-bzImage64: 0000000000813000-00000000bee38fff (1) [ 36.821933] kexec-bzImage64: 00000000bee39000-00000000beec2fff (2) [ 36.821934] kexec-bzImage64: 00000000beec3000-00000000bf8ecfff (1) [ 36.821935] kexec-bzImage64: 00000000bf8ed000-00000000bfb6cfff (2) [ 36.821936] kexec-bzImage64: 00000000bfb6d000-00000000bfb7efff (3) [ 36.821937] kexec-bzImage64: 00000000bfb7f000-00000000bfbfefff (4) [ 36.821938] kexec-bzImage64: 00000000bfbff000-00000000bff7bfff (1) [ 36.821939] kexec-bzImage64: 00000000bff7c000-00000000bfffffff (2) [ 36.821940] kexec-bzImage64: 00000000feffc000-00000000feffffff (2) [ 36.821941] kexec-bzImage64: 00000000ffc00000-00000000ffffffff (2) [ 36.821942] kexec-bzImage64: 0000000100000000-000000023fffffff (1) [ 36.872348] kexec_file: nr_segments = 4 [ 36.872356] kexec_file: segment[0]: buf=0x000000005314ece7 bufsz=0x4000 mem=0x23fffb000 memsz=0x5000 [ 36.872370] kexec_file: segment[1]: buf=0x000000006e59b143 bufsz=0x12d0 mem=0x23fff9000 memsz=0x2000 [ 36.872374] kexec_file: segment[2]: buf=0x00000000eb7b1fc3 bufsz=0xd73400 mem=0x23d400000 memsz=0x2ab7000 [ 36.882172] kexec_file: segment[3]: buf=0x000000006af76441 bufsz=0x16f40a8 mem=0x23bd0b000 memsz=0x16f5000 [ 36.889113] kexec_file: kexec_file_load: type:0, start:0x23fffb150 head:0x101a2e002 flags:0x8Changes in v3:
==========
- Renamekexec_core_dbg_printtokexec_dbg_print
- Remove unnecessary segments prints
- Remove patch "kexec_file: Fix the issue of mismatch between loop variable types"Qiang Ma (3):
kexec: Fix uninitialized struct kimage *image pointer
kexec: add kexec flag to control debug printing
kexec: print out debugging message if required forkexec_loadinclude/linux/kexec.h | 9 +++++---- include/uapi/linux/kexec.h | 1 + kernel/kexec.c | 8 +++++++- kernel/kexec_core.c | 4 +++- kernel/kexec_file.c | 4 +--- 5 files changed, 17 insertions(+), 9 deletions(-)Signature · 1 line
2.20.1
Quoted 9 lines · Baoquan He
Hi,
Quoted 6 lines · Qiang Ma
Overview:
=========
The commita85ee18c7900("kexec_file: print out debugging message if required") has added general code printing inkexec_file_load(), but not inkexec_load().
Quoted 7 lines
Quoted 2 lines
Since
kexec_loadandkexec_file_loadare not triggered simultaneously, we can unify the debug flag of kexec andkexec_fileaskexec_dbg_print.As I said in your last post, this is not needed at all, you just add a not needed thing to kernel.
So NACK this patchset, unless you have reason to justify it. Sorry about it.
The segment prints discussed in the last post,
this patchset has been removed, leaving only type/start/head of kimage and flags.
I think the current patchset is still necessary.
For example, renaming kexec_file_dbg_print is still necessary, but not for kexec_file.
Quoted 71 lines
Thanks
BaoquanQuoted 67 lines
Next, we need to do some things in this patchset:
1. rename
kexec_file_dbg_printtokexec_dbg_print
2. AddKEXEC_DEBUG
3. Initializekexec_dbg_printfor kexec
4. Fix uninitialized struct kimage *image pointer
5. Set the reset ofkexec_dbg_printtokimage_freeTesting:
=========
I did testing onx86_64, arm64 and loongarch. Onx86_64, the printed messages look like below:unset
CONFIG_KEXEC_FILE:[ 81.502374] kexec: kexec_load: type:0, start:0x23fff7700 head:0x10a4b9002 flags:0x3e0010set
CONFIG_KEXEC_FILE[ 36.774228] kexec_file: kernel: 0000000066c386c8 kernel_size: 0xd78400 [ 36.821814] kexec-bzImage64: Loaded purgatory at 0x23fffb000 [ 36.821826] kexec-bzImage64: Loaded boot_param, command line and misc at 0x23fff9000 bufsz=0x12d0 memsz=0x2000 [ 36.821829] kexec-bzImage64: Loaded 64bit kernel at 0x23d400000 bufsz=0xd73400 memsz=0x2ab7000 [ 36.821918] kexec-bzImage64: Loaded initrd at 0x23bd0b000 bufsz=0x16f40a8 memsz=0x16f40a8 [ 36.821920] kexec-bzImage64: Final command line is: root=/dev/mapper/test-root crashkernel=auto rd.lvm.lv=test/root [ 36.821925] kexec-bzImage64: E820 memmap: [ 36.821926] kexec-bzImage64: 0000000000000000-000000000009ffff (1) [ 36.821928] kexec-bzImage64: 0000000000100000-0000000000811fff (1) [ 36.821930] kexec-bzImage64: 0000000000812000-0000000000812fff (2) [ 36.821931] kexec-bzImage64: 0000000000813000-00000000bee38fff (1) [ 36.821933] kexec-bzImage64: 00000000bee39000-00000000beec2fff (2) [ 36.821934] kexec-bzImage64: 00000000beec3000-00000000bf8ecfff (1) [ 36.821935] kexec-bzImage64: 00000000bf8ed000-00000000bfb6cfff (2) [ 36.821936] kexec-bzImage64: 00000000bfb6d000-00000000bfb7efff (3) [ 36.821937] kexec-bzImage64: 00000000bfb7f000-00000000bfbfefff (4) [ 36.821938] kexec-bzImage64: 00000000bfbff000-00000000bff7bfff (1) [ 36.821939] kexec-bzImage64: 00000000bff7c000-00000000bfffffff (2) [ 36.821940] kexec-bzImage64: 00000000feffc000-00000000feffffff (2) [ 36.821941] kexec-bzImage64: 00000000ffc00000-00000000ffffffff (2) [ 36.821942] kexec-bzImage64: 0000000100000000-000000023fffffff (1) [ 36.872348] kexec_file: nr_segments = 4 [ 36.872356] kexec_file: segment[0]: buf=0x000000005314ece7 bufsz=0x4000 mem=0x23fffb000 memsz=0x5000 [ 36.872370] kexec_file: segment[1]: buf=0x000000006e59b143 bufsz=0x12d0 mem=0x23fff9000 memsz=0x2000 [ 36.872374] kexec_file: segment[2]: buf=0x00000000eb7b1fc3 bufsz=0xd73400 mem=0x23d400000 memsz=0x2ab7000 [ 36.882172] kexec_file: segment[3]: buf=0x000000006af76441 bufsz=0x16f40a8 mem=0x23bd0b000 memsz=0x16f5000 [ 36.889113] kexec_file: kexec_file_load: type:0, start:0x23fffb150 head:0x101a2e002 flags:0x8Changes in v3:
==========
- Renamekexec_core_dbg_printtokexec_dbg_print
- Remove unnecessary segments prints
- Remove patch "kexec_file: Fix the issue of mismatch between loop variable types"Qiang Ma (3):
kexec: Fix uninitialized struct kimage *image pointer
kexec: add kexec flag to control debug printing
kexec: print out debugging message if required forkexec_loadinclude/linux/kexec.h | 9 +++++---- include/uapi/linux/kexec.h | 1 + kernel/kexec.c | 8 +++++++- kernel/kexec_core.c | 4 +++- kernel/kexec_file.c | 4 +--- 5 files changed, 17 insertions(+), 9 deletions(-)Signature · 1 line
2.20.1
Quoted 19 lines · Qiang Ma
Quoted 10 lines · Baoquan He
Hi,
Quoted 7 lines · Qiang Ma
Overview:
=========
The commita85ee18c7900("kexec_file: print out debugging message if required") has added general code printing inkexec_file_load(), but not inkexec_load().
Sincekexec_loadandkexec_file_loadare not triggered simultaneously, we can unify the debug flag of kexec andkexec_fileaskexec_dbg_print.Quoted 5 lines
As I said in your last post, this is not needed at all, you just add a not needed thing to kernel.
So NACK this patchset, unless you have reason to justify it. Sorry about it.
The segment prints discussed in the last post,
Quoted 7 lines
this patchset has been removed, leaving only type/start/head of kimage and flags.
I think the current patchset is still necessary.
For example, renamingkexec_file_dbg_printis still necessary, but not forkexec_file.
How come renaming kexec_file_dbg_print is a justification in this case.
No, kexec_file_dbg_print is named because it's only for kexec_file debugging printing. Because we have had enough debugging printing for kexec_load interface. Do you have difficulty on debugging printing of kexec_load?
Quoted 26 lines · Baoquan He
Quoted 18 lines · Qiang Ma
Quoted 10 lines · Baoquan He
Hi,
Quoted 7 lines · Qiang Ma
Overview:
=========
The commita85ee18c7900("kexec_file: print out debugging message if required") has added general code printing inkexec_file_load(), but not inkexec_load().
Sincekexec_loadandkexec_file_loadare not triggered simultaneously, we can unify the debug flag of kexec andkexec_fileaskexec_dbg_print.Quoted 5 lines
As I said in your last post, this is not needed at all, you just add a not needed thing to kernel.
So NACK this patchset, unless you have reason to justify it. Sorry about it.
The segment prints discussed in the last post,
Quoted 7 lines
this patchset has been removed, leaving only type/start/head of kimage and flags.
I think the current patchset is still necessary.
For example, renamingkexec_file_dbg_printis still necessary, but not forkexec_file.
Quoted 6 lines
How come renaming
kexec_file_dbg_printis a justification in this case.No,
kexec_file_dbg_printis named because it's only forkexec_filedebugging printing. Because we have had enough debugging printing forkexec_loadinterface. Do you have difficulty on debugging printing ofkexec_load?
It's sufficient now, but there might be a need in the future.
Also, there's kexec_dprintk. Judging from its name, it seems like a universal kexec print. Looking at the code, it feels like not only the kexec_file interface path uses it for printing.
So, would it be better to rename kexec_file_dbg_print to kexec_dbg_print.
Quoted 2 lines
Quoted 28 lines · Qiang Ma
Quoted 26 lines · Baoquan He
Quoted 25 lines · Qiang Ma
Quoted 10 lines · Baoquan He
Hi,
Quoted 7 lines · Qiang Ma
Overview:
=========
The commita85ee18c7900("kexec_file: print out debugging message if required") has added general code printing inkexec_file_load(), but not inkexec_load().
Sincekexec_loadandkexec_file_loadare not triggered simultaneously, we can unify the debug flag of kexec andkexec_fileaskexec_dbg_print.Quoted 5 lines
As I said in your last post, this is not needed at all, you just add a not needed thing to kernel.
So NACK this patchset, unless you have reason to justify it. Sorry about it.
The segment prints discussed in the last post,
this patchset has been removed, leaving only type/start/head of kimage and flags.
I think the current patchset is still necessary.
For example, renamingkexec_file_dbg_printis still necessary, but not forkexec_file.
Quoted 8 lines
Quoted 6 lines
How come renaming
kexec_file_dbg_printis a justification in this case.No,
kexec_file_dbg_printis named because it's only forkexec_filedebugging printing. Because we have had enough debugging printing forkexec_loadinterface. Do you have difficulty on debugging printing ofkexec_load?It's sufficient now, but there might be a need in the future. Also, there's
kexec_dprintk. Judging from its name, it seems like a
Hmm, as I ever said in earlier discussion, kexec sometime means generic handling including kexec_load and kexec_file_load interfaces. Both possible future need and kexec_dprintk which seems a little ambiguous to you are not justified. We do not suggest adding these meaningless code to kernel. Please do't continue spending effort on this, that is not good.
I welcome cleanup/refactoring/fix for kexec/kdump to improve code, but adding non-reasonable code is not included.
Quoted 10 lines
universal kexec print.
Looking at the code, it feels like not only thekexec_fileinterface path uses it for printing.So, would it be better to rename
kexec_file_dbg_printtokexec_dbg_print.Quoted 2 lines
Quoted 36 lines · Baoquan He
Quoted 27 lines · Qiang Ma
Quoted 26 lines · Baoquan He
Quoted 25 lines · Qiang Ma
Quoted 10 lines · Baoquan He
Hi,
Quoted 7 lines · Qiang Ma
Overview:
=========
The commita85ee18c7900("kexec_file: print out debugging message if required") has added general code printing inkexec_file_load(), but not inkexec_load().
Sincekexec_loadandkexec_file_loadare not triggered simultaneously, we can unify the debug flag of kexec andkexec_fileaskexec_dbg_print.Quoted 5 lines
As I said in your last post, this is not needed at all, you just add a not needed thing to kernel.
So NACK this patchset, unless you have reason to justify it. Sorry about it.
The segment prints discussed in the last post,
this patchset has been removed, leaving only type/start/head of kimage and flags.
I think the current patchset is still necessary.
For example, renamingkexec_file_dbg_printis still necessary, but not forkexec_file.Quoted 8 lines
Quoted 6 lines
How come renaming
kexec_file_dbg_printis a justification in this case.No,
kexec_file_dbg_printis named because it's only forkexec_filedebugging printing. Because we have had enough debugging printing forkexec_loadinterface. Do you have difficulty on debugging printing ofkexec_load?It's sufficient now, but there might be a need in the future. Also, there's
kexec_dprintk. Judging from its name, it seems like a
Quoted 8 lines
Hmm, as I ever said in earlier discussion, kexec sometime means generic handling including
kexec_loadandkexec_file_loadinterfaces. Both possible future need andkexec_dprintkwhich seems a little ambiguous to you are not justified. We do not suggest adding these meaningless code to kernel. Please do't continue spending effort on this, that is not good.I welcome cleanup/refactoring/fix for kexec/kdump to improve code, but adding non-reasonable code is not included.
I agree that meaningless code should not be added to the kernel, but it is meaningful for this patchset and has reasonable reasons.
Let me summarize again the purpose of submitting this patchset:
First, unify the print flag of kexec_file and kexec as kexec_dbg_print, so that both kexec and kexec_file can be used both now and in the future.
Secondly, in the current code, for instance, I saw in the arm64 code
that under the kexec_load interface, the kexec_image_info() already uses kexec_dprintk. When unset CONFIG_KEXEC_FILE, specifying '-d' for kexec_load interface, print nothing in the kernel space. static void _kexec_image_info(const char *func, int line,
const struct kimage *kimage)
{
kexec_dprintk("%s:%d:\n", func, line);
kexec_dprintk(" kexec kimage info:\n");
kexec_dprintk(" type: %d\n", kimage->type);
kexec_dprintk(" head: %lx\n", kimage->head);
Thirdly, for instance, in the arm64 code, the kexec_image_info() prints type/head of kimage, while in the RISC-V code, the type/head of kimage under kexec_load and kexec_file_load is removed. We can remove the print(type/head of kimage) in arm64, and then add it to the general code.
For points 1 and 2, Patch 2 can implement: "kexec: add kexec flag to control debug printing" For point 3, Patch 3 can be implemented: "kexec: print out debugging message if required for kexec_load"
Additionally, if it is necessary to remove the type/head of kimage printed in the kexec_image_info() in the arm64 code, another patch can be provided.
Quoted 9 lines
Quoted 8 lines
universal kexec print.
Looking at the code, it feels like not only thekexec_fileinterface path uses it for printing.So, would it be better to rename
kexec_file_dbg_printtokexec_dbg_print.Quoted 1 line
Hello All,
Do we have plan to support KEXEC_DEBUG flag?
Because upstream kexec-tools already added support for KEXEC_DEBUG flag and that breaks the kexec_load with -d option.
- kexec: add kexec flag to support debug printing
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=71d6fd99af7e
Thanks,
Sourabh Jain
Quoted 72 lines · Qiang Ma
Overview:
=========
The commita85ee18c7900("kexec_file: print out debugging message if required") has added general code printing inkexec_file_load(), but not inkexec_load().Since
kexec_loadandkexec_file_loadare not triggered simultaneously, we can unify the debug flag of kexec andkexec_fileaskexec_dbg_print.Next, we need to do some things in this patchset:
1. rename
kexec_file_dbg_printtokexec_dbg_print
2. AddKEXEC_DEBUG
3. Initializekexec_dbg_printfor kexec
4. Fix uninitialized struct kimage *image pointer
5. Set the reset ofkexec_dbg_printtokimage_freeTesting:
=========
I did testing onx86_64, arm64 and loongarch. Onx86_64, the printed messages look like below:unset
CONFIG_KEXEC_FILE:[ 81.502374] kexec: kexec_load: type:0, start:0x23fff7700 head:0x10a4b9002 flags:0x3e0010set
CONFIG_KEXEC_FILE[ 36.774228] kexec_file: kernel: 0000000066c386c8 kernel_size: 0xd78400 [ 36.821814] kexec-bzImage64: Loaded purgatory at 0x23fffb000 [ 36.821826] kexec-bzImage64: Loaded boot_param, command line and misc at 0x23fff9000 bufsz=0x12d0 memsz=0x2000 [ 36.821829] kexec-bzImage64: Loaded 64bit kernel at 0x23d400000 bufsz=0xd73400 memsz=0x2ab7000 [ 36.821918] kexec-bzImage64: Loaded initrd at 0x23bd0b000 bufsz=0x16f40a8 memsz=0x16f40a8 [ 36.821920] kexec-bzImage64: Final command line is: root=/dev/mapper/test-root crashkernel=auto rd.lvm.lv=test/root [ 36.821925] kexec-bzImage64: E820 memmap: [ 36.821926] kexec-bzImage64: 0000000000000000-000000000009ffff (1) [ 36.821928] kexec-bzImage64: 0000000000100000-0000000000811fff (1) [ 36.821930] kexec-bzImage64: 0000000000812000-0000000000812fff (2) [ 36.821931] kexec-bzImage64: 0000000000813000-00000000bee38fff (1) [ 36.821933] kexec-bzImage64: 00000000bee39000-00000000beec2fff (2) [ 36.821934] kexec-bzImage64: 00000000beec3000-00000000bf8ecfff (1) [ 36.821935] kexec-bzImage64: 00000000bf8ed000-00000000bfb6cfff (2) [ 36.821936] kexec-bzImage64: 00000000bfb6d000-00000000bfb7efff (3) [ 36.821937] kexec-bzImage64: 00000000bfb7f000-00000000bfbfefff (4) [ 36.821938] kexec-bzImage64: 00000000bfbff000-00000000bff7bfff (1) [ 36.821939] kexec-bzImage64: 00000000bff7c000-00000000bfffffff (2) [ 36.821940] kexec-bzImage64: 00000000feffc000-00000000feffffff (2) [ 36.821941] kexec-bzImage64: 00000000ffc00000-00000000ffffffff (2) [ 36.821942] kexec-bzImage64: 0000000100000000-000000023fffffff (1) [ 36.872348] kexec_file: nr_segments = 4 [ 36.872356] kexec_file: segment[0]: buf=0x000000005314ece7 bufsz=0x4000 mem=0x23fffb000 memsz=0x5000 [ 36.872370] kexec_file: segment[1]: buf=0x000000006e59b143 bufsz=0x12d0 mem=0x23fff9000 memsz=0x2000 [ 36.872374] kexec_file: segment[2]: buf=0x00000000eb7b1fc3 bufsz=0xd73400 mem=0x23d400000 memsz=0x2ab7000 [ 36.882172] kexec_file: segment[3]: buf=0x000000006af76441 bufsz=0x16f40a8 mem=0x23bd0b000 memsz=0x16f5000 [ 36.889113] kexec_file: kexec_file_load: type:0, start:0x23fffb150 head:0x101a2e002 flags:0x8Changes in v3:
==========
- Renamekexec_core_dbg_printtokexec_dbg_print
- Remove unnecessary segments prints
- Remove patch "kexec_file: Fix the issue of mismatch between loop variable types"Qiang Ma (3):
kexec: Fix uninitialized struct kimage *image pointer
kexec: add kexec flag to control debug printing
kexec: print out debugging message if required forkexec_loadinclude/linux/kexec.h | 9 +++++---- include/uapi/linux/kexec.h | 1 + kernel/kexec.c | 8 +++++++- kernel/kexec_core.c | 4 +++- kernel/kexec_file.c | 4 +--- 5 files changed, 17 insertions(+), 9 deletions(-)
Quoted 9 lines · Sourabh Jain
Hello All,
Do we have plan to support
KEXEC_DEBUGflag?Because upstream kexec-tools already added support for
KEXEC_DEBUGflag and that breaks thekexec_loadwith -d option.- kexec: add kexec flag to support debug printing
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=71d6fd99af7e
I think we should revert that kexec-tools commit. This whole patchset is non-sense. Because of my carelessness, that userspace patch was merged.
Hi Sourabh,
Could you go through this patchset and help check if they are really needed? I can't find anything to convince myself. Thanks.
Hello Baoquan,
Quoted 11 lines · Baoquan He
Quoted 9 lines · Sourabh Jain
Hello All,
Do we have plan to support
KEXEC_DEBUGflag?Because upstream kexec-tools already added support for
KEXEC_DEBUGflag and that breaks thekexec_loadwith -d option.- kexec: add kexec flag to support debug printing
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=71d6fd99af7eI think we should revert that kexec-tools commit.
Yeah, userspace changes shouldn't go in until the kernel patches are finalized. It seems that there are disagreements regarding the approach and usefulness of this patch series, so reverting the kexec-tools patch might be the right thing to avoid breaking anything for now.
I have one question: should the kernel advertise KEXEC_DEBUG so that backward compatibility can be maintained between the kernel and kexec-tools? Or is that too much for a debugging flag? How was backward compatibility handled when we added the KEXEC_FILE_DEBUG flag?
Quoted 7 lines
This whole patchset is
non-sense. Because of my carelessness, that userspace patch was merged.Hi Sourabh,
Could you go through this patchset and help check if they are really needed? I can't find anything to convince myself. Thanks.
Sure I will review this patch series.
Thanks,
Sourabh Jain
Quoted 11 lines · Sourabh Jain
Hello Baoquan,
Quoted 8 lines · Baoquan He
Quoted 7 lines · Sourabh Jain
Hello All,
Do we have plan to support
KEXEC_DEBUGflag?Because upstream kexec-tools already added support for
KEXEC_DEBUGflag and that breaks thekexec_loadwith -d option.
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
- kexec: add kexec flag to support debug printing
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=71d6fd99af7eI think we should revert that kexec-tools commit.
Yeah, userspace changes shouldn't go in until the kernel patches are finalized. It seems that there are disagreements regarding the approach and usefulness of this patch series, so reverting the kexec-tools patch might be the right thing to avoid breaking anything for now.
The patch 1 is issue fixing, that is a good one. While patch 2, 3 are trying to add debugging printing for kexec_load interface which I think is not needed. I added debugging printing for kexec_file_load because I has been using 'kexec -d' to debug for kexec_load while kexec_file_load didn't have. So I mimicked kexec_load's debugging printing to add one for kexec_file_load. Now patch 2,3's adding doesn't make sense as he said he is doing for future need.
Quoted 5 lines
I have one question: should the kernel advertise
KEXEC_DEBUGso that backward compatibility can be maintained between the kernel and kexec-tools? Or is that too much for a debugging flag? How was backward compatibility handled when we added theKEXEC_FILE_DEBUGflag?
When I added KEXEC_FILE_DEBUG, I didn't consider backward compatibility. That is making the then latest kernel match the then latest kexec-tools.
Quoted 10 lines
Quoted 8 lines
This whole patchset is
non-sense. Because of my carelessness, that userspace patch was merged.Hi Sourabh,
Could you go through this patchset and help check if they are really needed? I can't find anything to convince myself. Thanks.
Sure I will review this patch series.
Thanks. Please check patch 2,3 to see if we really need the debugging printing for kexec_load, or its adding really brings benefit even if it's a little bit compared with the mess it brings; and if my objecting is too subjective.
Thanks
Baoquan
Hello All,
I read this patch series, including the older versions, and this is what I think about the changes.
There are two main reasons I see for why this patch series is proposed (these were not mentioned in the cover letter or commit messages):
1. Commit eb7622d908a09 ("kexec_file, riscv: print out debugging message if required") and commit 6f8c1da071a4 ("kexec_file, arm64: print out debugging message if required") moved some kexec-related debug prints to kexec_dprintk instead of pr_debug or pr_notice.
These commits made it easier to control the updated debug prints using the -d option of kexec tool for kexec_file_load system call. But since kexec_dprintk is not available for the kexec_load system call, those prints are no longer available for kexec_load at all. So patch series try to bring those logs for kexec_load system call.
2. Patch 03/03 prints additional logs about the kexec image type, start, head, and flags via kexec_dprintk for the kexec_load system call.
This is done by enabling the kexec_dprintk for kexec_load, so that logs from point 1 and the new logs from point 2 can be printed for kexec_load system call.
However, the patch series does not explain why these additional debug logs are needed for kexec_load. Since most of the work involved in loading kexec images through kexec_load happens in the kexec userspace tool, and the tool already provides enough logs to debug issues, the need for these extra kernel logs is not clear.
So adding the need for the additional debug logs in the cover letter or
commit message is needed to decide whether it is worth adding the code
change proposed in this patch series Also, I found it hard to map the commit message to the changes introduced in the commits. And finally If I review the patches only based on the code changes: 01/03 The commit message refers to kexec_dbg_print as kexec_core_dbg_print. 02/03 I think kexec_dbg_print should be set to false at the end of kimage_free, not at the start. 03/03 There is duplication of debug logs for architectures that already print the same information. For example, arm64. - Sourabh Jain
Quoted 72 lines · Qiang Ma
Overview:
=========
The commita85ee18c7900("kexec_file: print out debugging message if required") has added general code printing inkexec_file_load(), but not inkexec_load().Since
kexec_loadandkexec_file_loadare not triggered simultaneously, we can unify the debug flag of kexec andkexec_fileaskexec_dbg_print.Next, we need to do some things in this patchset:
1. rename
kexec_file_dbg_printtokexec_dbg_print
2. AddKEXEC_DEBUG
3. Initializekexec_dbg_printfor kexec
4. Fix uninitialized struct kimage *image pointer
5. Set the reset ofkexec_dbg_printtokimage_freeTesting:
=========
I did testing onx86_64, arm64 and loongarch. Onx86_64, the printed messages look like below:unset
CONFIG_KEXEC_FILE:[ 81.502374] kexec: kexec_load: type:0, start:0x23fff7700 head:0x10a4b9002 flags:0x3e0010set
CONFIG_KEXEC_FILE[ 36.774228] kexec_file: kernel: 0000000066c386c8 kernel_size: 0xd78400 [ 36.821814] kexec-bzImage64: Loaded purgatory at 0x23fffb000 [ 36.821826] kexec-bzImage64: Loaded boot_param, command line and misc at 0x23fff9000 bufsz=0x12d0 memsz=0x2000 [ 36.821829] kexec-bzImage64: Loaded 64bit kernel at 0x23d400000 bufsz=0xd73400 memsz=0x2ab7000 [ 36.821918] kexec-bzImage64: Loaded initrd at 0x23bd0b000 bufsz=0x16f40a8 memsz=0x16f40a8 [ 36.821920] kexec-bzImage64: Final command line is: root=/dev/mapper/test-root crashkernel=auto rd.lvm.lv=test/root [ 36.821925] kexec-bzImage64: E820 memmap: [ 36.821926] kexec-bzImage64: 0000000000000000-000000000009ffff (1) [ 36.821928] kexec-bzImage64: 0000000000100000-0000000000811fff (1) [ 36.821930] kexec-bzImage64: 0000000000812000-0000000000812fff (2) [ 36.821931] kexec-bzImage64: 0000000000813000-00000000bee38fff (1) [ 36.821933] kexec-bzImage64: 00000000bee39000-00000000beec2fff (2) [ 36.821934] kexec-bzImage64: 00000000beec3000-00000000bf8ecfff (1) [ 36.821935] kexec-bzImage64: 00000000bf8ed000-00000000bfb6cfff (2) [ 36.821936] kexec-bzImage64: 00000000bfb6d000-00000000bfb7efff (3) [ 36.821937] kexec-bzImage64: 00000000bfb7f000-00000000bfbfefff (4) [ 36.821938] kexec-bzImage64: 00000000bfbff000-00000000bff7bfff (1) [ 36.821939] kexec-bzImage64: 00000000bff7c000-00000000bfffffff (2) [ 36.821940] kexec-bzImage64: 00000000feffc000-00000000feffffff (2) [ 36.821941] kexec-bzImage64: 00000000ffc00000-00000000ffffffff (2) [ 36.821942] kexec-bzImage64: 0000000100000000-000000023fffffff (1) [ 36.872348] kexec_file: nr_segments = 4 [ 36.872356] kexec_file: segment[0]: buf=0x000000005314ece7 bufsz=0x4000 mem=0x23fffb000 memsz=0x5000 [ 36.872370] kexec_file: segment[1]: buf=0x000000006e59b143 bufsz=0x12d0 mem=0x23fff9000 memsz=0x2000 [ 36.872374] kexec_file: segment[2]: buf=0x00000000eb7b1fc3 bufsz=0xd73400 mem=0x23d400000 memsz=0x2ab7000 [ 36.882172] kexec_file: segment[3]: buf=0x000000006af76441 bufsz=0x16f40a8 mem=0x23bd0b000 memsz=0x16f5000 [ 36.889113] kexec_file: kexec_file_load: type:0, start:0x23fffb150 head:0x101a2e002 flags:0x8Changes in v3:
==========
- Renamekexec_core_dbg_printtokexec_dbg_print
- Remove unnecessary segments prints
- Remove patch "kexec_file: Fix the issue of mismatch between loop variable types"Qiang Ma (3):
kexec: Fix uninitialized struct kimage *image pointer
kexec: add kexec flag to control debug printing
kexec: print out debugging message if required forkexec_loadinclude/linux/kexec.h | 9 +++++---- include/uapi/linux/kexec.h | 1 + kernel/kexec.c | 8 +++++++- kernel/kexec_core.c | 4 +++- kernel/kexec_file.c | 4 +--- 5 files changed, 17 insertions(+), 9 deletions(-)
Quoted 26 lines · Sourabh Jain
Hello All,
I read this patch series, including the older versions, and this is what I think about the changes.
There are two main reasons I see for why this patch series is proposed (these were not mentioned in the cover letter or commit messages):
1. Commit
eb7622d908a09("kexec_file, riscv: print out debugging message if required") and commit6f8c1da071a4("kexec_file, arm64: print out debugging message if required") moved some kexec-related debug prints tokexec_dprintkinstead ofpr_debugorpr_notice.These commits made it easier to control the updated debug prints using the -d option of kexec tool for
kexec_file_loadsystem call. But sincekexec_dprintkis not available for thekexec_loadsystem call, those prints are no longer available forkexec_loadat all. So patch series try to bring those logs forkexec_loadsystem call.2. Patch 03/03 prints additional logs about the kexec image type, start, head, and flags via
kexec_dprintkfor thekexec_loadsystem call.This is done by enabling the
kexec_dprintkforkexec_load, so that logs from point 1 and the new logs from point 2 can be printed forkexec_loadsystem call.
Quoted 5 lines
However, the patch series does not explain why these additional debug logs are needed for
kexec_load. Since most of the work involved in loading kexec images throughkexec_loadhappens in the kexec userspace tool, and the tool already provides enough logs to debug issues, the need for these extra kernel logs is not clear.
As pointed out in the point 1, these two commits not only move some kexec-related debug prints to kexec_dprintk instead of pr_debug or pr_notice, but also respectively remove and delete the debug print in kexec_image_info. These debug print initially existed for both kexec_load and kexec_file_load in kernel space. Just commit cbc2fe9d9cb2 ("kexec_file: The "add kexec_file flag to control debug printing") series of patches removed or deleted some parts, but this series of patches only added them to the generic code under the kexec_file_load path, not to the kexec_load path. Therefore, the reason for adding this part of the debug print is to add this deleted debug print to the kexec_load generic code. Regarding duplicate prints related to architecture, as mentioned in previous posts[1], I want remove the print(type/head of kimage) in arm64, and then add it to the general code.
[1]: https://lore.kernel.org/lkml/4D709A5E16BE5DEC+04521049-61de-411f-85c1-cfc049ff04c5@uniontech.com/
If commit cbc2fe9d9cb2 ("kexec_file: The "add kexec_file flag to control debug printing" series of patches is indeed intended to remove those kexec_image_info in kexec_load, not to lose them.
I think patch 3 can be removed, but patch 1, 2 are still required.
As Sourabh Jain mentioned in the point 1, the debugging print that uses kexec_dprintk
in the kexec_load path currently existing under arm64 is equivalent to being unavailable.
Quoted 4 lines
So adding the need for the additional debug logs in the cover letter or
commit message is needed to decide whether it is worth adding the code
change proposed in this patch series Also, I found it hard to map the commit message to the changes introduced in the commits. And finally If I review the patches only based on the code changes: 01/03 The commit message refers tokexec_dbg_print
There is an error in the patch description. It should be kexec_file_dbg_print. I will fix it.
Quoted 1 line
as
kexec_core_dbg_print. 02/03 I thinkkexec_dbg_printshould be set to false at the end ofkimage_free, not at the start. 03/03 There is duplication of debug logs for architectures that already print the same information. For example, arm64. -
In the kimage_file_alloc_init()/kimage_alloc_init(), if there is an abnormal exit before executing *rimage = image, the image is empty, but kexec_dbg_print has been initialized.
In this case, It needs to be placed at the beginning of kimage_free to reset it.
Quoted 74 lines
Sourabh Jain
Quoted 70 lines · Qiang Ma
Overview:
=========
The commita85ee18c7900("kexec_file: print out debugging message if required") has added general code printing inkexec_file_load(), but not inkexec_load().
Sincekexec_loadandkexec_file_loadare not triggered simultaneously, we can unify the debug flag of kexec andkexec_fileaskexec_dbg_print. Next, we need to do some things in this patchset:
1. renamekexec_file_dbg_printtokexec_dbg_print
2. AddKEXEC_DEBUG
3. Initializekexec_dbg_printfor kexec
4. Fix uninitialized struct kimage *image pointer
5. Set the reset ofkexec_dbg_printtokimage_freeTesting:
=========
I did testing onx86_64, arm64 and loongarch. Onx86_64, the printed messages look like below:unset
CONFIG_KEXEC_FILE:
[ 81.502374] kexec:kexec_load: type:0, start:0x23fff7700 head:0x10a4b9002 flags:0x3e0010set
CONFIG_KEXEC_FILE
[ 36.774228]kexec_file: kernel:0000000066c386c8kernel_size:0xd78400
[ 36.821814] kexec-bzImage64: Loaded purgatory at0x23fffb000
[ 36.821826] kexec-bzImage64: Loadedboot_param, command line and misc at0x23fff9000bufsz=0x12d0 memsz=0x2000 [ 36.821829] kexec-bzImage64: Loaded 64bit kernel at0x23d400000bufsz=0xd73400 memsz=0x2ab7000
[ 36.821918] kexec-bzImage64: Loaded initrd at0x23bd0b000bufsz=0x16f40a8 memsz=0x16f40a8
[ 36.821920] kexec-bzImage64: Final command line is: root=/dev/mapper/test-root crashkernel=auto rd.lvm.lv=test/root [ 36.821925] kexec-bzImage64: E820 memmap:
[ 36.821926] kexec-bzImage64: 0000000000000000-000000000009ffff (1)
[ 36.821928] kexec-bzImage64: 0000000000100000-0000000000811fff (1)
[ 36.821930] kexec-bzImage64: 0000000000812000-0000000000812fff (2)
[ 36.821931] kexec-bzImage64: 0000000000813000-00000000bee38fff (1)
[ 36.821933] kexec-bzImage64: 00000000bee39000-00000000beec2fff (2)
[ 36.821934] kexec-bzImage64: 00000000beec3000-00000000bf8ecfff (1)
[ 36.821935] kexec-bzImage64: 00000000bf8ed000-00000000bfb6cfff (2)
[ 36.821936] kexec-bzImage64: 00000000bfb6d000-00000000bfb7efff (3)
[ 36.821937] kexec-bzImage64: 00000000bfb7f000-00000000bfbfefff (4)
[ 36.821938] kexec-bzImage64: 00000000bfbff000-00000000bff7bfff (1)
[ 36.821939] kexec-bzImage64: 00000000bff7c000-00000000bfffffff (2)
[ 36.821940] kexec-bzImage64: 00000000feffc000-00000000feffffff (2)
[ 36.821941] kexec-bzImage64: 00000000ffc00000-00000000ffffffff (2)
[ 36.821942] kexec-bzImage64: 0000000100000000-000000023fffffff (1)
[ 36.872348]kexec_file:nr_segments= 4
[ 36.872356]kexec_file: segment[0]: buf=0x000000005314ece7 bufsz=0x4000 mem=0x23fffb000 memsz=0x5000 [ 36.872370]kexec_file: segment[1]: buf=0x000000006e59b143 bufsz=0x12d0 mem=0x23fff9000 memsz=0x2000 [ 36.872374]kexec_file: segment[2]: buf=0x00000000eb7b1fc3 bufsz=0xd73400 mem=0x23d400000 memsz=0x2ab7000 [ 36.882172]kexec_file: segment[3]: buf=0x000000006af76441 bufsz=0x16f40a8 mem=0x23bd0b000 memsz=0x16f5000 [ 36.889113]kexec_file:kexec_file_load: type:0, start:0x23fffb150 head:0x101a2e002 flags:0x8Changes in v3:
==========
- Renamekexec_core_dbg_printtokexec_dbg_print
- Remove unnecessary segments prints
- Remove patch "kexec_file: Fix the issue of mismatch between loop variable types"Qiang Ma (3):
kexec: Fix uninitialized struct kimage *image pointer
kexec: add kexec flag to control debug printing
kexec: print out debugging message if required forkexec_loadinclude/linux/kexec.h | 9 +++++----
include/uapi/linux/kexec.h| 1 +
kernel/kexec.c | 8 +++++++-
kernel/kexec_core.c | 4 +++-
kernel/kexec_file.c | 4 +---5 files changed, 17 insertions(+), 9 deletions(-)
Quoted 21 lines · Sourabh Jain
Hello All,
I read this patch series, including the older versions, and this is what I think about the changes.
There are two main reasons I see for why this patch series is proposed (these were not mentioned in the cover letter or commit messages):
1. Commit
eb7622d908a09("kexec_file, riscv: print out debugging message if required") and commit6f8c1da071a4("kexec_file, arm64: print out debugging message if required") moved some kexec-related debug prints tokexec_dprintkinstead ofpr_debugorpr_notice.These commits made it easier to control the updated debug prints using the -d option of kexec tool for
kexec_file_loadsystem call. But sincekexec_dprintkis not available for thekexec_loadsystem call, those prints
are no longer available forkexec_loadat all. So patch series try to bring
those logs forkexec_loadsystem call.
Quoted 6 lines
2. Patch 03/03 prints additional logs about the kexec image type, start, head, and flags via
kexec_dprintkfor thekexec_loadsystem call.This is done by enabling the
kexec_dprintkforkexec_load, so that logs from point 1 and the new logs from point 2 can be printed forkexec_loadsystem call.
Thanks a lot for checking these, Soubarh
I thought Qiang had found some missing information and he needed them when debugging kexec_load interface until I noticed he printed the segments too in kernel. The segments has been printed in userspace kexec-tools. After talking, Qiang said he doesn't encounter missing information when debugging kexec_load interface, he added the segment printing antoher time in kernel for comparing them with the segments printed out in userspace kexec-tools.
Basically, when I use 'kexec -d' to debug kexec_load loading, no extra information is needed. Adding printing in kernel will make them shown in console, but not in term which is not in the same place.
Anyway, the patch 2 and 3 adding more debug printing to kexec_load interface in kernel is gilding the lily, drawing legs on a snake.
Qiang,
If you stick to add it, please post patch 1 separately because it's a code fixing patch which is great. And split patch 2 and 3 to another patchset and post separately and seek people's ACK.
Quoted 87 lines
However, the patch series does not explain why these additional debug logs are needed for
kexec_load. Since most of the work involved in loading kexec images throughkexec_loadhappens in the kexec userspace tool, and the tool already provides enough logs to debug issues, the need for these extra kernel logs is not clear.So adding the need for the additional debug logs in the cover letter or commit message is needed to decide whether it is worth adding the code change proposed in this patch series Also, I found it hard to map the commit message to the changes introduced in the commits. And finally If I review the patches only based on the code changes: 01/03 The commit message refers to
kexec_dbg_printaskexec_core_dbg_print. 02/03 I thinkkexec_dbg_printshould be set to false at the end ofkimage_free, not at the start. 03/03 There is duplication of debug logs for architectures that already print the same information. For example, arm64. - Sourabh JainQuoted 69 lines · Qiang Ma
Overview:
=========
The commita85ee18c7900("kexec_file: print out debugging message if required") has added general code printing inkexec_file_load(), but not inkexec_load().
Sincekexec_loadandkexec_file_loadare not triggered simultaneously, we can unify the debug flag of kexec andkexec_fileaskexec_dbg_print. Next, we need to do some things in this patchset:
1. renamekexec_file_dbg_printtokexec_dbg_print
2. AddKEXEC_DEBUG
3. Initializekexec_dbg_printfor kexec
4. Fix uninitialized struct kimage *image pointer
5. Set the reset ofkexec_dbg_printtokimage_freeTesting:
=========
I did testing onx86_64, arm64 and loongarch. Onx86_64, the printed messages look like below:unset
CONFIG_KEXEC_FILE:[ 81.502374] kexec: kexec_load: type:0, start:0x23fff7700 head:0x10a4b9002 flags:0x3e0010set
CONFIG_KEXEC_FILE[ 36.774228] kexec_file: kernel: 0000000066c386c8 kernel_size: 0xd78400 [ 36.821814] kexec-bzImage64: Loaded purgatory at 0x23fffb000 [ 36.821826] kexec-bzImage64: Loaded boot_param, command line and misc at 0x23fff9000 bufsz=0x12d0 memsz=0x2000 [ 36.821829] kexec-bzImage64: Loaded 64bit kernel at 0x23d400000 bufsz=0xd73400 memsz=0x2ab7000 [ 36.821918] kexec-bzImage64: Loaded initrd at 0x23bd0b000 bufsz=0x16f40a8 memsz=0x16f40a8 [ 36.821920] kexec-bzImage64: Final command line is: root=/dev/mapper/test-root crashkernel=auto rd.lvm.lv=test/root [ 36.821925] kexec-bzImage64: E820 memmap: [ 36.821926] kexec-bzImage64: 0000000000000000-000000000009ffff (1) [ 36.821928] kexec-bzImage64: 0000000000100000-0000000000811fff (1) [ 36.821930] kexec-bzImage64: 0000000000812000-0000000000812fff (2) [ 36.821931] kexec-bzImage64: 0000000000813000-00000000bee38fff (1) [ 36.821933] kexec-bzImage64: 00000000bee39000-00000000beec2fff (2) [ 36.821934] kexec-bzImage64: 00000000beec3000-00000000bf8ecfff (1) [ 36.821935] kexec-bzImage64: 00000000bf8ed000-00000000bfb6cfff (2) [ 36.821936] kexec-bzImage64: 00000000bfb6d000-00000000bfb7efff (3) [ 36.821937] kexec-bzImage64: 00000000bfb7f000-00000000bfbfefff (4) [ 36.821938] kexec-bzImage64: 00000000bfbff000-00000000bff7bfff (1) [ 36.821939] kexec-bzImage64: 00000000bff7c000-00000000bfffffff (2) [ 36.821940] kexec-bzImage64: 00000000feffc000-00000000feffffff (2) [ 36.821941] kexec-bzImage64: 00000000ffc00000-00000000ffffffff (2) [ 36.821942] kexec-bzImage64: 0000000100000000-000000023fffffff (1) [ 36.872348] kexec_file: nr_segments = 4 [ 36.872356] kexec_file: segment[0]: buf=0x000000005314ece7 bufsz=0x4000 mem=0x23fffb000 memsz=0x5000 [ 36.872370] kexec_file: segment[1]: buf=0x000000006e59b143 bufsz=0x12d0 mem=0x23fff9000 memsz=0x2000 [ 36.872374] kexec_file: segment[2]: buf=0x00000000eb7b1fc3 bufsz=0xd73400 mem=0x23d400000 memsz=0x2ab7000 [ 36.882172] kexec_file: segment[3]: buf=0x000000006af76441 bufsz=0x16f40a8 mem=0x23bd0b000 memsz=0x16f5000 [ 36.889113] kexec_file: kexec_file_load: type:0, start:0x23fffb150 head:0x101a2e002 flags:0x8Changes in v3:
==========
- Renamekexec_core_dbg_printtokexec_dbg_print
- Remove unnecessary segments prints
- Remove patch "kexec_file: Fix the issue of mismatch between loop variable types"Qiang Ma (3):
kexec: Fix uninitialized struct kimage *image pointer
kexec: add kexec flag to control debug printing
kexec: print out debugging message if required forkexec_loadinclude/linux/kexec.h | 9 +++++---- include/uapi/linux/kexec.h | 1 + kernel/kexec.c | 8 +++++++- kernel/kexec_core.c | 4 +++- kernel/kexec_file.c | 4 +--- 5 files changed, 17 insertions(+), 9 deletions(-)