Re: [PATCH V3 1/2] RISC-V: Add arch_crash_save_vmcoreinfo support

From: HAGIO KAZUHITO(萩尾 一仁)
Date: Wed Oct 19 2022 - 21:36:47 EST


On 2022/10/19 12:17, Xianting Tian wrote:

>>>>>>> +    if (IS_ENABLED(CONFIG_64BIT)) {
>>>>>>> +#ifdef CONFIG_KASAN
>>>>>>> +        vmcoreinfo_append_str("NUMBER(KASAN_SHADOW_START)=0x%lx\n", KASAN_SHADOW_START);
>>>>>>> +        vmcoreinfo_append_str("NUMBER(KASAN_SHADOW_END)=0x%lx\n", KASAN_SHADOW_END);
>>>>>>> +#endif
>>>>>>> +        vmcoreinfo_append_str("NUMBER(KERNEL_LINK_ADDR)=0x%lx\n", KERNEL_LINK_ADDR);
>>>>>>> +        vmcoreinfo_append_str("NUMBER(ADDRESS_SPACE_END)=0x%lx\n", ADDRESS_SPACE_END);
>>>>>> Seems this is the firsr ARCH where kasan and kernel link/bpf space are
>>>>>> added to dump and analyze. Just curious, have you got code change to
>>>>>> make use of them to do dumping and analyze?
>>>>> KASAN_SHADOW_START is not used, KERNEL_LINK_ADDR is used in the crash patch set:
>>>>> https://patchwork.kernel.org/project/linux-riscv/cover/20220813031753.3097720-1-xianting.tian@xxxxxxxxxxxxxxxxx/
>>>> Oh, I would say please no. Sometime we got tons of objection when adding an
>>>> necessary one, we definitely should not add one for possible future
>>>> use.
>>>>
>>>> For this kind of newly added one, we need get ack from
>>>> makedumpfile/crash utility maintainer so that we know they are necessary
>>>> to have. At least they don't oppose.
>>> Hi Kazu, Li Jiang
>>>
>>> Could you help comment whether we need KASAN_SHADOW_START and KERNEL_LINK_ADDR area export for vmcore from crash point of view?
>>>
>>> In my crash patch set, I don't use KASAN_SHADOW_START,
>>> And only get the value of KERNEL_LINK_ADDR, not realy use it.
>>> https://patchwork.kernel.org/project/linux-riscv/cover/20220813031753.3097720-1-xianting.tian@xxxxxxxxxxxxxxxxx/
>> In your crash patch set, KERNEL_LINK_ADDR is used in VTOP() and looks
>> necessary to me.
>>
>> The others (KASAN_SHADOW_START, KASAN_SHADOW_END and ADDRESS_SPACE_END)
>> are not currently used.  It may be better to add them when they are
>> really used.
>
> I am very sorry, I missed it , KERNEL_LINK_ADDR is used indeed.
>
> KASAN_SHADOW_START is not used, so I don't need to send crash patch set> again. only need to remove KASAN_SHADOW_END in kernel patch set.

I see that your v4 kernel patch set does not have ADDRESS_SPACE_END,
so it seems there would be need to change this part and related ones
at crash side.

if ((string = pc->read_vmcoreinfo("NUMBER(ADDRESS_SPACE_END)"))) {
ms->address_space_end = htol(string, QUIET, NULL);
free(string);
} else
goto error;
...
error:
error(FATAL, "cannot get vm layout\n");

Thanks,
Kazu