Page MenuHomeFreeBSD

[PPC64] Initial libkvm minidump implementation
ClosedPublic

Authored by luporl on Sep 6 2019, 6:48 PM.

Details

Summary

This change adds PowerPC64 support for minidumps on libkvm.

Address translation, page walk, and data retrieval were tested and seem to be working correctly.

This enables crashinfo to start gathering information about a kernel minidump, although there are still several issues, but most seem to be related to missing pages in the kernel minidump.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

luporl created this revision.Sep 6 2019, 6:48 PM
mhorne added a subscriber: mhorne.Sep 8 2019, 4:00 PM
mhorne added inline comments.
lib/libkvm/kvm_minidump_powerpc64.c
3 ↗(On Diff #61752)

You can remove my copyright from this since it is only really for the RISC-V specific bits.

jhibbits added inline comments.Sep 9 2019, 7:57 PM
lib/libkvm/kvm_private.c
135 ↗(On Diff #61752)

Maybe we can also add EM_PPC to this, since 32-bit powerpc kernels are ET_DYN. A separate change. But, maybe this change itself can be isolated to a different diff, and committed as adding powerpc* support to the probe function?

luporl updated this revision to Diff 61880.Sep 10 2019, 1:22 PM
  • Address reviews' comments

_kvm_probe_elf_kernel() change was moved to a separate change

luporl marked an inline comment as done.Sep 10 2019, 1:25 PM
luporl added inline comments.
lib/libkvm/kvm_minidump_powerpc64.c
3 ↗(On Diff #61752)

Ok, thanks.

luporl marked an inline comment as done.Sep 10 2019, 1:25 PM
luporl updated this revision to Diff 62054.Sep 13 2019, 6:57 PM
  • [PPC64] Handle relocated kernels properly
  • Merge branch 'master' into luporl-crashdump-libkvm

This is very specific to AIM64 HPT. Can you rename it to kvm_..._hpt.c, or something, and add another key to the header to probe against for the particular pmap implementation? I'll want to add Book-E support, as well as AIM Radix when we do finally get radix stabilized.

luporl updated this revision to Diff 62788.Oct 1 2019, 12:55 PM

[PPC64] libkvm minidump refactoring

Moved HPT MMU specific code to a separate file.
Each new MMU implementation is expected to implement the methods
of struct ppc64_mmu_ops.

luporl added a comment.Oct 1 2019, 1:15 PM

This is very specific to AIM64 HPT. Can you rename it to kvm_..._hpt.c, or something, and add another key to the header to probe against for the particular pmap implementation? I'll want to add Book-E support, as well as AIM Radix when we do finally get radix stabilized.

I've moved the HPT MMU specific parts to kvm_minidump_powerpc64_hpt.c.
The key was added and is used to select the proper MMU implementation to use.

I didn't make this a completely different implementation of a KVM_ARCH because of the following reasons:

  • Code duplication: there is a considerable amount of code that can be shared among different PPC64 address translation schemes
  • Heavy probe: kvm probe method would need to perform several operations in order to detect the correct arch implementation. While other probe implementations simply check a few fields of kernel ELF and minidump, we would need to:
    • Allocate memory
    • Read the header from the minidump file
    • Check magic, convert and check version
    • Compare mmu_name

      In this way, the probe process would be less efficient and this would impact other architectures as well.

That's why the approach used in this change is to let the common parts in kvm_minidump_powerpc64.c and the specifics in struct ppc64_mmu_ops, that are called when necessary.

luporl updated this revision to Diff 62795.Oct 1 2019, 5:02 PM
  • make kvatop handle dpcpu/vnet addresses properly
luporl added a subscriber: PowerPC.Dec 4 2019, 11:48 AM
luporl removed a subscriber: PowerPC.
jhibbits accepted this revision.Dec 8 2019, 4:50 AM
This revision is now accepted and ready to land.Dec 8 2019, 4:50 AM
This revision was automatically updated to reflect the committed changes.