Page MenuHomeFreeBSD

D31884.diff
No OneTemporary

D31884.diff

diff --git a/sys/amd64/amd64/minidump_machdep.c b/sys/amd64/amd64/minidump_machdep.c
--- a/sys/amd64/amd64/minidump_machdep.c
+++ b/sys/amd64/amd64/minidump_machdep.c
@@ -66,21 +66,6 @@
SYSCTL_INT(_machdep, OID_AUTO, dump_retry_count, CTLFLAG_RWTUN,
&dump_retry_count, 0, "Number of times dump has to retry before bailing out");
-static int
-is_dumpable(vm_paddr_t pa)
-{
- vm_page_t m;
- int i;
-
- if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL)
- return ((m->flags & PG_NODUMP) == 0);
- for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) {
- if (pa >= dump_avail[i] && pa < dump_avail[i + 1])
- return (1);
- }
- return (0);
-}
-
#define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8)
static int
@@ -256,7 +241,7 @@
va += NBPDP;
pa = pdp[i] & PG_PS_FRAME;
for (n = 0; n < NPDEPG * NPTEPG; n++) {
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dump_add_page(pa);
pa += PAGE_SIZE;
}
@@ -274,7 +259,7 @@
/* This is an entire 2M page. */
pa = pd[j] & PG_PS_FRAME;
for (k = 0; k < NPTEPG; k++) {
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dump_add_page(pa);
pa += PAGE_SIZE;
}
@@ -283,7 +268,7 @@
pa = pd[j] & PG_FRAME;
/* set bit for this PTE page */
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dump_add_page(pa);
/* and for each valid page in this 2MB block */
pt = (uint64_t *)PHYS_TO_DMAP(pd[j] & PG_FRAME);
@@ -291,7 +276,7 @@
if ((pt[k] & PG_V) == 0)
continue;
pa = pt[k] & PG_FRAME;
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dump_add_page(pa);
}
}
@@ -304,7 +289,7 @@
dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages));
VM_PAGE_DUMP_FOREACH(pa) {
/* Clear out undumpable pages now if needed */
- if (is_dumpable(pa)) {
+ if (vm_phys_is_dumpable(pa)) {
dumpsize += PAGE_SIZE;
} else {
dump_drop_page(pa);
diff --git a/sys/amd64/amd64/uma_machdep.c b/sys/amd64/amd64/uma_machdep.c
--- a/sys/amd64/amd64/uma_machdep.c
+++ b/sys/amd64/amd64/uma_machdep.c
@@ -34,6 +34,7 @@
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/vm_page.h>
+#include <vm/vm_phys.h>
#include <vm/vm_dumpset.h>
#include <vm/uma.h>
#include <vm/uma_int.h>
diff --git a/sys/arm/arm/minidump_machdep.c b/sys/arm/arm/minidump_machdep.c
--- a/sys/arm/arm/minidump_machdep.c
+++ b/sys/arm/arm/minidump_machdep.c
@@ -65,21 +65,6 @@
static void *dump_va;
static uint64_t counter, progress;
-static int
-is_dumpable(vm_paddr_t pa)
-{
- vm_page_t m;
- int i;
-
- if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL)
- return ((m->flags & PG_NODUMP) == 0);
- for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) {
- if (pa >= dump_avail[i] && pa < dump_avail[i + 1])
- return (1);
- }
- return (0);
-}
-
#define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8)
static int
@@ -202,7 +187,7 @@
ptesize = 0;
for (va = KERNBASE; va < kernel_vm_end; va += PAGE_SIZE) {
pa = pmap_dump_kextract(va, NULL);
- if (pa != 0 && is_dumpable(pa))
+ if (pa != 0 && vm_phys_is_dumpable(pa))
dump_add_page(pa);
ptesize += sizeof(pt2_entry_t);
}
@@ -214,7 +199,7 @@
dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages));
VM_PAGE_DUMP_FOREACH(pa) {
/* Clear out undumpable pages now if needed */
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dumpsize += PAGE_SIZE;
else
dump_drop_page(pa);
diff --git a/sys/arm64/arm64/minidump_machdep.c b/sys/arm64/arm64/minidump_machdep.c
--- a/sys/arm64/arm64/minidump_machdep.c
+++ b/sys/arm64/arm64/minidump_machdep.c
@@ -66,21 +66,6 @@
static uint64_t tmpbuffer[Ln_ENTRIES];
-static int
-is_dumpable(vm_paddr_t pa)
-{
- vm_page_t m;
- int i;
-
- if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL)
- return ((m->flags & PG_NODUMP) == 0);
- for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) {
- if (pa >= dump_avail[i] && pa < dump_avail[i + 1])
- return (1);
- }
- return (0);
-}
-
static int
blk_flush(struct dumperinfo *di)
{
@@ -226,14 +211,14 @@
pa = *l1 & ~ATTR_MASK;
for (i = 0; i < Ln_ENTRIES * Ln_ENTRIES;
i++, pa += PAGE_SIZE)
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dump_add_page(pa);
pmapsize += (Ln_ENTRIES - 1) * PAGE_SIZE;
va += L1_SIZE - L2_SIZE;
} else if ((*l2 & ATTR_DESCR_MASK) == L2_BLOCK) {
pa = *l2 & ~ATTR_MASK;
for (i = 0; i < Ln_ENTRIES; i++, pa += PAGE_SIZE) {
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dump_add_page(pa);
}
} else if ((*l2 & ATTR_DESCR_MASK) == L2_TABLE) {
@@ -241,7 +226,7 @@
if ((l3[i] & ATTR_DESCR_MASK) != L3_PAGE)
continue;
pa = l3[i] & ~ATTR_MASK;
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dump_add_page(pa);
}
}
@@ -253,7 +238,7 @@
dumpsize += round_page(sizeof(dump_avail));
dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages));
VM_PAGE_DUMP_FOREACH(pa) {
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dumpsize += PAGE_SIZE;
else
dump_drop_page(pa);
diff --git a/sys/arm64/arm64/uma_machdep.c b/sys/arm64/arm64/uma_machdep.c
--- a/sys/arm64/arm64/uma_machdep.c
+++ b/sys/arm64/arm64/uma_machdep.c
@@ -32,6 +32,7 @@
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/vm_page.h>
+#include <vm/vm_phys.h>
#include <vm/vm_dumpset.h>
#include <vm/uma.h>
#include <vm/uma_int.h>
diff --git a/sys/i386/i386/minidump_machdep_base.c b/sys/i386/i386/minidump_machdep_base.c
--- a/sys/i386/i386/minidump_machdep_base.c
+++ b/sys/i386/i386/minidump_machdep_base.c
@@ -62,21 +62,6 @@
static void *dump_va;
static uint64_t counter, progress;
-static int
-is_dumpable(vm_paddr_t pa)
-{
- vm_page_t m;
- int i;
-
- if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL)
- return ((m->flags & PG_NODUMP) == 0);
- for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) {
- if (pa >= dump_avail[i] && pa < dump_avail[i + 1])
- return (1);
- }
- return (0);
-}
-
#define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8)
static int
@@ -203,7 +188,7 @@
/* This is an entire 2M page. */
pa = pd[j] & PG_PS_FRAME;
for (k = 0; k < NPTEPG; k++) {
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dump_add_page(pa);
pa += PAGE_SIZE;
}
@@ -215,7 +200,7 @@
for (k = 0; k < NPTEPG; k++) {
if ((pt[k] & PG_V) == PG_V) {
pa = pt[k] & PG_FRAME;
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dump_add_page(pa);
}
}
@@ -231,7 +216,7 @@
dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages));
VM_PAGE_DUMP_FOREACH(pa) {
/* Clear out undumpable pages now if needed */
- if (is_dumpable(pa)) {
+ if (vm_phys_is_dumpable(pa)) {
dumpsize += PAGE_SIZE;
} else {
dump_drop_page(pa);
diff --git a/sys/mips/mips/minidump_machdep.c b/sys/mips/mips/minidump_machdep.c
--- a/sys/mips/mips/minidump_machdep.c
+++ b/sys/mips/mips/minidump_machdep.c
@@ -64,21 +64,6 @@
extern pd_entry_t *kernel_segmap;
-static int
-is_dumpable(vm_paddr_t pa)
-{
- vm_page_t m;
- int i;
-
- if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL)
- return ((m->flags & PG_NODUMP) == 0);
- for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) {
- if (pa >= dump_avail[i] && pa < dump_avail[i + 1])
- return (1);
- }
- return (0);
-}
-
static struct {
int min_per;
int max_per;
@@ -189,7 +174,7 @@
for (i = 0; i < NPTEPG; i++) {
if (pte_test(&pte[i], PTE_V)) {
pa = TLBLO_PTE_TO_PA(pte[i]);
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dump_add_page(pa);
}
}
@@ -200,7 +185,7 @@
* and pages allocated by pmap_steal reside
*/
for (pa = 0; pa < phys_avail[0]; pa += PAGE_SIZE) {
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dump_add_page(pa);
}
@@ -211,7 +196,7 @@
dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages));
VM_PAGE_DUMP_FOREACH(pa) {
/* Clear out undumpable pages now if needed */
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dumpsize += PAGE_SIZE;
else
dump_drop_page(pa);
diff --git a/sys/mips/mips/uma_machdep.c b/sys/mips/mips/uma_machdep.c
--- a/sys/mips/mips/uma_machdep.c
+++ b/sys/mips/mips/uma_machdep.c
@@ -35,6 +35,7 @@
#include <vm/vm_param.h>
#include <vm/vm_page.h>
#include <vm/vm_pageout.h>
+#include <vm/vm_phys.h>
#include <vm/vm_dumpset.h>
#include <vm/uma.h>
#include <vm/uma_int.h>
diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c
--- a/sys/powerpc/aim/mmu_oea64.c
+++ b/sys/powerpc/aim/mmu_oea64.c
@@ -3362,11 +3362,11 @@
if (va & PVO_LARGE) {
pa_end = pa + lpsize;
for (; pa < pa_end; pa += PAGE_SIZE) {
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dump_add_page(pa);
}
} else {
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dump_add_page(pa);
}
}
diff --git a/sys/powerpc/include/md_var.h b/sys/powerpc/include/md_var.h
--- a/sys/powerpc/include/md_var.h
+++ b/sys/powerpc/include/md_var.h
@@ -44,7 +44,6 @@
struct dumperinfo;
int minidumpsys(struct dumperinfo *);
-int is_dumpable(vm_paddr_t);
#endif
extern long Maxmem;
diff --git a/sys/powerpc/powerpc/minidump_machdep.c b/sys/powerpc/powerpc/minidump_machdep.c
--- a/sys/powerpc/powerpc/minidump_machdep.c
+++ b/sys/powerpc/powerpc/minidump_machdep.c
@@ -91,21 +91,6 @@
/* Handle chunked writes. */
static size_t fragsz;
-int
-is_dumpable(vm_paddr_t pa)
-{
- vm_page_t m;
- int i;
-
- if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL)
- return ((m->flags & PG_NODUMP) == 0);
- for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) {
- if (pa >= dump_avail[i] && pa < dump_avail[i + 1])
- return (1);
- }
- return (0);
-}
-
static void
pmap_kenter_temporary(vm_offset_t va, vm_paddr_t pa)
{
@@ -276,7 +261,7 @@
dumpsize += pmapsize;
VM_PAGE_DUMP_FOREACH(pa) {
/* Clear out undumpable pages now if needed */
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dumpsize += PAGE_SIZE;
else
dump_drop_page(pa);
diff --git a/sys/powerpc/powerpc/uma_machdep.c b/sys/powerpc/powerpc/uma_machdep.c
--- a/sys/powerpc/powerpc/uma_machdep.c
+++ b/sys/powerpc/powerpc/uma_machdep.c
@@ -35,6 +35,7 @@
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <vm/vm_page.h>
+#include <vm/vm_phys.h>
#include <vm/vm_dumpset.h>
#include <vm/uma.h>
#include <vm/uma_int.h>
diff --git a/sys/riscv/riscv/minidump_machdep.c b/sys/riscv/riscv/minidump_machdep.c
--- a/sys/riscv/riscv/minidump_machdep.c
+++ b/sys/riscv/riscv/minidump_machdep.c
@@ -99,22 +99,6 @@
}
}
-static bool
-is_dumpable(vm_paddr_t pa)
-{
- vm_page_t m;
- int i;
-
- if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL)
- return ((m->flags & PG_NODUMP) == 0);
-
- for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) {
- if (pa >= dump_avail[i] && pa < dump_avail[i + 1])
- return (true);
- }
- return (false);
-}
-
static int
blk_flush(struct dumperinfo *di)
{
@@ -241,7 +225,7 @@
if ((*l2 & PTE_RWX) != 0) {
pa = (*l2 >> PTE_PPN1_S) << L2_SHIFT;
for (i = 0; i < Ln_ENTRIES; i++, pa += PAGE_SIZE) {
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dump_add_page(pa);
}
} else {
@@ -249,7 +233,7 @@
if ((l3[i] & PTE_V) == 0)
continue;
pa = (l3[i] >> PTE_PPN0_S) * PAGE_SIZE;
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dump_add_page(pa);
}
}
@@ -262,7 +246,7 @@
dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages));
VM_PAGE_DUMP_FOREACH(pa) {
/* Clear out undumpable pages now if needed */
- if (is_dumpable(pa))
+ if (vm_phys_is_dumpable(pa))
dumpsize += PAGE_SIZE;
else
dump_drop_page(pa);
diff --git a/sys/riscv/riscv/uma_machdep.c b/sys/riscv/riscv/uma_machdep.c
--- a/sys/riscv/riscv/uma_machdep.c
+++ b/sys/riscv/riscv/uma_machdep.c
@@ -32,6 +32,7 @@
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/vm_page.h>
+#include <vm/vm_phys.h>
#include <vm/vm_dumpset.h>
#include <vm/uma.h>
#include <vm/uma_int.h>
diff --git a/sys/vm/vm_phys.h b/sys/vm/vm_phys.h
--- a/sys/vm/vm_phys.h
+++ b/sys/vm/vm_phys.h
@@ -87,6 +87,7 @@
void vm_phys_early_startup(void);
int vm_phys_avail_largest(void);
vm_paddr_t vm_phys_avail_size(int i);
+bool vm_phys_is_dumpable(vm_paddr_t pa);
static inline int
vm_phys_domain(vm_paddr_t pa)
diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c
--- a/sys/vm/vm_phys.c
+++ b/sys/vm/vm_phys.c
@@ -1593,6 +1593,25 @@
return (0);
}
+/*
+ * Check if a given physical address can be included as part of a crash dump.
+ */
+bool
+vm_phys_is_dumpable(vm_paddr_t pa)
+{
+ vm_page_t m;
+ int i;
+
+ if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL)
+ return ((m->flags & PG_NODUMP) == 0);
+
+ for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) {
+ if (pa >= dump_avail[i] && pa < dump_avail[i + 1])
+ return (true);
+ }
+ return (false);
+}
+
void
vm_phys_early_add_seg(vm_paddr_t start, vm_paddr_t end)
{

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 24, 5:31 PM (16 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16093813
Default Alt Text
D31884.diff (12 KB)

Event Timeline