| From: Baoquan He <bhe@redhat.com> |
| Subject: kexec_file, power: print out debugging message if required |
| Date: Wed, 13 Dec 2023 13:57:46 +0800 |
| |
| 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. |
| |
| Link: https://lkml.kernel.org/r/20231213055747.61826-7-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> |
| --- |
| |
| arch/powerpc/kexec/elf_64.c | 8 ++++---- |
| arch/powerpc/kexec/file_load_64.c | 18 +++++++++--------- |
| 2 files changed, 13 insertions(+), 13 deletions(-) |
| |
| --- a/arch/powerpc/kexec/elf_64.c~kexec_file-power-print-out-debugging-message-if-required |
| +++ a/arch/powerpc/kexec/elf_64.c |
| @@ -59,7 +59,7 @@ static void *elf64_load(struct kimage *i |
| if (ret) |
| goto out; |
| |
| - pr_debug("Loaded the kernel at 0x%lx\n", kernel_load_addr); |
| + kexec_dprintk("Loaded the kernel at 0x%lx\n", kernel_load_addr); |
| |
| ret = kexec_load_purgatory(image, &pbuf); |
| if (ret) { |
| @@ -67,7 +67,7 @@ static void *elf64_load(struct kimage *i |
| goto out; |
| } |
| |
| - pr_debug("Loaded purgatory at 0x%lx\n", pbuf.mem); |
| + kexec_dprintk("Loaded purgatory at 0x%lx\n", pbuf.mem); |
| |
| /* Load additional segments needed for panic kernel */ |
| if (image->type == KEXEC_TYPE_CRASH) { |
| @@ -99,7 +99,7 @@ static void *elf64_load(struct kimage *i |
| goto out; |
| initrd_load_addr = kbuf.mem; |
| |
| - pr_debug("Loaded initrd at 0x%lx\n", initrd_load_addr); |
| + kexec_dprintk("Loaded initrd at 0x%lx\n", initrd_load_addr); |
| } |
| |
| fdt = of_kexec_alloc_and_setup_fdt(image, initrd_load_addr, |
| @@ -132,7 +132,7 @@ static void *elf64_load(struct kimage *i |
| |
| fdt_load_addr = kbuf.mem; |
| |
| - pr_debug("Loaded device tree at 0x%lx\n", fdt_load_addr); |
| + kexec_dprintk("Loaded device tree at 0x%lx\n", fdt_load_addr); |
| |
| slave_code = elf_info.buffer + elf_info.proghdrs[0].p_offset; |
| ret = setup_purgatory_ppc64(image, slave_code, fdt, kernel_load_addr, |
| --- a/arch/powerpc/kexec/file_load_64.c~kexec_file-power-print-out-debugging-message-if-required |
| +++ a/arch/powerpc/kexec/file_load_64.c |
| @@ -577,7 +577,7 @@ static int add_usable_mem_property(void |
| NODE_PATH_LEN, dn); |
| return -EOVERFLOW; |
| } |
| - pr_debug("Memory node path: %s\n", path); |
| + kexec_dprintk("Memory node path: %s\n", path); |
| |
| /* Now that we know the path, find its offset in kdump kernel's fdt */ |
| node = fdt_path_offset(fdt, path); |
| @@ -590,8 +590,8 @@ static int add_usable_mem_property(void |
| /* Get the address & size cells */ |
| n_mem_addr_cells = of_n_addr_cells(dn); |
| n_mem_size_cells = of_n_size_cells(dn); |
| - pr_debug("address cells: %d, size cells: %d\n", n_mem_addr_cells, |
| - n_mem_size_cells); |
| + kexec_dprintk("address cells: %d, size cells: %d\n", n_mem_addr_cells, |
| + n_mem_size_cells); |
| |
| um_info->idx = 0; |
| if (!check_realloc_usable_mem(um_info, 2)) { |
| @@ -664,7 +664,7 @@ static int update_usable_mem_fdt(void *f |
| |
| node = fdt_path_offset(fdt, "/ibm,dynamic-reconfiguration-memory"); |
| if (node == -FDT_ERR_NOTFOUND) |
| - pr_debug("No dynamic reconfiguration memory found\n"); |
| + kexec_dprintk("No dynamic reconfiguration memory found\n"); |
| else if (node < 0) { |
| pr_err("Malformed device tree: error reading /ibm,dynamic-reconfiguration-memory.\n"); |
| return -EINVAL; |
| @@ -776,8 +776,8 @@ static void update_backup_region_phdr(st |
| for (i = 0; i < ehdr->e_phnum; i++) { |
| if (phdr->p_paddr == BACKUP_SRC_START) { |
| phdr->p_offset = image->arch.backup_start; |
| - pr_debug("Backup region offset updated to 0x%lx\n", |
| - image->arch.backup_start); |
| + kexec_dprintk("Backup region offset updated to 0x%lx\n", |
| + image->arch.backup_start); |
| return; |
| } |
| } |
| @@ -850,7 +850,7 @@ int load_crashdump_segments_ppc64(struct |
| pr_err("Failed to load backup segment\n"); |
| return ret; |
| } |
| - pr_debug("Loaded the backup region at 0x%lx\n", kbuf->mem); |
| + kexec_dprintk("Loaded the backup region at 0x%lx\n", kbuf->mem); |
| |
| /* Load elfcorehdr segment - to export crashing kernel's vmcore */ |
| ret = load_elfcorehdr_segment(image, kbuf); |
| @@ -858,8 +858,8 @@ int load_crashdump_segments_ppc64(struct |
| pr_err("Failed to load elfcorehdr segment\n"); |
| return ret; |
| } |
| - 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); |
| |
| return 0; |
| } |
| _ |