On 2023/06/12 15:48, lijiang wrote:
>>> I checked the crash code. For the s390x, it doesn't invoke the
>>> map_cpus_to_prstatus{_kdump_cmprs}(), so this patch should not affect
>> the
>>> s390x arch.
>>
>> My thought is that the original commit db8c030857b4 should have added
>> the initialization of SIZE(note_buf) in task_init(), because there might
>> be some architectures that do not initialize it and it's better to
>> initialize it when it's used, e.g. like this:
>>
>> --- a/task.c
>> +++ b/task.c
>> @@ -675,6 +675,8 @@ task_init(void)
>> tt->this_task = pid_to_task(active_pid);
>> }
>> else {
>> + if (INVALID_SIZE(note_buf))
>> + STRUCT_SIZE_INIT(note_buf, "note_buf_t");
>> if (KDUMP_DUMPFILE())
>> map_cpus_to_prstatus();
>> else if (ELF_NOTES_VALID() && DISKDUMP_DUMPFILE())
>>
>>
> Ok, fine to me. But, generally it should be good to be initialized in the
> machdep_init() because the note_buf is strongly related to the
> crash_notes, and the crash_notes contains machine specific information such
> as cpu registers at the time of crash.
Just my guess is that, the architectures have the initialization in
their machdep_init() because they use SIZE(note_buf) in their specific
code e.g. arm64.c. (maybe x86s are for sadump or xen?)
It's readable and reasonable that basically users prepare things at
where they are used, I think.
Thanks,
Kazu
--
Crash-utility mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki