Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kexec_file, riscv: print out debugging message if required

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.

Link: https://lkml.kernel.org/r/20231213055747.61826-6-bhe@redhat.com
Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: Conor Dooley <conor@kernel.org>
Cc: Joe Perches <joe@perches.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Baoquan He and committed by
Andrew Morton
eb7622d9 6f8c1da0

+6 -31
+6 -5
arch/riscv/kernel/elf_kexec.c
··· 216 216 if (ret) 217 217 goto out; 218 218 kernel_start = image->start; 219 - pr_notice("The entry point of kernel at 0x%lx\n", image->start); 220 219 221 220 /* Add the kernel binary to the image */ 222 221 ret = riscv_kexec_elf_load(image, &ehdr, &elf_info, ··· 251 252 image->elf_load_addr = kbuf.mem; 252 253 image->elf_headers_sz = headers_sz; 253 254 254 - pr_debug("Loaded elf core header at 0x%lx bufsz=0x%lx memsz=0x%lx\n", 255 - image->elf_load_addr, kbuf.bufsz, kbuf.memsz); 255 + kexec_dprintk("Loaded elf core header at 0x%lx bufsz=0x%lx memsz=0x%lx\n", 256 + image->elf_load_addr, kbuf.bufsz, kbuf.memsz); 256 257 257 258 /* Setup cmdline for kdump kernel case */ 258 259 modified_cmdline = setup_kdump_cmdline(image, cmdline, ··· 274 275 pr_err("Error loading purgatory ret=%d\n", ret); 275 276 goto out; 276 277 } 278 + kexec_dprintk("Loaded purgatory at 0x%lx\n", kbuf.mem); 279 + 277 280 ret = kexec_purgatory_get_set_symbol(image, "riscv_kernel_entry", 278 281 &kernel_start, 279 282 sizeof(kernel_start), 0); ··· 294 293 if (ret) 295 294 goto out; 296 295 initrd_pbase = kbuf.mem; 297 - pr_notice("Loaded initrd at 0x%lx\n", initrd_pbase); 296 + kexec_dprintk("Loaded initrd at 0x%lx\n", initrd_pbase); 298 297 } 299 298 300 299 /* Add the DTB to the image */ ··· 319 318 } 320 319 /* Cache the fdt buffer address for memory cleanup */ 321 320 image->arch.fdt = fdt; 322 - pr_notice("Loaded device tree at 0x%lx\n", kbuf.mem); 321 + kexec_dprintk("Loaded device tree at 0x%lx\n", kbuf.mem); 323 322 goto out; 324 323 325 324 out_free_fdt:
-26
arch/riscv/kernel/machine_kexec.c
··· 19 19 #include <linux/irq.h> 20 20 21 21 /* 22 - * kexec_image_info - Print received image details 23 - */ 24 - static void 25 - kexec_image_info(const struct kimage *image) 26 - { 27 - unsigned long i; 28 - 29 - pr_debug("Kexec image info:\n"); 30 - pr_debug("\ttype: %d\n", image->type); 31 - pr_debug("\tstart: %lx\n", image->start); 32 - pr_debug("\thead: %lx\n", image->head); 33 - pr_debug("\tnr_segments: %lu\n", image->nr_segments); 34 - 35 - for (i = 0; i < image->nr_segments; i++) { 36 - pr_debug("\t segment[%lu]: %016lx - %016lx", i, 37 - image->segment[i].mem, 38 - image->segment[i].mem + image->segment[i].memsz); 39 - pr_debug("\t\t0x%lx bytes, %lu pages\n", 40 - (unsigned long) image->segment[i].memsz, 41 - (unsigned long) image->segment[i].memsz / PAGE_SIZE); 42 - } 43 - } 44 - 45 - /* 46 22 * machine_kexec_prepare - Initialize kexec 47 23 * 48 24 * This function is called from do_kexec_load, when the user has ··· 35 59 void *control_code_buffer = NULL; 36 60 unsigned int control_code_buffer_sz = 0; 37 61 int i = 0; 38 - 39 - kexec_image_info(image); 40 62 41 63 /* Find the Flattened Device Tree and save its physical address */ 42 64 for (i = 0; i < image->nr_segments; i++) {