Message ID | 20200601142754.26139-5-l.stelmach@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | kexec_file_load() for arm | expand |
On Mon, Jun 01, 2020 at 04:27:53PM +0200, Łukasz Stelmach wrote: > Add kexec_image_info to print detailed information about a kexec image. Isn't this already visible through kexec debugging? Why do we need to duplicate the same output in the kernel? Do we think that the kexec interfaces are that fragile that they don't work? > > Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com> > --- > arch/arm/kernel/machine_kexec.c | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c > index 76300f3813e8..c10a2dfd53d1 100644 > --- a/arch/arm/kernel/machine_kexec.c > +++ b/arch/arm/kernel/machine_kexec.c > @@ -31,6 +31,32 @@ extern unsigned long kexec_boot_atags; > > static atomic_t waiting_for_crash_ipi; > > +/** > + * kexec_image_info - For debugging output. > + */ > +#define kexec_image_info(_i) _kexec_image_info(__func__, __LINE__, _i) > +static void _kexec_image_info(const char *func, int line, > + const struct kimage *kimage) > +{ > + unsigned long i; > + > + pr_debug("%s:%d:\n", func, line); > + pr_debug(" kexec kimage info:\n"); > + pr_debug(" type: %d\n", kimage->type); > + pr_debug(" start: %lx\n", kimage->start); > + pr_debug(" head: %lx\n", kimage->head); > + pr_debug(" nr_segments: %lu\n", kimage->nr_segments); > + > + for (i = 0; i < kimage->nr_segments; i++) { > + pr_debug(" segment[%lu]: %08lx - %08lx, 0x%x 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); > + } > +} > + > /* > * Provide a dummy crash_notes definition while crash dump arrives to arm. > * This prevents breakage of crash_notes attribute in kernel/ksysfs.c. > @@ -42,6 +68,8 @@ int machine_kexec_prepare(struct kimage *image) > __be32 header; > int i, err; > > + kexec_image_info(image); > + > image->arch.kernel_r2 = image->start - KEXEC_ARM_ZIMAGE_OFFSET > + KEXEC_ARM_ATAGS_OFFSET; > > -- > 2.26.2 > >
It was <2020-06-01 pon 15:56>, when Russell King - ARM Linux admin wrote: > On Mon, Jun 01, 2020 at 04:27:53PM +0200, Łukasz Stelmach wrote: >> Add kexec_image_info to print detailed information about a kexec image. > > Isn't this already visible through kexec debugging? Why do we need > to duplicate the same output in the kernel? Do we think that the > kexec interfaces are that fragile that they don't work? Because: + kexec_image_info is required if we want to show information for an image loaded via kexec_file_load (with kexec-tools or any other tool e.g. u-root), + this is where both interfaces meet and it is easy to compare their results, + I consider showing results as close to the end of a code path as possible more reliable. >> >> Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com> >> --- >> arch/arm/kernel/machine_kexec.c | 28 ++++++++++++++++++++++++++++ >> 1 file changed, 28 insertions(+) >> >> diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c >> index 76300f3813e8..c10a2dfd53d1 100644 >> --- a/arch/arm/kernel/machine_kexec.c >> +++ b/arch/arm/kernel/machine_kexec.c >> @@ -31,6 +31,32 @@ extern unsigned long kexec_boot_atags; >> >> static atomic_t waiting_for_crash_ipi; >> >> +/** >> + * kexec_image_info - For debugging output. >> + */ >> +#define kexec_image_info(_i) _kexec_image_info(__func__, __LINE__, _i) >> +static void _kexec_image_info(const char *func, int line, >> + const struct kimage *kimage) >> +{ >> + unsigned long i; >> + >> + pr_debug("%s:%d:\n", func, line); >> + pr_debug(" kexec kimage info:\n"); >> + pr_debug(" type: %d\n", kimage->type); >> + pr_debug(" start: %lx\n", kimage->start); >> + pr_debug(" head: %lx\n", kimage->head); >> + pr_debug(" nr_segments: %lu\n", kimage->nr_segments); >> + >> + for (i = 0; i < kimage->nr_segments; i++) { >> + pr_debug(" segment[%lu]: %08lx - %08lx, 0x%x 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); >> + } >> +} >> + >> /* >> * Provide a dummy crash_notes definition while crash dump arrives to arm. >> * This prevents breakage of crash_notes attribute in kernel/ksysfs.c. >> @@ -42,6 +68,8 @@ int machine_kexec_prepare(struct kimage *image) >> __be32 header; >> int i, err; >> >> + kexec_image_info(image); >> + >> image->arch.kernel_r2 = image->start - KEXEC_ARM_ZIMAGE_OFFSET >> + KEXEC_ARM_ATAGS_OFFSET; >> >> -- >> 2.26.2 >> >>
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c index 76300f3813e8..c10a2dfd53d1 100644 --- a/arch/arm/kernel/machine_kexec.c +++ b/arch/arm/kernel/machine_kexec.c @@ -31,6 +31,32 @@ extern unsigned long kexec_boot_atags; static atomic_t waiting_for_crash_ipi; +/** + * kexec_image_info - For debugging output. + */ +#define kexec_image_info(_i) _kexec_image_info(__func__, __LINE__, _i) +static void _kexec_image_info(const char *func, int line, + const struct kimage *kimage) +{ + unsigned long i; + + pr_debug("%s:%d:\n", func, line); + pr_debug(" kexec kimage info:\n"); + pr_debug(" type: %d\n", kimage->type); + pr_debug(" start: %lx\n", kimage->start); + pr_debug(" head: %lx\n", kimage->head); + pr_debug(" nr_segments: %lu\n", kimage->nr_segments); + + for (i = 0; i < kimage->nr_segments; i++) { + pr_debug(" segment[%lu]: %08lx - %08lx, 0x%x 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); + } +} + /* * Provide a dummy crash_notes definition while crash dump arrives to arm. * This prevents breakage of crash_notes attribute in kernel/ksysfs.c. @@ -42,6 +68,8 @@ int machine_kexec_prepare(struct kimage *image) __be32 header; int i, err; + kexec_image_info(image); + image->arch.kernel_r2 = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET;
Add kexec_image_info to print detailed information about a kexec image. Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com> --- arch/arm/kernel/machine_kexec.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)