Index: kern/subr_smp.c =================================================================== --- kern/subr_smp.c (revision 183527) +++ kern/subr_smp.c (working copy) @@ -285,7 +285,12 @@ CTR1(KTR_SMP, "restart_cpus(%x)", map); /* signal other cpus to restart */ +#if defined(__amd64__) + /* cpumask_t is 64 bit on amd64. */ + atomic_store_rel_long(&started_cpus, map); +#else atomic_store_rel_int(&started_cpus, map); +#endif /* wait for each to clear its bit */ while ((stopped_cpus & map) != 0) @@ -455,8 +460,8 @@ panic("Built bad topology at %p. CPU count %d != %d", top, top->cg_count, mp_ncpus); if (top->cg_mask != all_cpus) - panic("Built bad topology at %p. CPU mask 0x%X != 0x%X", - top, top->cg_mask, all_cpus); + panic("Built bad topology at %p. CPU mask 0x%lX != 0x%lX", + top, (unsigned long)top->cg_mask, (unsigned long)all_cpus); return (top); } @@ -496,8 +501,8 @@ parent->cg_children++; for (; parent != NULL; parent = parent->cg_parent) { if ((parent->cg_mask & child->cg_mask) != 0) - panic("Duplicate children in %p. mask 0x%X child 0x%X", - parent, parent->cg_mask, child->cg_mask); + panic("Duplicate children in %p. mask 0x%lX child 0x%lX", + parent, (unsigned long)parent->cg_mask, (unsigned long)child->cg_mask); parent->cg_mask |= child->cg_mask; parent->cg_count += child->cg_count; } Index: amd64/include/smp.h =================================================================== --- amd64/include/smp.h (revision 183527) +++ amd64/include/smp.h (working copy) @@ -61,12 +61,12 @@ int mp_grab_cpu_hlt(void); void smp_cache_flush(void); void smp_invlpg(vm_offset_t addr); -void smp_masked_invlpg(u_int mask, vm_offset_t addr); +void smp_masked_invlpg(cpumask_t mask, vm_offset_t addr); void smp_invlpg_range(vm_offset_t startva, vm_offset_t endva); -void smp_masked_invlpg_range(u_int mask, vm_offset_t startva, +void smp_masked_invlpg_range(cpumask_t mask, vm_offset_t startva, vm_offset_t endva); void smp_invltlb(void); -void smp_masked_invltlb(u_int mask); +void smp_masked_invltlb(cpumask_t mask); #ifdef STOP_NMI int ipi_nmi_handler(void); Index: amd64/include/_types.h =================================================================== --- amd64/include/_types.h (revision 183527) +++ amd64/include/_types.h (working copy) @@ -61,7 +61,7 @@ * Standard type definitions. */ typedef __int32_t __clock_t; /* clock()... */ -typedef unsigned int __cpumask_t; +typedef unsigned long __cpumask_t; typedef __int64_t __critical_t; typedef double __double_t; typedef float __float_t; Index: amd64/include/pmap.h =================================================================== --- amd64/include/pmap.h (revision 183527) +++ amd64/include/pmap.h (working copy) @@ -247,8 +247,7 @@ struct mtx pm_mtx; pml4_entry_t *pm_pml4; /* KVA of level 4 page table */ TAILQ_HEAD(,pv_chunk) pm_pvchunk; /* list of mappings in pmap */ - u_int pm_active; /* active on cpus */ - /* spare u_int here due to padding */ + cpumask_t pm_active; /* active on cpus */ struct pmap_statistics pm_stats; /* pmap statistics */ vm_page_t pm_root; /* spare page table pages */ }; Index: amd64/amd64/vm_machdep.c =================================================================== --- amd64/amd64/vm_machdep.c (revision 183527) +++ amd64/amd64/vm_machdep.c (working copy) @@ -411,7 +411,8 @@ cpu_reset() { #ifdef SMP - u_int cnt, map; + u_int cnt; + cpumask_t map; if (smp_active) { map = PCPU_GET(other_cpus) & ~stopped_cpus; @@ -427,7 +428,7 @@ printf("cpu_reset: Restarting BSP\n"); /* Restart CPU #0. */ - atomic_store_rel_int(&started_cpus, 1 << 0); + atomic_store_rel_long(&started_cpus, 1 << 0); cnt = 0; while (cpu_reset_proxy_active == 0 && cnt < 10000000) Index: amd64/amd64/pmap.c =================================================================== --- amd64/amd64/pmap.c (revision 183527) +++ amd64/amd64/pmap.c (working copy) @@ -858,8 +858,7 @@ void pmap_invalidate_page(pmap_t pmap, vm_offset_t va) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; sched_pin(); if (pmap == kernel_pmap || pmap->pm_active == all_cpus) { @@ -879,8 +878,7 @@ void pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; vm_offset_t addr; sched_pin(); @@ -904,8 +902,7 @@ void pmap_invalidate_all(pmap_t pmap) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; sched_pin(); if (pmap == kernel_pmap || pmap->pm_active == all_cpus) { @@ -4739,8 +4736,8 @@ oldpmap = PCPU_GET(curpmap); #ifdef SMP if (oldpmap) /* XXX FIXME */ - atomic_clear_int(&oldpmap->pm_active, PCPU_GET(cpumask)); - atomic_set_int(&pmap->pm_active, PCPU_GET(cpumask)); + atomic_clear_long(&oldpmap->pm_active, PCPU_GET(cpumask)); + atomic_set_long(&pmap->pm_active, PCPU_GET(cpumask)); #else if (oldpmap) /* XXX FIXME */ oldpmap->pm_active &= ~PCPU_GET(cpumask); Index: amd64/amd64/mp_machdep.c =================================================================== --- amd64/amd64/mp_machdep.c (revision 183527) +++ amd64/amd64/mp_machdep.c (working copy) @@ -853,12 +853,12 @@ } static void -smp_targeted_tlb_shootdown(u_int mask, u_int vector, vm_offset_t addr1, vm_offset_t addr2) +smp_targeted_tlb_shootdown(cpumask_t mask, u_int vector, vm_offset_t addr1, vm_offset_t addr2) { int ncpu, othercpus; othercpus = mp_ncpus - 1; - if (mask == (u_int)-1) { + if (mask == (cpumask_t)-1) { ncpu = othercpus; if (ncpu < 1) return; @@ -883,7 +883,7 @@ smp_tlb_addr1 = addr1; smp_tlb_addr2 = addr2; atomic_store_rel_int(&smp_tlb_wait, 0); - if (mask == (u_int)-1) + if (mask == (cpumask_t)-1) ipi_all_but_self(vector); else ipi_selected(mask, vector); @@ -927,7 +927,7 @@ } void -smp_masked_invltlb(u_int mask) +smp_masked_invltlb(cpumask_t mask) { if (smp_started) { @@ -936,7 +936,7 @@ } void -smp_masked_invlpg(u_int mask, vm_offset_t addr) +smp_masked_invlpg(cpumask_t mask, vm_offset_t addr) { if (smp_started) { @@ -945,7 +945,7 @@ } void -smp_masked_invlpg_range(u_int mask, vm_offset_t addr1, vm_offset_t addr2) +smp_masked_invlpg_range(cpumask_t mask, vm_offset_t addr1, vm_offset_t addr2) { if (smp_started) { @@ -1045,7 +1045,7 @@ CTR2(KTR_SMP, "%s: cpus: %x nmi", __func__, cpus); - atomic_set_int(&ipi_nmi_pending, cpus); + atomic_set_long(&ipi_nmi_pending, cpus); while ((cpu = ffs(cpus)) != 0) { cpu--; @@ -1065,12 +1065,12 @@ int ipi_nmi_handler(void) { - int cpumask = PCPU_GET(cpumask); + cpumask_t cpumask = PCPU_GET(cpumask); if (!(ipi_nmi_pending & cpumask)) return 1; - atomic_clear_int(&ipi_nmi_pending, cpumask); + atomic_clear_long(&ipi_nmi_pending, cpumask); cpustop_handler(); return 0; } @@ -1085,19 +1085,19 @@ cpustop_handler(void) { int cpu = PCPU_GET(cpuid); - int cpumask = PCPU_GET(cpumask); + cpumask_t cpumask = PCPU_GET(cpumask); savectx(&stoppcbs[cpu]); /* Indicate that we are stopped */ - atomic_set_int(&stopped_cpus, cpumask); + atomic_set_long(&stopped_cpus, cpumask); /* Wait for restart */ while (!(started_cpus & cpumask)) ia32_pause(); - atomic_clear_int(&started_cpus, cpumask); - atomic_clear_int(&stopped_cpus, cpumask); + atomic_clear_long(&started_cpus, cpumask); + atomic_clear_long(&stopped_cpus, cpumask); if (cpu == 0 && cpustop_restartfunc != NULL) { cpustop_restartfunc(); @@ -1245,7 +1245,7 @@ int mp_grab_cpu_hlt(void) { - u_int mask = PCPU_GET(cpumask); + cpumask_t mask = PCPU_GET(cpumask); #ifdef MP_WATCHDOG u_int cpuid = PCPU_GET(cpuid); #endif