diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -192,7 +192,7 @@ struct pmap_large_md_page { struct rwlock pv_lock; struct md_page pv_page; - /* Pad to a power of 2 */ + /* Pad to a power of 2, see pmap_init_pv_table(). */ int pv_pad[2]; }; @@ -1383,7 +1383,8 @@ panic("%s: kva_alloc failed\n", __func__); /* - * Iterate physical segments to allocate space for respective pages. + * Iterate physical segments to allocate domain-local memory for PV + * list headers. */ highest = -1; s = 0; @@ -1404,10 +1405,10 @@ highest = start + (s / sizeof(*pvd)) - 1; for (j = 0; j < s; j += PAGE_SIZE) { - vm_page_t m = vm_page_alloc_noobj_domain(domain, 0); + vm_page_t m = vm_page_alloc_noobj_domain(domain, + VM_ALLOC_ZERO); if (m == NULL) panic("failed to allocate PV table page"); - pmap_zero_page(m); pmap_qenter((vm_offset_t)pvd + j, &m, 1); } @@ -1561,7 +1562,6 @@ } pmap_init_pv_table(); - vm_initialized = 1; } diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c --- a/usr.sbin/pmcstat/pmcstat.c +++ b/usr.sbin/pmcstat/pmcstat.c @@ -119,6 +119,9 @@ struct pmcstat_args args; static bool libpmc_initialized = false; +/* Allow for a 3 digit CPU ID */ +#define PMC_CPU_WIDTH 3 + static void pmcstat_get_cpumask(const char *cpuspec, cpuset_t *cpumask) { @@ -288,8 +291,9 @@ w = ev->ev_fieldwidth - ev->ev_fieldskip - 2; if (c == 's') - (void) fprintf(args.pa_printfile, "s/%02d/%-*s ", - ev->ev_cpu, w-3, ev->ev_name); + (void) fprintf(args.pa_printfile, + "s/%0"__XSTRING(PMC_CPU_WIDTH)"d/%-*s ", + ev->ev_cpu, w - PMC_CPU_WIDTH - 1, ev->ev_name); else (void) fprintf(args.pa_printfile, "p/%*s ", w, ev->ev_name); @@ -1213,7 +1217,8 @@ display_width = (int) floor(counter_width / 3.32193) + 1; if (PMC_IS_SYSTEM_MODE(ev->ev_mode)) - header_width += 3; /* 2 digit CPU number + '/' */ + /* CPU number + '/' */ + header_width += PMC_CPU_WIDTH + 1; if (header_width > display_width) { ev->ev_fieldskip = 0;