Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/x86 Split the map/unmap code from the sync/flus...



details:   https://anonhg.NetBSD.org/src/rev/73af981c7943
branches:  trunk
changeset: 777983:73af981c7943
user:      jym <jym%NetBSD.org@localhost>
date:      Sun Mar 11 17:14:30 2012 +0000

description:
Split the map/unmap code from the sync/flush code: move xpq_flush_queue()
calls after pmap_{,un}map_recursive_entries() so that pmap's handlers
handle the flush themselves.

Now pmap_{,un}map_recursive_entries() do what their names imply, nothing more.

Fix pmap_xen_suspend()'s comment: APDPs are now gone.

pmap's handlers are called deep during kernel save/restore. We already
are at IPL_VM + kpreemption disabled. No need to wrap the xpq_flush_queue()
with splvm/splx.

diffstat:

 sys/arch/xen/x86/xen_pmap.c |  31 ++++++++++++++-----------------
 1 files changed, 14 insertions(+), 17 deletions(-)

diffs (85 lines):

diff -r 5e9a2a946078 -r 73af981c7943 sys/arch/xen/x86/xen_pmap.c
--- a/sys/arch/xen/x86/xen_pmap.c       Sun Mar 11 16:28:02 2012 +0000
+++ b/sys/arch/xen/x86/xen_pmap.c       Sun Mar 11 17:14:30 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xen_pmap.c,v 1.19 2012/03/02 16:38:14 bouyer Exp $     */
+/*     $NetBSD: xen_pmap.c,v 1.20 2012/03/11 17:14:30 jym Exp $        */
 
 /*
  * Copyright (c) 2007 Manuel Bouyer.
@@ -102,7 +102,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_pmap.c,v 1.19 2012/03/02 16:38:14 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_pmap.c,v 1.20 2012/03/11 17:14:30 jym Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -236,22 +236,16 @@
 }
 
 /*
- * Flush all APDP entries found in pmaps
- * Required during Xen save/restore operations, as Xen does not
- * handle alternative recursive mappings properly
+ * Xen pmap's handlers for save/restore
  */
 void
 pmap_xen_suspend(void)
 {
-       int s;
-
-       s = splvm();
-       xpq_flush_queue();
-       splx(s);
-
 #ifdef PAE
        pmap_unmap_recursive_entries();
 #endif
+
+       xpq_flush_queue();
 }
 
 void
@@ -260,6 +254,8 @@
 #ifdef PAE
        pmap_map_recursive_entries();
 #endif
+
+       xpq_flush_queue();
 }
 
 #ifdef PAE
@@ -294,10 +290,13 @@
                    xpmap_ptom(pmap_pdirpa(pmap_kernel(), PDIR_SLOT_PTE + i)),
                    xpmap_ptom(pmap_kernel()->pm_pdirpa[i]) | PG_V);
        }
-
-       xpq_flush_queue();
 }
 
+/*
+ * Unmap recursive entries found in pmaps. Required during Xen
+ * save/restore operations, as Xen does not handle recursive mappings
+ * properly.
+ */
 void
 pmap_unmap_recursive_entries(void)
 {
@@ -322,13 +321,11 @@
        mutex_exit(&pmaps_lock);
 
        /* do it for pmap_kernel() too! */
-       for (i = 0; i < PDP_SIZE; i++)
+       for (i = 0; i < PDP_SIZE; i++) {
                xpq_queue_pte_update(
                    xpmap_ptom(pmap_pdirpa(pmap_kernel(), PDIR_SLOT_PTE + i)),
                    0);
-
-       xpq_flush_queue();
-
+       }
 }
 #endif /* PAE */
 



Home | Main Index | Thread Index | Old Index