Source-Changes-D archive

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

Re: CVS commit: src/sys/arch



>>>>> "Paul" == Paul Goyette <paul%whooppee.com@localhost> writes:

    >> Module Name: src Committed By: cherry Date: Tue May 6 04:26:24
    >> UTC 2014
    >> 
    >> Modified Files: src/sys/arch/x86/x86: pmap.c
    >> src/sys/arch/xen/include: xenpmap.h src/sys/arch/xen/x86:
    >> x86_xpmap.c
    >> 
    >> Log Message: Use the hypervisor to copy/zero pages. This saves us
    >> the extra overheads of setting up temporary kernel
    >> mapping/unmapping.
    >> 
    >> riz@ reports savings of about 2s on a 120s kernel build.

    Paul> This commit seems to have broken the ability to boot NetBSD
    Paul> under at least some hypervisors.  My VPS at prgmr.com boots
    Paul> fine with a kernel from just before this change.  However,
    Paul> with this commit, the following panic occurs:

Sorry, the first patch was incorrect ( it skips over some newer legit
versions! ) - thanks abs@.

Thanks to Gary Duzan for the initial suggestion and abs@ for catching
the error in my first patch.

-- 
Cherry

diff -r f0203e3974e7 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Sat May 31 20:20:36 2014 +0900
+++ b/sys/arch/x86/x86/pmap.c   Thu Jun 12 15:46:00 2014 +0900
@@ -211,6 +211,15 @@
 #ifdef XEN
 #include <xen/xen-public/xen.h>
 #include <xen/hypervisor.h>
+
+/* 
+ * Does the hypervisor we're running on support an api
+ * call at the requested version number ?
+ */
+#define XEN_VERSION_SUPPORTED(major, minor)            \
+       (XEN_MAJOR(xen_version) > (major) ||            \
+        (XEN_MAJOR(xen_version) == (major) &&          \
+         XEN_MINOR(xen_version) >= (minor)))
 #endif
 
 /*
@@ -3097,8 +3106,11 @@
 
        memcpy((void *)dstva, (void *)srcva, PAGE_SIZE);
 #elif defined(XEN)
-       xen_copy_page(srcpa, dstpa);
-#else
+       if (XEN_VERSION_SUPPORTED(3, 4)) {
+               xen_copy_page(srcpa, dstpa);
+               return;
+       }
+#endif
        pt_entry_t *spte;
        pt_entry_t *dpte;
        void *csrcva;
@@ -3128,7 +3140,6 @@
        pmap_pte_flush();
 #endif
        kpreempt_enable();
-#endif
 }
 
 static pt_entry_t *
@@ -4108,8 +4119,11 @@
 #ifdef __HAVE_DIRECT_MAP
                pagezero(PMAP_DIRECT_MAP(*paddrp));
 #elif defined(XEN)
-               xen_pagezero(*paddrp);
-#else
+               if (XEN_VERSION_SUPPORTED(3, 4)) {
+                       xen_pagezero(*paddrp);
+                       return true;
+               }
+#endif
                kpreempt_disable();
                pmap_pte_set(early_zero_pte,
                    pmap_pa2pte(*paddrp) | PG_V | PG_RW | PG_k);
@@ -4121,7 +4135,6 @@
                pmap_pte_flush();
 #endif /* defined(DIAGNOSTIC) */
                kpreempt_enable();
-#endif
        } else {
                /* XXX */
                ptp = uvm_pagealloc(NULL, 0, NULL,


Home | Main Index | Thread Index | Old Index