Commit 63b642e9 authored by Baoquan He's avatar Baoquan He Committed by Andrew Morton

kexec_file, power: 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.

Link: https://lkml.kernel.org/r/20231213055747.61826-7-bhe@redhat.comSigned-off-by: default avatarBaoquan 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: default avatarAndrew Morton <akpm@linux-foundation.org>
parent eb7622d9
...@@ -59,7 +59,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, ...@@ -59,7 +59,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf,
if (ret) if (ret)
goto out; 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); ret = kexec_load_purgatory(image, &pbuf);
if (ret) { if (ret) {
...@@ -67,7 +67,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, ...@@ -67,7 +67,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf,
goto out; 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 */ /* Load additional segments needed for panic kernel */
if (image->type == KEXEC_TYPE_CRASH) { if (image->type == KEXEC_TYPE_CRASH) {
...@@ -99,7 +99,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, ...@@ -99,7 +99,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf,
goto out; goto out;
initrd_load_addr = kbuf.mem; 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, fdt = of_kexec_alloc_and_setup_fdt(image, initrd_load_addr,
...@@ -132,7 +132,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, ...@@ -132,7 +132,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf,
fdt_load_addr = kbuf.mem; 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; slave_code = elf_info.buffer + elf_info.proghdrs[0].p_offset;
ret = setup_purgatory_ppc64(image, slave_code, fdt, kernel_load_addr, ret = setup_purgatory_ppc64(image, slave_code, fdt, kernel_load_addr,
......
...@@ -577,7 +577,7 @@ static int add_usable_mem_property(void *fdt, struct device_node *dn, ...@@ -577,7 +577,7 @@ static int add_usable_mem_property(void *fdt, struct device_node *dn,
NODE_PATH_LEN, dn); NODE_PATH_LEN, dn);
return -EOVERFLOW; 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 */ /* Now that we know the path, find its offset in kdump kernel's fdt */
node = fdt_path_offset(fdt, path); node = fdt_path_offset(fdt, path);
...@@ -590,8 +590,8 @@ static int add_usable_mem_property(void *fdt, struct device_node *dn, ...@@ -590,8 +590,8 @@ static int add_usable_mem_property(void *fdt, struct device_node *dn,
/* Get the address & size cells */ /* Get the address & size cells */
n_mem_addr_cells = of_n_addr_cells(dn); n_mem_addr_cells = of_n_addr_cells(dn);
n_mem_size_cells = of_n_size_cells(dn); n_mem_size_cells = of_n_size_cells(dn);
pr_debug("address cells: %d, size cells: %d\n", n_mem_addr_cells, kexec_dprintk("address cells: %d, size cells: %d\n", n_mem_addr_cells,
n_mem_size_cells); n_mem_size_cells);
um_info->idx = 0; um_info->idx = 0;
if (!check_realloc_usable_mem(um_info, 2)) { if (!check_realloc_usable_mem(um_info, 2)) {
...@@ -664,7 +664,7 @@ static int update_usable_mem_fdt(void *fdt, struct crash_mem *usable_mem) ...@@ -664,7 +664,7 @@ static int update_usable_mem_fdt(void *fdt, struct crash_mem *usable_mem)
node = fdt_path_offset(fdt, "/ibm,dynamic-reconfiguration-memory"); node = fdt_path_offset(fdt, "/ibm,dynamic-reconfiguration-memory");
if (node == -FDT_ERR_NOTFOUND) 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) { else if (node < 0) {
pr_err("Malformed device tree: error reading /ibm,dynamic-reconfiguration-memory.\n"); pr_err("Malformed device tree: error reading /ibm,dynamic-reconfiguration-memory.\n");
return -EINVAL; return -EINVAL;
...@@ -776,8 +776,8 @@ static void update_backup_region_phdr(struct kimage *image, Elf64_Ehdr *ehdr) ...@@ -776,8 +776,8 @@ static void update_backup_region_phdr(struct kimage *image, Elf64_Ehdr *ehdr)
for (i = 0; i < ehdr->e_phnum; i++) { for (i = 0; i < ehdr->e_phnum; i++) {
if (phdr->p_paddr == BACKUP_SRC_START) { if (phdr->p_paddr == BACKUP_SRC_START) {
phdr->p_offset = image->arch.backup_start; phdr->p_offset = image->arch.backup_start;
pr_debug("Backup region offset updated to 0x%lx\n", kexec_dprintk("Backup region offset updated to 0x%lx\n",
image->arch.backup_start); image->arch.backup_start);
return; return;
} }
} }
...@@ -850,7 +850,7 @@ int load_crashdump_segments_ppc64(struct kimage *image, ...@@ -850,7 +850,7 @@ int load_crashdump_segments_ppc64(struct kimage *image,
pr_err("Failed to load backup segment\n"); pr_err("Failed to load backup segment\n");
return ret; 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 */ /* Load elfcorehdr segment - to export crashing kernel's vmcore */
ret = load_elfcorehdr_segment(image, kbuf); ret = load_elfcorehdr_segment(image, kbuf);
...@@ -858,8 +858,8 @@ int load_crashdump_segments_ppc64(struct kimage *image, ...@@ -858,8 +858,8 @@ int load_crashdump_segments_ppc64(struct kimage *image,
pr_err("Failed to load elfcorehdr segment\n"); pr_err("Failed to load elfcorehdr segment\n");
return ret; return ret;
} }
pr_debug("Loaded elf core header at 0x%lx, bufsz=0x%lx memsz=0x%lx\n", kexec_dprintk("Loaded elf core header at 0x%lx, bufsz=0x%lx memsz=0x%lx\n",
image->elf_load_addr, kbuf->bufsz, kbuf->memsz); image->elf_load_addr, kbuf->bufsz, kbuf->memsz);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment