Skip to contentSkip to conversation

powerpc: add `cur_cpu_spec` symbol to vmcoreinfo

PATCH Applied Aditya Gupta 5 participants 14 messages Sep 11, 2023 – Sep 22, 2023 PowerPC

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: add `cur_cpu_spec` symbol to vmcoreinfo

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

---
 arch/powerpc/kexec/core.c | 2 ++
 1 file changed, 2 insertions(+)
arch/powerpc/kexec/core.c +2 -0
index de64c7962991..369b8334a4f0 100644
@@ -63,6 +63,8 @@ void arch_crash_save_vmcoreinfo(void)
 #ifndef CONFIG_NUMA
 	VMCOREINFO_SYMBOL(contig_page_data);
 #endif
+	VMCOREINFO_SYMBOL(cur_cpu_spec);
+	VMCOREINFO_OFFSET(cpu_spec, mmu_features);
 #if defined(CONFIG_PPC64) && defined(CONFIG_SPARSEMEM_VMEMMAP)
 	VMCOREINFO_SYMBOL(vmemmap_list);
 	VMCOREINFO_SYMBOL(mmu_vmemmap_psize);
Signature · 1 line
2.41.0
Tested-by on v1 1/1
#1 lore raw
Quoted 13 lines · Aditya Gupta

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.

Quoted 6 lines

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

---

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

- Sachin

#2 lore raw

Hello Sachin,

Quoted 17 lines · Sachin Sant
Quoted 17 lines · Aditya Gupta

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

Quoted 8 lines
Quoted 2 lines

---

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

Thanks for testing this, and for providing the tags.

- Aditya Gupta

#3 lore raw
In reply to Sachin Sant
Quoted 15 lines · Sachin Sant
Quoted 15 lines · Aditya Gupta

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

Quoted 5 lines
Quoted 2 lines

---

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.

cheers

#4 lore raw
Quoted 20 lines · Michael Ellerman
Quoted 15 lines · Sachin Sant
Quoted 15 lines · Aditya Gupta

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

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

---

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)

#5 lore raw
Quoted 28 lines · Sachin Sant
Quoted 18 lines · Michael Ellerman
Quoted 15 lines · Sachin Sant
Quoted 15 lines · Aditya Gupta

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

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

---

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.

Quoted 6 lines

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.

Also I don't know what pgd_offset_l4 is?

cheers

#6 lore raw

Hello mpe,

Quoted 32 lines · Michael Ellerman
Quoted 31 lines · Sachin Sant
Quoted 18 lines · Michael Ellerman
Quoted 15 lines · Sachin Sant
Quoted 15 lines · Aditya Gupta

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

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

---

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.

Quoted 8 lines
Quoted 3 lines

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.

Quoted 2 lines

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.

Quoted 2 lines

cheers

Thanks

#7 lore raw
In reply to Aditya Gupta
Quoted 4 lines · Aditya Gupta

Presently, while reading a vmcore, makedumpfile uses cur_cpu_spec.mmu_features to decide whether the crashed system had RADIX MMU or not.

Quoted 8 lines

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

This looks fine.

Seems like cpu_features would be needed or at least pretty useful too?

cheers

#8 lore raw
Quoted 10 lines · Michael Ellerman
Quoted 9 lines · Aditya Gupta

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.

Quoted 7 lines
Quoted 3 lines

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

This looks fine.

Seems like cpu_features would be needed or at least pretty useful too?

Yeah. Would be nice to have access to that, to accurately identify the kind of system vmcore was generated for.

Thanks
Hari

#9 lore raw
In reply to Michael Ellerman
Quoted 14 lines · Michael Ellerman
Quoted 4 lines · Aditya Gupta

Presently, while reading a vmcore, makedumpfile uses cur_cpu_spec.mmu_features to decide whether the crashed system had RADIX MMU or not.

Quoted 8 lines

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

Quoted 5 lines

This looks fine.

Seems like cpu_features would be needed or at least pretty useful too?

cheers

Sure, that can be added too, to the vmcoreinfo. Not sure if it's used now, but sure it can help to identify features in makedumpfile.

Will add it, in next version.

Thanks
- Aditya Gupta

#10 lore raw
Quoted 17 lines · Aditya Gupta
Quoted 16 lines · Michael Ellerman
Quoted 4 lines · Aditya Gupta

Presently, while reading a vmcore, makedumpfile uses cur_cpu_spec.mmu_features to decide whether the crashed system had RADIX MMU or not.

Quoted 8 lines

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

This looks fine.

Quoted 8 lines
Quoted 3 lines

Seems like cpu_features would be needed or at least pretty useful too?

cheers

Sure, that can be added too, to the vmcoreinfo. Not sure if it's used now, but sure it can help to identify features in makedumpfile.

Will add it, in next version.

Please do it in a separate commit to the mmu_features :)

cheers

#11 lore raw
Quoted 22 lines · Michael Ellerman
Quoted 21 lines · Aditya Gupta
Quoted 19 lines · Michael Ellerman
Quoted 4 lines · Aditya Gupta

Presently, while reading a vmcore, makedumpfile uses cur_cpu_spec.mmu_features to decide whether the crashed system had RADIX MMU or not.

Quoted 8 lines

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

This looks fine.

Seems like cpu_features would be needed or at least pretty useful too?

cheers

Quoted 8 lines
Quoted 4 lines

Sure, that can be added too, to the vmcoreinfo. Not sure if it's used now, but sure it can help to identify features in makedumpfile.

Will add it, in next version.

Please do it in a separate commit to the mmu_features :)

cheers

Sure, have done it in a separate patch in V2.

Thanks

#12 lore raw
In reply to Aditya Gupta
Quoted 10 lines · Aditya Gupta

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.

[...]

Applied to powerpc/next.

[1/1] powerpc: add cur_cpu_spec symbol to vmcoreinfo

      https://git.kernel.org/powerpc/c/7135b921b32966d7602ede396b7286d372aee63f

cheers

#13 lore raw
Quoted 10 lines · Michael Ellerman
Quoted 9 lines · Aditya Gupta

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.

Quoted 8 lines
Quoted 1 line

[...]

Applied to powerpc/next.

[1/1] powerpc: add cur_cpu_spec symbol to vmcoreinfo

      https://git.kernel.org/powerpc/c/7135b921b32966d7602ede396b7286d372aee63f

cheers

Thanks for the update