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:


[...]

Hi,

Does the attached patch work for you ?

-- 
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 14:15:30 2014 +0900
@@ -3097,8 +3097,12 @@
 
        memcpy((void *)dstva, (void *)srcva, PAGE_SIZE);
 #elif defined(XEN)
-       xen_copy_page(srcpa, dstpa);
-#else
+       if (XEN_MAJOR(xen_version) >= 3 &&
+           XEN_MINOR(xen_version) >= 4) {
+               xen_copy_page(srcpa, dstpa);
+               return;
+       }
+#endif
        pt_entry_t *spte;
        pt_entry_t *dpte;
        void *csrcva;
@@ -3128,7 +3132,6 @@
        pmap_pte_flush();
 #endif
        kpreempt_enable();
-#endif
 }
 
 static pt_entry_t *
@@ -4108,8 +4111,12 @@
 #ifdef __HAVE_DIRECT_MAP
                pagezero(PMAP_DIRECT_MAP(*paddrp));
 #elif defined(XEN)
+       if (XEN_MAJOR(xen_version) >= 3 &&
+           XEN_MINOR(xen_version) >= 4) {
                xen_pagezero(*paddrp);
-#else
+               return true;
+       }
+#endif
                kpreempt_disable();
                pmap_pte_set(early_zero_pte,
                    pmap_pa2pte(*paddrp) | PG_V | PG_RW | PG_k);
@@ -4121,7 +4128,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