Page MenuHomeFreeBSD

libkvm: add kvm_walk_pages API.
ClosedPublic

Authored by will on Sep 8 2017, 5:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 11:47 PM
Unknown Object (File)
Wed, Nov 20, 11:17 PM
Unknown Object (File)
Thu, Nov 14, 9:40 AM
Unknown Object (File)
Fri, Nov 1, 3:58 AM
Unknown Object (File)
Wed, Oct 30, 2:57 AM
Unknown Object (File)
Oct 18 2024, 10:05 PM
Unknown Object (File)
Oct 18 2024, 10:44 AM
Unknown Object (File)
Oct 17 2024, 4:09 AM
Subscribers

Details

Summary

This API allows callers to enumerate all known pages, including any
direct map & kernel map virtual addresses, physical addresses, size,
offset into the core, & protection configured.

For architectures that support direct map addresses, also generate pages
for any direct map only addresses that are not associated with kernel
map addresses.

Fix page size portability issue left behind from previous kvm page table
lookup interface.

Test Plan

Install libkvm, make sure kgdb et al still work (should be a no-op).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

  • kvm: pass up better error messages.
lib/libkvm/kvm.c
503 ↗(On Diff #32820)

Minor style nit: parens around return value.

lib/libkvm/kvm_aarch64.h
47 ↗(On Diff #32820)

Tab after #define instead of space

lib/libkvm/kvm_arm.h
56 ↗(On Diff #32820)

Another tab vs space.

lib/libkvm/kvm_minidump_amd64.c
69 ↗(On Diff #32820)

I found it somewhat confusing at first that there was both pde_get() and pte_get() for amd64, it might warrant a short block comment above these functions explaining that version 1 dumps use pte_get() and version 2 use pde_get()

342 ↗(On Diff #32820)

Since this always reads pdes, does it only work for version 2? If so, we should check the version?

will marked 2 inline comments as done.
  • libkvm: fix minor nits.
lib/libkvm/kvm_minidump_amd64.c
342 ↗(On Diff #32820)

You're right.

Version 2 was added in 2010, so all versions after that point only generate v2 minidumps. Would it be acceptable to simply leave it out of this change?

lib/libkvm/kvm_minidump_amd64.c
342 ↗(On Diff #32820)

I think just adding a version check and failing for version 1 dumps is probably fine. I'd just rather have an explicit failure than undefined behavior.

  • libkvm: require v2 minidumps for walk_pages on amd64.
will marked an inline comment as done.Oct 2 2017, 5:53 PM

On amd64, this now requires v2 minidumps (generated since 2010).

@jhb Any further feedback? Does this look ready for HEAD?

This should be fine. I think the diff in phab is just a diff relative to the previous rather than the full diff FWIW.

This revision is now accepted and ready to land.Nov 6 2017, 8:48 PM
This revision was automatically updated to reflect the committed changes.