RE: [PATCH v2 1/2] makedumpfile/arm64: Use VMCOREINFO inside '/proc/kcore' (if available)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/2/2018 5:00 PM, Kazuhito Hagio wrote:
> Originally, info->page_offset (PAGE_OFFSET) is used in the following
> parts on arm64.
> 
> arch/arm64.c:
> __pa(unsigned long vaddr)
> {
>         if (kimage_voffset == NOT_FOUND_NUMBER ||
>                         (vaddr >= PAGE_OFFSET))
>                 return (vaddr - PAGE_OFFSET + info->phys_base);
>         else
>                 return (vaddr - kimage_voffset);
> }
> 
> elf_info.c:
>         kvstart = (ulong)start + PAGE_OFFSET;
>         kvend = (ulong)end + PAGE_OFFSET;
> --
>         kvaddr = (ulong)vmcoreinfo_addr + PAGE_OFFSET;
> 
> I'm wondering about its consistency.  Is it OK to set
> (virt_start - phys_start) to info->page_offset on arm64?
> In other words, on arm64 system with info->phys_base != 0, does it
> work correctly for both /proc/vmcore and --mem-usage /proc/kcore?

I found an arm64 system available and (virt_start - phys_start)
tested OK for both /proc/vmcore and --mem-usage /proc/kcore,
because the __pa() function is used just only for swapper_pg_dir
and the "(vaddr - PAGE_OFFSET + info->phys_base)" line is not used.

The definition of PAGE_OFFSET in kernel is:

  #define PAGE_OFFSET             (UL(0xffffffffffffffff) - \
          (UL(1) << (VA_BITS - 1)) + 1)

The one in crash is:

  #define ARM64_PAGE_OFFSET    ((0xffffffffffffffffUL) \
                                        << (machdep->machspec->VA_BITS - 1))

So I think it would be better to use the same definition also in
makedumpfile to avoid confusion. In other words, I think the following
does not support arm64 now, and ideally should be fixed by introducing
something like phys_to_virt()..

elf_info.c:
        kvstart = (ulong)start + PAGE_OFFSET;
        kvend = (ulong)end + PAGE_OFFSET;
        --
        kvaddr = (ulong)vmcoreinfo_addr + PAGE_OFFSET;

and then,

  if (NUMBER(VA_BITS) != NOT_FOUND_NUMBER)
      va_bits = NUMBER(VA_BITS);
  else
      ... va_vits calculation ...

  info->page_offset = 0xffffffffffffffffUL << (va_bits - 1);

And also we will need to add get_phys_base() to show_mem_usage()
with some additional code for arm64 with old kernels.
I'm considering this approach.

Thanks,
Kazu



_______________________________________________
kexec mailing list
kexec@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/kexec



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux