Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/arm/minidump_machdep.c
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | |||||
CTASSERT(sizeof(struct kerneldumpheader) == 512); | CTASSERT(sizeof(struct kerneldumpheader) == 512); | ||||
static struct kerneldumpheader kdh; | static struct kerneldumpheader kdh; | ||||
/* Handle chunked writes. */ | /* Handle chunked writes. */ | ||||
static size_t fragsz; | static size_t fragsz; | ||||
static void *dump_va; | static void *dump_va; | ||||
static uint64_t counter, progress; | |||||
#define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8) | |||||
static int | static int | ||||
blk_flush(struct dumperinfo *di) | blk_flush(struct dumperinfo *di) | ||||
{ | { | ||||
int error; | int error; | ||||
if (fragsz == 0) | if (fragsz == 0) | ||||
return (0); | return (0); | ||||
Show All 32 Lines | if (ptr != NULL) { | ||||
error = blk_flush(di); | error = blk_flush(di); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
} | } | ||||
while (sz) { | while (sz) { | ||||
len = maxdumpsz - fragsz; | len = maxdumpsz - fragsz; | ||||
if (len > sz) | if (len > sz) | ||||
len = sz; | len = sz; | ||||
counter += len; | |||||
progress -= len; | |||||
if (counter >> 22) { | |||||
printf(" %lld", PG2MB(progress >> PAGE_SHIFT)); | |||||
counter &= (1<<22) - 1; | |||||
} | |||||
dumpsys_pb_progress(len); | |||||
#ifdef SW_WATCHDOG | #ifdef SW_WATCHDOG | ||||
wdog_kern_pat(WD_LASTVAL); | wdog_kern_pat(WD_LASTVAL); | ||||
#endif | #endif | ||||
if (ptr) { | if (ptr) { | ||||
error = dump_append(di, ptr, 0, len); | error = dump_append(di, ptr, 0, len); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
ptr += len; | ptr += len; | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | minidumpsys(struct dumperinfo *di) | ||||
* the system shutdown or kernel debugger has called stop_cpus() to stop | * the system shutdown or kernel debugger has called stop_cpus() to stop | ||||
* all cores other than this one. Part of the ARM handling of | * all cores other than this one. Part of the ARM handling of | ||||
* stop_cpus() is to call wbinv_all() on that core's local L1 cache. So | * stop_cpus() is to call wbinv_all() on that core's local L1 cache. So | ||||
* by time we get to here, all that remains is to flush the L1 for the | * by time we get to here, all that remains is to flush the L1 for the | ||||
* current CPU, then the L2. | * current CPU, then the L2. | ||||
*/ | */ | ||||
dcache_wbinv_poc_all(); | dcache_wbinv_poc_all(); | ||||
counter = 0; | |||||
/* Walk page table pages, set bits in vm_page_dump */ | /* Walk page table pages, set bits in vm_page_dump */ | ||||
ptesize = 0; | ptesize = 0; | ||||
for (va = KERNBASE; va < kernel_vm_end; va += PAGE_SIZE) { | for (va = KERNBASE; va < kernel_vm_end; va += PAGE_SIZE) { | ||||
pa = pmap_dump_kextract(va, NULL); | pa = pmap_dump_kextract(va, NULL); | ||||
if (pa != 0 && vm_phys_is_dumpable(pa)) | if (pa != 0 && vm_phys_is_dumpable(pa)) | ||||
dump_add_page(pa); | dump_add_page(pa); | ||||
ptesize += sizeof(pt2_entry_t); | ptesize += sizeof(pt2_entry_t); | ||||
} | } | ||||
/* Calculate dump size. */ | /* Calculate dump size. */ | ||||
dumpsize = ptesize; | dumpsize = ptesize; | ||||
dumpsize += round_page(msgbufp->msg_size); | dumpsize += round_page(msgbufp->msg_size); | ||||
dumpsize += round_page(nitems(dump_avail) * sizeof(uint64_t)); | dumpsize += round_page(nitems(dump_avail) * sizeof(uint64_t)); | ||||
dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); | dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); | ||||
VM_PAGE_DUMP_FOREACH(pa) { | VM_PAGE_DUMP_FOREACH(pa) { | ||||
/* Clear out undumpable pages now if needed */ | /* Clear out undumpable pages now if needed */ | ||||
if (vm_phys_is_dumpable(pa)) | if (vm_phys_is_dumpable(pa)) | ||||
dumpsize += PAGE_SIZE; | dumpsize += PAGE_SIZE; | ||||
else | else | ||||
dump_drop_page(pa); | dump_drop_page(pa); | ||||
} | } | ||||
dumpsize += PAGE_SIZE; | dumpsize += PAGE_SIZE; | ||||
progress = dumpsize; | dumpsys_pb_init(dumpsize); | ||||
/* Initialize mdhdr */ | /* Initialize mdhdr */ | ||||
bzero(&mdhdr, sizeof(mdhdr)); | bzero(&mdhdr, sizeof(mdhdr)); | ||||
strcpy(mdhdr.magic, MINIDUMP_MAGIC); | strcpy(mdhdr.magic, MINIDUMP_MAGIC); | ||||
mdhdr.version = MINIDUMP_VERSION; | mdhdr.version = MINIDUMP_VERSION; | ||||
mdhdr.msgbufsize = msgbufp->msg_size; | mdhdr.msgbufsize = msgbufp->msg_size; | ||||
mdhdr.bitmapsize = round_page(BITSET_SIZE(vm_page_dump_pages)); | mdhdr.bitmapsize = round_page(BITSET_SIZE(vm_page_dump_pages)); | ||||
mdhdr.ptesize = ptesize; | mdhdr.ptesize = ptesize; | ||||
▲ Show 20 Lines • Show All 115 Lines • Show Last 20 Lines |