Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 On xen, prevent cached PDP objects from bei...
details: https://anonhg.NetBSD.org/src/rev/4541eed9152c
branches: trunk
changeset: 773270:4541eed9152c
user: cherry <cherry%NetBSD.org@localhost>
date: Mon Jan 30 10:33:05 2012 +0000
description:
On xen, prevent cached PDP objects from being reused by pool_cache(9),
since they are "pinned" on the hypervisor and thus R/O for the domU.
Separately, after every per-cpu pmap pdir entry reset, make sure that
the corresponding L3 PTP pointers are flushed from all cpus with the
pmap loaded. Enforce this immediately via pmap_tlb_shootnow();
diffstat:
sys/arch/x86/x86/pmap.c | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diffs (60 lines):
diff -r 8bf466e0c516 -r 4541eed9152c sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c Mon Jan 30 09:48:11 2012 +0000
+++ b/sys/arch/x86/x86/pmap.c Mon Jan 30 10:33:05 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.160 2012/01/29 11:45:37 drochner Exp $ */
+/* $NetBSD: pmap.c,v 1.161 2012/01/30 10:33:05 cherry Exp $ */
/*-
* Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.160 2012/01/29 11:45:37 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.161 2012/01/30 10:33:05 cherry Exp $");
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
@@ -1614,7 +1614,7 @@
void
pmap_init(void)
{
- int i;
+ int i, flags;
for (i = 0; i < PV_HASH_SIZE; i++) {
SLIST_INIT(&pv_hash_heads[i].hh_list);
@@ -1629,12 +1629,22 @@
pool_cache_bootstrap(&pmap_cache, sizeof(struct pmap), 0, 0, 0,
"pmappl", NULL, IPL_NONE, NULL, NULL, NULL);
+
+#ifdef XEN
+ /*
+ * pool_cache(9) should not touch cached objects, since they
+ * are pinned on xen and R/O for the domU
+ */
+ flags = PR_NOTOUCH;
+#else /* XEN */
+ flags = 0;
+#endif /* XEN */
#ifdef PAE
- pool_cache_bootstrap(&pmap_pdp_cache, PAGE_SIZE * PDP_SIZE, 0, 0, 0,
+ pool_cache_bootstrap(&pmap_pdp_cache, PAGE_SIZE * PDP_SIZE, 0, 0, flags,
"pdppl", &pmap_pdp_allocator, IPL_NONE,
pmap_pdp_ctor, pmap_pdp_dtor, NULL);
#else /* PAE */
- pool_cache_bootstrap(&pmap_pdp_cache, PAGE_SIZE, 0, 0, 0,
+ pool_cache_bootstrap(&pmap_pdp_cache, PAGE_SIZE, 0, 0, flags,
"pdppl", NULL, IPL_NONE, pmap_pdp_ctor, pmap_pdp_dtor, NULL);
#endif /* PAE */
pool_cache_bootstrap(&pmap_pv_cache, sizeof(struct pv_entry), 0, 0,
@@ -1897,6 +1907,7 @@
(vaddr_t)pdes[level - 2];
pmap_tlb_shootdown(pmap, invaladdr + index * PAGE_SIZE,
opde, TLBSHOOT_FREE_PTP1);
+ pmap_tlb_shootnow();
#else /* XEN */
invaladdr = level == 1 ? (vaddr_t)ptes :
(vaddr_t)pdes[level - 2];
Home |
Main Index |
Thread Index |
Old Index