aboutsummaryrefslogtreecommitdiff
path: root/lib/libkvm/kvm_minidump_arm.c
diff options
context:
space:
mode:
authorD Scott Phillips <scottph@FreeBSD.org>2020-09-21 22:21:59 +0000
committerD Scott Phillips <scottph@FreeBSD.org>2020-09-21 22:21:59 +0000
commit00e6614750deca2457373aecd5bfa7aebbde3865 (patch)
tree73c950caf7bef81919555e2270ded794535c1b37 /lib/libkvm/kvm_minidump_arm.c
parentab041f713aeccdf23b4805ffb71815c8d4aa9c88 (diff)
downloadsrc-00e6614750deca2457373aecd5bfa7aebbde3865.tar.gz
src-00e6614750deca2457373aecd5bfa7aebbde3865.zip
Sparsify the vm_page_dump bitmap
On Ampere Altra systems, the sparse population of RAM within the physical address space causes the vm_page_dump bitmap to be much larger than necessary, increasing the size from ~8 Mib to > 2 Gib (and overflowing `int` for the size). Changing the page dump bitmap also changes the minidump file format, so changes are also necessary in libkvm. Reviewed by: jhb Approved by: scottl (implicit) MFC after: 1 week Sponsored by: Ampere Computing, Inc. Differential Revision: https://reviews.freebsd.org/D26131
Notes
Notes: svn path=/head/; revision=365978
Diffstat (limited to 'lib/libkvm/kvm_minidump_arm.c')
-rw-r--r--lib/libkvm/kvm_minidump_arm.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/libkvm/kvm_minidump_arm.c b/lib/libkvm/kvm_minidump_arm.c
index e515c1c60780..e76889c5eb8f 100644
--- a/lib/libkvm/kvm_minidump_arm.c
+++ b/lib/libkvm/kvm_minidump_arm.c
@@ -86,7 +86,7 @@ static int
_arm_minidump_initvtop(kvm_t *kd)
{
struct vmstate *vmst;
- off_t off, sparse_off;
+ off_t off, dump_avail_off, sparse_off;
vmst = _kvm_malloc(kd, sizeof(*vmst));
if (vmst == NULL) {
@@ -108,7 +108,7 @@ _arm_minidump_initvtop(kvm_t *kd)
return (-1);
}
vmst->hdr.version = _kvm32toh(kd, vmst->hdr.version);
- if (vmst->hdr.version != MINIDUMP_VERSION) {
+ if (vmst->hdr.version != MINIDUMP_VERSION && vmst->hdr.version != 1) {
_kvm_err(kd, kd->program, "wrong minidump version. "
"Expected %d got %d", MINIDUMP_VERSION, vmst->hdr.version);
return (-1);
@@ -123,14 +123,20 @@ _arm_minidump_initvtop(kvm_t *kd)
/* This is a safe default as 1K pages are not used. */
vmst->hdr.mmuformat = MINIDUMP_MMU_FORMAT_V6;
}
+ vmst->hdr.dumpavailsize = vmst->hdr.version == MINIDUMP_VERSION ?
+ _kvm32toh(kd, vmst->hdr.dumpavailsize) : 0;
/* Skip header and msgbuf */
- off = ARM_PAGE_SIZE + arm_round_page(vmst->hdr.msgbufsize);
+ dump_avail_off = ARM_PAGE_SIZE + arm_round_page(vmst->hdr.msgbufsize);
+
+ /* Skip dump_avail */
+ off = dump_avail_off + arm_round_page(vmst->hdr.dumpavailsize);
sparse_off = off + arm_round_page(vmst->hdr.bitmapsize) +
arm_round_page(vmst->hdr.ptesize);
- if (_kvm_pt_init(kd, vmst->hdr.bitmapsize, off, sparse_off,
- ARM_PAGE_SIZE, sizeof(uint32_t)) == -1) {
+ if (_kvm_pt_init(kd, vmst->hdr.dumpavailsize, dump_avail_off,
+ vmst->hdr.bitmapsize, off, sparse_off, ARM_PAGE_SIZE,
+ sizeof(uint32_t)) == -1) {
return (-1);
}
off += arm_round_page(vmst->hdr.bitmapsize);