[Crash-utility] [PATCH] correct a mistake of reading kimage_voffset
Zhi-zhou Zhang
zhizhouzhang at asrmicro.com
Thu Jan 19 07:05:56 UTC 2017
On Wed, Jan 18, 2017 at 09:46:47AM -0500, Dave Anderson wrote:
>
>
> ----- Original Message -----
> > From: Zhizhou Zhang <zhizhouzhang at asrmicro.com>
> >
> > kernel defines VMCOREINFO_NUMBER as follow. so we should use atol rather than
> > htol to get value of kimage_voffset.
> >
> > #define VMCOREINFO_NUMBER(name) \
> > vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name)
>
> Are you sure about that?
>
> The last patch that I saw posted on the kexec list by Akashk Takahiro was this one:
>
> [PATCH v29 5/9] arm64: kdump: add VMCOREINFO's for user-space tools
> http://lists.infradead.org/pipermail/kexec/2016-December/017909.html
I'm checking on mainline kernel, which doesn't contain this patch. So
just skip it, thank you!
>
> And in that patch, kimage_voffset is most definitely a hexadecimal value:
>
> diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c
> index c60346d33bb1..994fe0bc5cc0 100644
> --- a/arch/arm64/kernel/machine_kexec.c
> +++ b/arch/arm64/kernel/machine_kexec.c
> @@ -17,6 +17,7 @@
>
> #include <asm/cacheflush.h>
> #include <asm/cpu_ops.h>
> +#include <asm/memory.h>
> #include <asm/mmu_context.h>
>
> #include "cpu-reset.h"
> @@ -260,3 +261,13 @@ void machine_crash_shutdown(struct pt_regs *regs)
>
> pr_info("Starting crashdump kernel...\n");
> }
> +
> +void arch_crash_save_vmcoreinfo(void)
> +{
> + VMCOREINFO_NUMBER(VA_BITS);
> + /* Please note VMCOREINFO_NUMBER() uses "%d", not "%x" */
> + vmcoreinfo_append_str("NUMBER(kimage_voffset)=0x%llx\n",
> + kimage_voffset);
> + vmcoreinfo_append_str("NUMBER(PHYS_OFFSET)=0x%llx\n",
> + PHYS_OFFSET);
> +}
>
> Dave
>
>
>
>
> >
> > Signed-off-by: Zhizhou Zhang <zhizhouzhang at asrmicro.com>
> > ---
> > arm64.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arm64.c b/arm64.c
> > index 6eaf96d..f79f0a5 100644
> > --- a/arm64.c
> > +++ b/arm64.c
> > @@ -119,7 +119,7 @@ arm64_init(int when)
> >
> > if (!ms->kimage_voffset &&
> > (string = pc->read_vmcoreinfo("NUMBER(kimage_voffset)"))) {
> > - ms->kimage_voffset = htol(string, QUIET, NULL);
> > + ms->kimage_voffset = atol(string);
> > free(string);
> > }
> >
> > --
> > 1.9.1
> >
> > --
> > Crash-utility mailing list
> > Crash-utility at redhat.com
> > https://www.redhat.com/mailman/listinfo/crash-utility
> >
More information about the Crash-utility
mailing list