Changeset View
Standalone View
sys/vm/vm_page.c
Show First 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | |||||
* or for paging into sparsely invalid regions. | * or for paging into sparsely invalid regions. | ||||
*/ | */ | ||||
vm_page_t bogus_page; | vm_page_t bogus_page; | ||||
vm_page_t vm_page_array; | vm_page_t vm_page_array; | ||||
long vm_page_array_size; | long vm_page_array_size; | ||||
long first_page; | long first_page; | ||||
struct bitset *vm_page_dump; | |||||
long vm_page_dump_pages; | |||||
static TAILQ_HEAD(, vm_page) blacklist_head; | static TAILQ_HEAD(, vm_page) blacklist_head; | ||||
static int sysctl_vm_page_blacklist(SYSCTL_HANDLER_ARGS); | static int sysctl_vm_page_blacklist(SYSCTL_HANDLER_ARGS); | ||||
SYSCTL_PROC(_vm, OID_AUTO, page_blacklist, CTLTYPE_STRING | CTLFLAG_RD | | SYSCTL_PROC(_vm, OID_AUTO, page_blacklist, CTLTYPE_STRING | CTLFLAG_RD | | ||||
CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_page_blacklist, "A", "Blacklist pages"); | CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_page_blacklist, "A", "Blacklist pages"); | ||||
static uma_zone_t fakepg_zone; | static uma_zone_t fakepg_zone; | ||||
static void vm_page_alloc_check(vm_page_t m); | static void vm_page_alloc_check(vm_page_t m); | ||||
▲ Show 20 Lines • Show All 382 Lines • ▼ Show 20 Lines | |||||
vm_page_startup(vm_offset_t vaddr) | vm_page_startup(vm_offset_t vaddr) | ||||
{ | { | ||||
struct vm_phys_seg *seg; | struct vm_phys_seg *seg; | ||||
vm_page_t m; | vm_page_t m; | ||||
char *list, *listend; | char *list, *listend; | ||||
vm_paddr_t end, high_avail, low_avail, new_end, size; | vm_paddr_t end, high_avail, low_avail, new_end, size; | ||||
vm_paddr_t page_range __unused; | vm_paddr_t page_range __unused; | ||||
vm_paddr_t last_pa, pa; | vm_paddr_t last_pa, pa; | ||||
u_long pagecount; | u_long pagecount, vm_page_dump_size; | ||||
int biggestone, i, segind; | int biggestone, i, segind; | ||||
#ifdef WITNESS | #ifdef WITNESS | ||||
vm_offset_t mapped; | vm_offset_t mapped; | ||||
int witness_size; | int witness_size; | ||||
#endif | #endif | ||||
#if defined(__i386__) && defined(VM_PHYSSEG_DENSE) | #if defined(__i386__) && defined(VM_PHYSSEG_DENSE) | ||||
long ii; | long ii; | ||||
#endif | #endif | ||||
Show All 18 Lines | #ifdef WITNESS | ||||
witness_size = round_page(witness_startup_count()); | witness_size = round_page(witness_startup_count()); | ||||
new_end -= witness_size; | new_end -= witness_size; | ||||
mapped = pmap_map(&vaddr, new_end, new_end + witness_size, | mapped = pmap_map(&vaddr, new_end, new_end + witness_size, | ||||
VM_PROT_READ | VM_PROT_WRITE); | VM_PROT_READ | VM_PROT_WRITE); | ||||
bzero((void *)mapped, witness_size); | bzero((void *)mapped, witness_size); | ||||
witness_startup((void *)mapped); | witness_startup((void *)mapped); | ||||
#endif | #endif | ||||
#if defined(__aarch64__) || defined(__amd64__) || defined(__arm__) || \ | |||||
defined(__i386__) || defined(__mips__) || defined(__riscv) || \ | |||||
defined(__powerpc64__) | |||||
kib: So this was not done on 32 bit power before. Would it ever link ? | |||||
markjUnsubmitted Done Inline ActionsIIRC 32-bit powerpc does not implement minidumps, so we should not drop the ifdef. To get rid of the ugly ifdefs I would add a vmparam.h constant for each platform to define whether the vm_page_dump array should be allocated. markj: IIRC 32-bit powerpc does not implement minidumps, so we should not drop the ifdef. To get rid… | |||||
scottphAuthorUnsubmitted Done Inline Actionsah right, it was totally busted. I'm now introducing VM_PAGE_DUMP_ALLOC in vmparam.h to control this. scottph: ah right, it was totally busted. I'm now introducing VM_PAGE_DUMP_ALLOC in vmparam.h to control… | |||||
/* | /* | ||||
* Allocate a bitmap to indicate that a random physical page | * Allocate a bitmap to indicate that a random physical page | ||||
* needs to be included in a minidump. | * needs to be included in a minidump. | ||||
* | * | ||||
* The amd64 port needs this to indicate which direct map pages | * The amd64 port needs this to indicate which direct map pages | ||||
* need to be dumped, via calls to dump_add_page()/dump_drop_page(). | * need to be dumped, via calls to dump_add_page()/dump_drop_page(). | ||||
* | * | ||||
* However, i386 still needs this workspace internally within the | * However, i386 still needs this workspace internally within the | ||||
* minidump code. In theory, they are not needed on i386, but are | * minidump code. In theory, they are not needed on i386, but are | ||||
* included should the sf_buf code decide to use them. | * included should the sf_buf code decide to use them. | ||||
*/ | */ | ||||
last_pa = 0; | last_pa = 0; | ||||
for (i = 0; dump_avail[i + 1] != 0; i += 2) | for (i = 0; dump_avail[i + 1] != 0; i += 2) | ||||
if (dump_avail[i + 1] > last_pa) | if (dump_avail[i + 1] > last_pa) | ||||
last_pa = dump_avail[i + 1]; | last_pa = dump_avail[i + 1]; | ||||
page_range = last_pa / PAGE_SIZE; | vm_page_dump_pages = last_pa / PAGE_SIZE; | ||||
vm_page_dump_size = round_page(roundup2(page_range, NBBY) / NBBY); | vm_page_dump_size = round_page(BITSET_SIZE(vm_page_dump_pages)); | ||||
new_end -= vm_page_dump_size; | new_end -= vm_page_dump_size; | ||||
vm_page_dump = (void *)(uintptr_t)pmap_map(&vaddr, new_end, | vm_page_dump = (void *)(uintptr_t)pmap_map(&vaddr, new_end, | ||||
new_end + vm_page_dump_size, VM_PROT_READ | VM_PROT_WRITE); | new_end + vm_page_dump_size, VM_PROT_READ | VM_PROT_WRITE); | ||||
bzero((void *)vm_page_dump, vm_page_dump_size); | bzero((void *)vm_page_dump, vm_page_dump_size); | ||||
#else | |||||
(void)last_pa; | |||||
#endif | |||||
#if defined(__aarch64__) || defined(__amd64__) || defined(__mips__) || \ | #if defined(__aarch64__) || defined(__amd64__) || defined(__mips__) || \ | ||||
Done Inline ActionsThe comment below make it seem like this next conditional could be replaced with: if (PMAP_HAS_DMAP), but that would change the behavior on 32 bit mips. Maybe it would still be correct? scottph: The comment below make it seem like this next conditional could be replaced with: if… | |||||
Done Inline Actions32bit mips has something that can be considered as DMAP AFAIR. More, that mapping does not even require TLB fills. I have no idea why it is not provided as DMAP, but I do not know mips pmap to claim anything. kib: 32bit mips has something that can be considered as DMAP AFAIR. More, that mapping does not… | |||||
Done Inline ActionsI suppose I'll just leave it alone for the time being. scottph: I suppose I'll just leave it alone for the time being. | |||||
defined(__riscv) || defined(__powerpc64__) | defined(__riscv) || defined(__powerpc64__) | ||||
/* | /* | ||||
* Include the UMA bootstrap pages, witness pages and vm_page_dump | * Include the UMA bootstrap pages, witness pages and vm_page_dump | ||||
* in a crash dump. When pmap_map() uses the direct map, they are | * in a crash dump. When pmap_map() uses the direct map, they are | ||||
* not automatically included. | * not automatically included. | ||||
*/ | */ | ||||
for (pa = new_end; pa < end; pa += PAGE_SIZE) | for (pa = new_end; pa < end; pa += PAGE_SIZE) | ||||
dump_add_page(pa); | dump_add_page(pa); | ||||
▲ Show 20 Lines • Show All 4,863 Lines • Show Last 20 Lines |
So this was not done on 32 bit power before. Would it ever link ?