Dear Kazuhito,

Sorry for late reply and mail with html format

Our patch was implemented and verified with our kedump.
We will resend a mail to upstream it and refine mail title as "arm64: Get CPU registers without crash_notes symbol"?

About your suggestion that it could be united with the code when crash_notes exists, we will try it when we can generate a kedump with crash_note
So we want to upstream current patch first,  hope you can accept it.

Thanks,
James Hsu

-----Original Message-----
From: HAGIO KAZUHITO(萩尾 一仁) [mailto:k-hagio-ab@nec.com] 
Sent: Friday, July 30, 2021 3:42 PM
To: James Hsu (徐慶薰); Discussion list for crash utility usage, maintenance and development
Cc: Nicholas Tang (鄭秦輝)
Subject: RE: [Crash-utility] [Crash Utility] Improvement for getting offline CPU register without symbol "crash_notes"

Hi James, Nicholas,

sorry for the late reply.

-----Original Message-----
> 
> Dear Maintaniners,
> 
> 
> 
> Sorry for attaching a not readable patch file at previous mail.
> 
> I add the diff of the patch inline for your review.

Thanks.
but please use text format next time, not HTML email, if possible.

> 
> 
> 
> And provide the reason of improvement again and look forward for your feedback.
> 
> 
> 
> We want to improve the crash_tool for the case that need offline cpu 
> register info even Kdump without crash_notes.
> 
> 
> 
> For one thing,  we will prepare a Kdump with all CPU register info in ELF note.

Just to clarify, is this not implemented yet?
So currently the subject should be something like "arm64: Get CPU registers without crash_notes symbol"?

As for the patch itself, I'm fine with it, although it looks like maybe it can be united with the code when crash_notes exists.

Thanks,
Kazu


> 
> For another thing, we need to modify crash_tool and make it support 
> adding offline cpu register info even Kdump without crash_notes.
> 
> 
> 
> 
> 
> Signed-off-by: Nicholas Tang <Nicholas.tang@mediatek.com>
> 
> 
> 
> --- crash-7.3.0/arm64.c  2021-04-27 16:01:07.000000000 +0800
> 
> +++ crash-7.3.0.mod/arm64.c    2021-06-15 17:13:54.037273227 +0800
> 
> @@ -3667,8 +3667,41 @@ arm64_get_crash_notes(void)
> 
>                ulong *notes_ptrs;
> 
>                ulong i, found;
> 
> -              if (!symbol_exists("crash_notes"))
> 
> +             if (!symbol_exists("crash_notes")) {
> 
> +                             if (DISKDUMP_DUMPFILE() || 
> + KDUMP_DUMPFILE()) {
> 
> +                                             if 
> + (!(ms->panic_task_regs = calloc((size_t)kt->cpus,
> sizeof(struct arm64_pt_regs))))
> 
> +                                                             
> + error(FATAL, "cannot calloc
> panic_task_regs space\n");
> 
> +
> 
> +                                             for  (i = found = 0; i < 
> + kt->cpus; i++) {
> 
> +                                                             if 
> + (DISKDUMP_DUMPFILE())
> 
> +                                                                             
> + note =
> diskdump_get_prstatus_percpu(i);
> 
> +                                                             else if 
> + (KDUMP_DUMPFILE())
> 
> +                                                                             
> + note =
> netdump_get_prstatus_percpu(i);
> 
> +                                                             else {
> 
> +                                                                             error(WARNING, "cpu %d:
> cannot find NT_PRSTATUS note\n", i);
> 
> +                                                                             
> + continue;
> 
> +                                                             }
> 
> +
> 
> +                                                             /*
> 
> +                                                             * Find 
> + correct location of note data. This
> contains elf_prstatus
> 
> +                                                             * 
> + structure which has registers etc. for
> the crashed task.
> 
> +                                                             */
> 
> +                                                             offset = 
> + sizeof(Elf64_Nhdr);
> 
> +                                                             offset = 
> + roundup(offset + note->n_namesz,
> 4);
> 
> +                                                             p = 
> + (char *)note + offset; /* start of
> elf_prstatus */
> 
> +
> 
> +                                                             BCOPY(p 
> + + OFFSET(elf_prstatus_pr_reg),
> &ms->panic_task_regs[i],
> 
> +                                                                   
> + sizeof(struct arm64_pt_regs));
> 
> +
> 
> +                                                             found++;
> 
> +                                             }
> 
> +                             }
> 
> +                             if (!found) {
> 
> +                                             
> + free(ms->panic_task_regs);
> 
> +                                             ms->panic_task_regs = 
> + NULL;
> 
> +                             }
> 
>                                return;
> 
> +             }
> 
>                 crash_notes = symbol_value("crash_notes");
> 
> 
> 
> BR
> 
> James Hsu
> 
> From: James Hsu (徐慶薰)
> Sent: Wednesday, July 7, 2021 3:11 PM
> To: crash-utility@redhat.com
> Cc: Nicholas Tang (鄭秦輝); James Hsu (徐慶薰)
> Subject: [Crash Utility] Improvement for getting offline CPU register without symbol "crash_notes"
> 
> 
> 
> Dear crash_tool maintainers,
> 
> 
> 
> We want to improve the crash_tool for the case that need offline cpu 
> register info even Kdump without crash_notes.
> 
> 
> 
> For one thing,  we will prepare a Kdump with all CPU register info in ELF note.
> 
> For another thing, we need to modify crash_tool and make it support 
> adding offline cpu register info even Kdump without crash_notes.
> 
> 
> 
> We prepare a patch for the case with ARCH=arm64.
> 
> Please take your time to review our patch and look forward to receving your comments.
> 
> 
> 
> BR
> 
> James Hsu
> 
> 
> 
> 
> 
> 
> 
> *********************MEDIATEK Confidential/Internal 
> Use*********************
> 
> ************* MEDIATEK Confidentiality Notice ******************** The 
> information contained in this e-mail message (including any
> attachments) may be confidential, proprietary, privileged, or 
> otherwise exempt from disclosure under applicable laws. It is intended 
> to be conveyed only to the designated recipient(s). Any use, 
> dissemination, distribution, printing, retaining or copying of this 
> e-mail (including its
> attachments) by unintended recipient(s) is strictly prohibited and may 
> be unlawful. If you are not an intended recipient of this e-mail, or 
> believe that you have received this e-mail in error, please notify the 
> sender immediately (by replying to this e-mail), delete any and all 
> copies of this e-mail (including any attachments) from your system, 
> and do not disclose the content of this e-mail to any other person. Thank you!

************* MEDIATEK Confidentiality Notice ********************
The information contained in this e-mail message (including any 
attachments) may be confidential, proprietary, privileged, or otherwise
exempt from disclosure under applicable laws. It is intended to be 
conveyed only to the designated recipient(s). Any use, dissemination, 
distribution, printing, retaining or copying of this e-mail (including its 
attachments) by unintended recipient(s) is strictly prohibited and may 
be unlawful. If you are not an intended recipient of this e-mail, or believe 
that you have received this e-mail in error, please notify the sender 
immediately (by replying to this e-mail), delete any and all copies of 
this e-mail (including any attachments) from your system, and do not
disclose the content of this e-mail to any other person. Thank you!