[PATCH] powerpc: add `cur_cpu_spec` symbol to vmcoreinfo

Aditya Gupta adityag at linux.ibm.com
Tue Sep 19 19:17:11 AEST 2023

Hello mpe,

On Fri, Sep 15, 2023 at 11:16:08AM +1000, Michael Ellerman wrote:
> Sachin Sant <sachinp at linux.ibm.com> writes:
> >> On 14-Sep-2023, at 6:52 PM, Michael Ellerman <mpe at ellerman.id.au> wrote:
> >> 
> >> Sachin Sant <sachinp at linux.ibm.com> writes:
> >>>> On 11-Sep-2023, at 2:44 PM, Aditya Gupta <adityag at linux.ibm.com> wrote:
> >>>> 
> >>>> Presently, while reading a vmcore, makedumpfile uses
> >>>> `cur_cpu_spec.mmu_features` to decide whether the crashed system had
> >>>> RADIX MMU or not.
> >>>> 
> >>>> Currently, makedumpfile fails to get the `cur_cpu_spec` symbol (unless
> >>>> a vmlinux is passed with the `-x` flag to makedumpfile), and hence
> >>>> assigns offsets and shifts (such as pgd_offset_l4) incorrecly considering
> >>>> MMU to be hash MMU.
> >>>> 
> >>>> Add `cur_cpu_spec` symbol and offset of `mmu_features` in the
> >>>> `cpu_spec` struct, to VMCOREINFO, so that the symbol address and offset
> >>>> is accessible to makedumpfile, without needing the vmlinux file
> >>>> 
> >>>> Signed-off-by: Aditya Gupta <adityag at linux.ibm.com>
> >>>> ---
> >>> 
> >>> Thanks for the patch. With this patch applied (along with makedumpfile changes)
> >>> I am able to capture vmcore against a kernel which contains commit 8dc9a0ad0c3e
> >> 
> >> I can't find that commit? Was just wondering if it should be referenced
> >> in the commit message.
> >> 
> >
> > My bad, I copied that commit id from the email when I first reported this issue
> > against linux-next.
> >
> > The commit should be 
> > 368a0590d954: (powerpc/book3s64/vmemmap: switch radix to use a
> > different vmemmap handling function)
> OK thanks.
> Aditya, can you please rephrase the commit message to mention how that
> commit broke the previous behaviour.

Offsets were being wrongly assigned, in makedumpfile, in Radix MMU case (unless
-x vmlinux was passed to makedumpfile, which generally isn't the case)

That was happening even before the '368a0590d954' commit mentioned, it's just
that we hit the issue now, since with above commit, we needed to use those
offsets for page traversal, in makedumpfile. And those offsets were incorrecly
assigned, and hence page traversal failed.

For the offsets/shifts to be correctly assigned in makedumpfile,
`cur_cpu_spec.mmu_features` needs to be exported in VMCOREINFO by kernel.

> Also I don't know what pgd_offset_l4 is?

Sure, I will try to explain with more context in commit description in next
version, or directly mention the particular shifts that was wrong.

In makedumpfile, it is the offset of pgdir from the kernel pgd, for a given
virtual address

It is same as what the `pgd_index` function returns, in the powerpc
kernel source.

> cheers


More information about the Linuxppc-dev mailing list