Hi Kazu,
在 2023/11/30 15:29, HAGIO KAZUHITO(萩尾 一仁) 写道:
On 2023/11/30 16:21, HAGIO KAZUHITO(萩尾 一仁) wrote:
> thanks for the patch.
>
> On 2023/11/28 12:41, Huang Shijie wrote:
>> If the kernel exports the vmmemap then we can use that symbol in
>> crash to optimize access. vmmemap is just an array of page structs
>> after all.
>>
>> This patch tries to get the "vmemmap" from the vmcore file.
>> If we can use the "vmemmap", use the vmemmap_is_page_ptr to replace
>> the generic_is_page_ptr().
> I recalled that I also did a similar thing for x86_64 [1] in the past..
> so it's not so slow on x86_64 and it has valid section check too.
Maybe
your vmlinux is not so big as mine(441M)...
> [1]
>
https://github.com/crash-utility/crash/commit/4141373d9de3fea29f5d2b58f60...
>
> I don't object to add an entry to vmcoreinfo as a way of getting the
> vmemmap value. Seems like arm64 has another value from VMEMMAP_START.
>
> but there are some concerns in crash:
>
> - machdep->flags already has VMEMMAP flag. It's used like "if
> (IS_SPARSEMEM() && (machdep->flags & VMEMMAP)" e.g. [1]. Adding
the new
> flag is very confusing and inconsistent.
>
> - Do all architectures have VMEMMAP_VADDR/END values in crash with
> CONFIG_SPARSEMEM_VMEMMAP configured?
yes. your concern are right. I found some arch does not support the
VMEMMAP_VADDR/END.
So it is better to add this into ARM64 first. (I use the arm64 machine
all the time..)
>
> we cannot test all archs, so this kind of arch-independent change makes
> me nervous. I would like to suggest an arch-specific use first. e.g.
> how about making x86_64_is_page_ptr more generic and use it?
>
I will add arm64 version code. I am not familar with x86, and I do not
have x86 machine for the testing.
so it's better to not change it.
> What happens if you use it on arm64? maybe the valid section can
check
> it with VMEMMAP_VADDR without the vmemmap value. Just an idea though.
hmm sorry, probably this does not work, I missed this.
+ pfn = (addr - vt->vmemmap) / size;
The code is converted by the linux code:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/i...
#define __page_to_pfn(page) (unsigned long)((page) - vmemmap)
So it's correct.
but can VMEMMAP_VADDR and phys_offset can be used to get vmemmap value
on arm64?
On arm64, I can get vmemmap by parsing "memstart_addr".
But I cannot know if CONFIG_SPARSEMEM_VMEMMAP is enabled.
So if the kernel can export "vmemmap", everything become easy.
All the archs supporting the VMEMMAP can benifit from it, such as arm64,
ppc,loongarch,riscv..
Thanks
Huang Shijie