-/* $OpenBSD: pmap.c,v 1.146 2021/09/05 11:44:46 mpi Exp $ */
+/* $OpenBSD: pmap.c,v 1.147 2021/09/06 12:59:59 mpi Exp $ */
/* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */
/*
*/
struct pmap_head pmaps;
+struct mutex pmaps_lock = MUTEX_INITIALIZER(IPL_VM);
/*
* pool that pmap structures are allocated from
pmap->pm_pdirpa_intel = 0;
}
+ mtx_enter(&pmaps_lock);
LIST_INSERT_HEAD(&pmaps, pmap, pm_list);
+ mtx_leave(&pmaps_lock);
return (pmap);
}
/*
* remove it from global list of pmaps
*/
+ mtx_enter(&pmaps_lock);
LIST_REMOVE(pmap, pm_list);
+ mtx_leave(&pmaps_lock);
/*
* free any remaining PTPs
*/
if (needed_kptp[PTP_LEVELS - 1] != 0) {
newpdes = nkptp[PTP_LEVELS - 1] - old;
+ mtx_enter(&pmaps_lock);
LIST_FOREACH(pm, &pmaps, pm_list) {
memcpy(&pm->pm_pdir[PDIR_SLOT_KERN + old],
&kpm->pm_pdir[PDIR_SLOT_KERN + old],
newpdes * sizeof (pd_entry_t));
}
+ mtx_leave(&pmaps_lock);
}
pmap_maxkvaddr = maxkvaddr;
splx(s);
-/* $OpenBSD: pmap.c,v 1.215 2021/09/05 11:44:46 mpi Exp $ */
+/* $OpenBSD: pmap.c,v 1.216 2021/09/06 12:59:59 mpi Exp $ */
/* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */
/*
*/
struct pmap_head pmaps;
+struct mutex pmaps_lock = MUTEX_INITIALIZER(IPL_VM);
/*
* pool that pmap structures are allocated from
pmap->pm_pdirpa_intel = 0;
}
+ mtx_enter(&pmaps_lock);
LIST_INSERT_HEAD(&pmaps, pmap, pm_list);
+ mtx_leave(&pmaps_lock);
}
/*
pmap_tlb_droppmap(pmap);
#endif
+ mtx_enter(&pmaps_lock);
LIST_REMOVE(pmap, pm_list);
+ mtx_leave(&pmaps_lock);
/* Free any remaining PTPs. */
while ((pg = RBT_ROOT(uvm_objtree, &pmap->pm_obj.memt)) != NULL) {
uvm_wait("pmap_growkernel");
/* distribute new kernel PTP to all active pmaps */
+ mtx_enter(&pmaps_lock);
LIST_FOREACH(pm, &pmaps, pm_list) {
PDE(pm, PDSLOT_KERN + nkpde) =
PDE(kpm, PDSLOT_KERN + nkpde);
}
+ mtx_leave(&pmaps_lock);
}
splx(s);
-/* $OpenBSD: pmapae.c,v 1.63 2021/05/16 15:10:19 deraadt Exp $ */
+/* $OpenBSD: pmapae.c,v 1.64 2021/09/06 12:59:59 mpi Exp $ */
/*
* Copyright (c) 2006-2008 Michael Shalayeff
extern int pmap_pg_g;
extern int pmap_pg_wc;
extern struct pmap_head pmaps;
+extern struct mutex pmaps_lock;
extern uint32_t cpu_meltdown;
pmap->pm_pdirpa_intel = 0;
}
+ mtx_enter(&pmaps_lock);
LIST_INSERT_HEAD(&pmaps, pmap, pm_list);
+ mtx_leave(&pmaps_lock);
}
/*
uvm_wait("pmap_growkernel");
/* distribute new kernel PTP to all active pmaps */
+ mtx_enter(&pmaps_lock);
LIST_FOREACH(pm, &pmaps, pm_list) {
PDE(pm, PDSLOT_KERN + nkpde) =
PDE(kpm, PDSLOT_KERN + nkpde);
}
+ mtx_leave(&pmaps_lock);
}
splx(s);