kexec_file, arm64: 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 remove the kimage->segment[] printing because the generic code
has done the printing.

Link: https://lkml.kernel.org/r/20231213055747.61826-5-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>
This commit is contained in:
Baoquan He 2023-12-13 13:57:44 +08:00 committed by Andrew Morton
parent e687b2fabd
commit 6f8c1da071
3 changed files with 15 additions and 29 deletions

View file

@ -122,9 +122,9 @@ static void *image_load(struct kimage *image,
kernel_segment->memsz -= text_offset; kernel_segment->memsz -= text_offset;
image->start = kernel_segment->mem; image->start = kernel_segment->mem;
pr_debug("Loaded kernel at 0x%lx bufsz=0x%lx memsz=0x%lx\n", kexec_dprintk("Loaded kernel at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
kernel_segment->mem, kbuf.bufsz, kernel_segment->mem, kbuf.bufsz,
kernel_segment->memsz); kernel_segment->memsz);
return NULL; return NULL;
} }

View file

@ -32,26 +32,12 @@
static void _kexec_image_info(const char *func, int line, static void _kexec_image_info(const char *func, int line,
const struct kimage *kimage) const struct kimage *kimage)
{ {
unsigned long i; kexec_dprintk("%s:%d:\n", func, line);
kexec_dprintk(" kexec kimage info:\n");
pr_debug("%s:%d:\n", func, line); kexec_dprintk(" type: %d\n", kimage->type);
pr_debug(" kexec kimage info:\n"); kexec_dprintk(" head: %lx\n", kimage->head);
pr_debug(" type: %d\n", kimage->type); kexec_dprintk(" kern_reloc: %pa\n", &kimage->arch.kern_reloc);
pr_debug(" start: %lx\n", kimage->start); kexec_dprintk(" el2_vectors: %pa\n", &kimage->arch.el2_vectors);
pr_debug(" head: %lx\n", kimage->head);
pr_debug(" nr_segments: %lu\n", kimage->nr_segments);
pr_debug(" dtb_mem: %pa\n", &kimage->arch.dtb_mem);
pr_debug(" kern_reloc: %pa\n", &kimage->arch.kern_reloc);
pr_debug(" el2_vectors: %pa\n", &kimage->arch.el2_vectors);
for (i = 0; i < kimage->nr_segments; i++) {
pr_debug(" segment[%lu]: %016lx - %016lx, 0x%lx bytes, %lu pages\n",
i,
kimage->segment[i].mem,
kimage->segment[i].mem + kimage->segment[i].memsz,
kimage->segment[i].memsz,
kimage->segment[i].memsz / PAGE_SIZE);
}
} }
void machine_kexec_cleanup(struct kimage *kimage) void machine_kexec_cleanup(struct kimage *kimage)

View file

@ -127,8 +127,8 @@ int load_other_segments(struct kimage *image,
image->elf_load_addr = kbuf.mem; image->elf_load_addr = kbuf.mem;
image->elf_headers_sz = headers_sz; image->elf_headers_sz = headers_sz;
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);
} }
/* load initrd */ /* load initrd */
@ -148,8 +148,8 @@ int load_other_segments(struct kimage *image,
goto out_err; goto out_err;
initrd_load_addr = kbuf.mem; initrd_load_addr = kbuf.mem;
pr_debug("Loaded initrd at 0x%lx bufsz=0x%lx memsz=0x%lx\n", kexec_dprintk("Loaded initrd at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
initrd_load_addr, kbuf.bufsz, kbuf.memsz); initrd_load_addr, kbuf.bufsz, kbuf.memsz);
} }
/* load dtb */ /* load dtb */
@ -179,8 +179,8 @@ int load_other_segments(struct kimage *image,
image->arch.dtb = dtb; image->arch.dtb = dtb;
image->arch.dtb_mem = kbuf.mem; image->arch.dtb_mem = kbuf.mem;
pr_debug("Loaded dtb at 0x%lx bufsz=0x%lx memsz=0x%lx\n", kexec_dprintk("Loaded dtb at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
kbuf.mem, kbuf.bufsz, kbuf.memsz); kbuf.mem, kbuf.bufsz, kbuf.memsz);
return 0; return 0;