summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2010-09-06 17:36:50 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2010-09-06 17:36:50 +0000
commit9a6052c92f82f7e67d5eaf76b114d786abbbe3be (patch)
tree2a283c34446ea0edc4b3312a01c5903680816291 /sys
parent22f4d14f677ab492dfa5dd810adc92ce0415b7af (diff)
Stop sending so many superfluous IPIs: zero out pm_cpus in pmap_create(),
don't set the current cpu's bit in pmap_activate() unless we actually set %cr3, and add a DIAGNOSTIC printf to pmap_destroy() to catch if we ever stop tracking them accurately again. Also, GC the unused pm_flags member. ok deraadt@, oga@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/pmap.c23
-rw-r--r--sys/arch/amd64/include/pmap.h4
2 files changed, 16 insertions, 11 deletions
diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c
index 4c262196d89..fd1ea34055d 100644
--- a/sys/arch/amd64/amd64/pmap.c
+++ b/sys/arch/amd64/amd64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.55 2010/05/13 19:27:24 oga Exp $ */
+/* $OpenBSD: pmap.c,v 1.56 2010/09/06 17:36:49 guenther Exp $ */
/* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */
/*
@@ -1020,7 +1020,7 @@ pmap_create(void)
}
pmap->pm_stats.wired_count = 0;
pmap->pm_stats.resident_count = 1; /* count the PDP allocd below */
- pmap->pm_flags = 0;
+ pmap->pm_cpus = 0;
/* init the LDT */
pmap->pm_ldt = NULL;
@@ -1075,6 +1075,12 @@ pmap_destroy(struct pmap *pmap)
* reference count is zero, free pmap resources and then free pmap.
*/
+#ifdef DIAGNOSTIC
+ if (pmap->pm_cpus != 0)
+ printf("pmap_destroy: pmap %p cpus=0x%lx\n",
+ (void *)pmap, pmap->pm_cpus);
+#endif
+
/*
* remove it from global list of pmaps
*/
@@ -1129,15 +1135,16 @@ pmap_activate(struct proc *p)
pcb->pcb_pmap = pmap;
pcb->pcb_ldt_sel = pmap->pm_ldt_sel;
pcb->pcb_cr3 = pmap->pm_pdirpa;
- if (p == curproc)
+ if (p == curproc) {
lcr3(pcb->pcb_cr3);
+
+ /*
+ * mark the pmap in use by this processor.
+ */
+ x86_atomic_setbits_ul(&pmap->pm_cpus, (1U << cpu_number()));
+ }
if (pcb == curpcb)
lldt(pcb->pcb_ldt_sel);
-
- /*
- * mark the pmap in use by this processor.
- */
- x86_atomic_setbits_ul(&pmap->pm_cpus, (1U << cpu_number()));
}
/*
diff --git a/sys/arch/amd64/include/pmap.h b/sys/arch/amd64/include/pmap.h
index 04929cb9072..ece79862e79 100644
--- a/sys/arch/amd64/include/pmap.h
+++ b/sys/arch/amd64/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.33 2010/05/13 19:27:24 oga Exp $ */
+/* $OpenBSD: pmap.h,v 1.34 2010/09/06 17:36:49 guenther Exp $ */
/* $NetBSD: pmap.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $ */
/*
@@ -318,8 +318,6 @@ struct pmap {
/* pointer to a PTP in our pmap */
struct pmap_statistics pm_stats; /* pmap stats (lck by object lock) */
- int pm_flags; /* see below */
-
union descriptor *pm_ldt; /* user-set LDT */
int pm_ldt_len; /* number of LDT entries */
int pm_ldt_sel; /* LDT selector */