Message ID | 20231213055747.61826-6-bhe@redhat.com (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | kexec_file: print out debugging message if required | expand |
On Wed, Dec 13, 2023 at 01:57:45PM +0800, Baoquan He wrote: > Then when specifying '-d' for kexec_file_load interface, loaded > locations of kernel/initrd/cmdline etc can be printed out to help debug. > > Here replace pr_debug() with the newly added kexec_dprintk() in kexec_file > loading related codes. > > And also replace pr_notice() with kexec_dprintk() in elf_kexec_load() > because loaded location of purgatory and device tree are only printed > out for debugging, it doesn't make sense to always print them out. > > And also remove kexec_image_info() because the content has been printed > out in generic code. > > Signed-off-by: Baoquan He <bhe@redhat.com> I'm sorry - I meant to look at this several days ago but I forgot. Apart from the typo that crept back into $subject, this version explains the rationale behind what you're changing a lot better, thanks. Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Cheers, Conor.
On 12/19/23 at 02:44pm, Conor Dooley wrote: > On Wed, Dec 13, 2023 at 01:57:45PM +0800, Baoquan He wrote: > > Then when specifying '-d' for kexec_file_load interface, loaded > > locations of kernel/initrd/cmdline etc can be printed out to help debug. > > > > Here replace pr_debug() with the newly added kexec_dprintk() in kexec_file > > loading related codes. > > > > And also replace pr_notice() with kexec_dprintk() in elf_kexec_load() > > because loaded location of purgatory and device tree are only printed > > out for debugging, it doesn't make sense to always print them out. > > > > And also remove kexec_image_info() because the content has been printed > > out in generic code. > > > > Signed-off-by: Baoquan He <bhe@redhat.com> > > I'm sorry - I meant to look at this several days ago but I forgot. > Apart from the typo that crept back into $subject, this version explains > the rationale behind what you're changing a lot better, thanks. Thanks for careful checking. I forgot the typo fixing you have pointed out in v3 reviewing. Hi Andrew, Could you help fix the typo in subject? [PATCH v4 5/7] kexec_file, ricv: print out debugging message if required ~~~ s/ricv/riscv/
On Wed, 20 Dec 2023 12:22:29 +0800 Baoquan He <bhe@redhat.com> wrote: > Could you help fix the typo in subject? > > [PATCH v4 5/7] kexec_file, ricv: print out debugging message if required > ~~~ s/ricv/riscv/ I made that change.
On 12/20/23 at 07:46am, Andrew Morton wrote: > On Wed, 20 Dec 2023 12:22:29 +0800 Baoquan He <bhe@redhat.com> wrote: > > > Could you help fix the typo in subject? > > > > [PATCH v4 5/7] kexec_file, ricv: print out debugging message if required > > ~~~ s/ricv/riscv/ > > I made that change. Thanks a lot.
diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c index e60fbd8660c4..5bd1ec3341fe 100644 --- a/arch/riscv/kernel/elf_kexec.c +++ b/arch/riscv/kernel/elf_kexec.c @@ -216,7 +216,6 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf, if (ret) goto out; kernel_start = image->start; - pr_notice("The entry point of kernel at 0x%lx\n", image->start); /* Add the kernel binary to the image */ ret = riscv_kexec_elf_load(image, &ehdr, &elf_info, @@ -252,8 +251,8 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf, image->elf_load_addr = kbuf.mem; image->elf_headers_sz = headers_sz; - pr_debug("Loaded elf core header at 0x%lx bufsz=0x%lx memsz=0x%lx\n", - image->elf_load_addr, kbuf.bufsz, kbuf.memsz); + kexec_dprintk("Loaded elf core header at 0x%lx bufsz=0x%lx memsz=0x%lx\n", + image->elf_load_addr, kbuf.bufsz, kbuf.memsz); /* Setup cmdline for kdump kernel case */ modified_cmdline = setup_kdump_cmdline(image, cmdline, @@ -275,6 +274,8 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf, pr_err("Error loading purgatory ret=%d\n", ret); goto out; } + kexec_dprintk("Loaded purgatory at 0x%lx\n", kbuf.mem); + ret = kexec_purgatory_get_set_symbol(image, "riscv_kernel_entry", &kernel_start, sizeof(kernel_start), 0); @@ -293,7 +294,7 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf, if (ret) goto out; initrd_pbase = kbuf.mem; - pr_notice("Loaded initrd at 0x%lx\n", initrd_pbase); + kexec_dprintk("Loaded initrd at 0x%lx\n", initrd_pbase); } /* Add the DTB to the image */ @@ -318,7 +319,7 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf, } /* Cache the fdt buffer address for memory cleanup */ image->arch.fdt = fdt; - pr_notice("Loaded device tree at 0x%lx\n", kbuf.mem); + kexec_dprintk("Loaded device tree at 0x%lx\n", kbuf.mem); goto out; out_free_fdt: diff --git a/arch/riscv/kernel/machine_kexec.c b/arch/riscv/kernel/machine_kexec.c index 2d139b724bc8..ed9cad20c039 100644 --- a/arch/riscv/kernel/machine_kexec.c +++ b/arch/riscv/kernel/machine_kexec.c @@ -18,30 +18,6 @@ #include <linux/interrupt.h> #include <linux/irq.h> -/* - * kexec_image_info - Print received image details - */ -static void -kexec_image_info(const struct kimage *image) -{ - unsigned long i; - - pr_debug("Kexec image info:\n"); - pr_debug("\ttype: %d\n", image->type); - pr_debug("\tstart: %lx\n", image->start); - pr_debug("\thead: %lx\n", image->head); - pr_debug("\tnr_segments: %lu\n", image->nr_segments); - - for (i = 0; i < image->nr_segments; i++) { - pr_debug("\t segment[%lu]: %016lx - %016lx", i, - image->segment[i].mem, - image->segment[i].mem + image->segment[i].memsz); - pr_debug("\t\t0x%lx bytes, %lu pages\n", - (unsigned long) image->segment[i].memsz, - (unsigned long) image->segment[i].memsz / PAGE_SIZE); - } -} - /* * machine_kexec_prepare - Initialize kexec * @@ -60,8 +36,6 @@ machine_kexec_prepare(struct kimage *image) unsigned int control_code_buffer_sz = 0; int i = 0; - kexec_image_info(image); - /* Find the Flattened Device Tree and save its physical address */ for (i = 0; i < image->nr_segments; i++) { if (image->segment[i].memsz <= sizeof(fdt))
Then when specifying '-d' for kexec_file_load interface, loaded locations of kernel/initrd/cmdline etc can be printed out to help debug. Here replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also replace pr_notice() with kexec_dprintk() in elf_kexec_load() because loaded location of purgatory and device tree are only printed out for debugging, it doesn't make sense to always print them out. And also remove kexec_image_info() because the content has been printed out in generic code. Signed-off-by: Baoquan He <bhe@redhat.com> --- arch/riscv/kernel/elf_kexec.c | 11 ++++++----- arch/riscv/kernel/machine_kexec.c | 26 -------------------------- 2 files changed, 6 insertions(+), 31 deletions(-)