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 Stopgap measure: revert to rev 1.56. starti...



details:   https://anonhg.NetBSD.org/src/rev/0c2a5f008836
branches:  trunk
changeset: 347383:0c2a5f008836
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue Aug 23 11:03:52 2016 +0000

description:
Stopgap measure: revert to rev 1.56. starting with 1.57 an i386PAE Xen
kernel doesn't boot:
(XEN) mm.c:2394:d139v0 Bad type (saw 5400000000000001 != exp 7000000000000000) for mfn 1136f5 (pfn 621)
(XEN) mm.c:887:d139v0 Could not get page type PGT_writable_page
(XEN) mm.c:939:d139v0 Error getting mfn 1136f5 (pfn 621) from L1 entry 00000001136f5003 for l1e_owner=139, pg_owner=139
(XEN) mm.c:1254:d139v0 Failure in alloc_l1_table: entry 33
(XEN) mm.c:2141:d139v0 Error while validating mfn 112f57 (pfn dbf) for type 1000000000000000: caf=8000000000000003 taf=1000000000000001
(XEN) mm.c:947:d139v0 Attempt to create linear p.t. with write perms
(XEN) mm.c:1330:d139v0 Failure in alloc_l2_table: entry 3
(XEN) mm.c:2141:d139v0 Error while validating mfn 112f5b (pfn dbb) for type 2200000000000000: caf=8000000000000003 taf=2200000000000001
(XEN) mm.c:1412:d139v0 Failure in alloc_l3_table: entry 3
(XEN) mm.c:2141:d139v0 Error while validating mfn 112f60 (pfn db6) for type 3000000000000000: caf=8000000000000003 taf=3000000000000001
(XEN) mm.c:3044:d139v0 Error while pinning mfn 112f60
(XEN) traps.c:459:d139v0 Unhandled bkpt fault/trap [#3] on VCPU 0 [ec=0000]
(XEN) domain_crash_sync called from entry.S: fault at ffff82d080231894 compat_create_bounce_frame+0xda/0xf2

diffstat:

 sys/arch/xen/x86/x86_xpmap.c |  57 +++++++++++++------------------------------
 1 files changed, 17 insertions(+), 40 deletions(-)

diffs (125 lines):

diff -r b625e21d35f1 -r 0c2a5f008836 sys/arch/xen/x86/x86_xpmap.c
--- a/sys/arch/xen/x86/x86_xpmap.c      Tue Aug 23 10:12:02 2016 +0000
+++ b/sys/arch/xen/x86/x86_xpmap.c      Tue Aug 23 11:03:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: x86_xpmap.c,v 1.59 2016/08/11 15:35:10 maxv Exp $      */
+/*     $NetBSD: x86_xpmap.c,v 1.60 2016/08/23 11:03:52 bouyer Exp $    */
 
 /*
  * Copyright (c) 2006 Mathieu Ropert <mro%adviseo.fr@localhost>
@@ -69,7 +69,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.59 2016/08/11 15:35:10 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.60 2016/08/23 11:03:52 bouyer Exp $");
 
 #include "opt_xen.h"
 #include "opt_ddb.h"
@@ -730,24 +730,15 @@
        pd_entry_t *pdtpe, *pde, *pte;
        pd_entry_t *bt_pgd;
        paddr_t addr;
-       vaddr_t page, avail, map_end;
+       vaddr_t page, avail, text_end, map_end;
        int i;
-       extern char __rodata_start;
        extern char __data_start;
-       extern char __kernel_end;
        extern char *early_zerop; /* from pmap.c */
-       pt_entry_t pg_nx;
-       u_int descs[4];
 
        __PRINTK(("xen_bootstrap_tables(%#" PRIxVADDR ", %#" PRIxVADDR ","
            " %d, %d)\n",
            old_pgd, new_pgd, old_count, new_count));
-
-       /*
-        * Set the NX/XD bit, if available. descs[3] = %edx.
-        */
-       x86_cpuid(0x80000001, descs);
-       pg_nx = (descs[3] & CPUID_NOX) ? PG_NX : 0;
+       text_end = ((vaddr_t)&__data_start) & ~PAGE_MASK;
 
        /*
         * size of R/W area after kernel text:
@@ -785,7 +776,8 @@
        }
 #endif /* DOM0OPS */
 
-       __PRINTK(("xen_bootstrap_tables map_end 0x%lx\n", map_end));
+       __PRINTK(("xen_bootstrap_tables text_end 0x%lx map_end 0x%lx\n",
+           text_end, map_end));
        __PRINTK(("console %#lx ", xen_start_info.console_mfn));
        __PRINTK(("xenstore %#" PRIx32 "\n", xen_start_info.store_mfn));
 
@@ -913,30 +905,20 @@
                            page < (vaddr_t)atdevbase + IOM_SIZE) {
                                pte[pl1_pi(page)] =
                                    IOM_BEGIN + (page - (vaddr_t)atdevbase);
-                               pte[pl1_pi(page)] |= pg_nx;
                        }
 #endif
-
                        pte[pl1_pi(page)] |= PG_k | PG_V;
-                       if (page < (vaddr_t)&__rodata_start) {
-                               /* Map the kernel text RX. */
+                       if (page < text_end) {
+                               /* map kernel text RO */
                                pte[pl1_pi(page)] |= PG_RO;
-                       } else if (page >= (vaddr_t)&__rodata_start &&
-                           page < (vaddr_t)&__data_start) {
-                               /* Map the kernel rodata R. */
-                               pte[pl1_pi(page)] |= PG_RO | pg_nx;
-                       } else if (page >= (vaddr_t)&__data_start &&
-                           page < (vaddr_t)&__kernel_end) {
-                               /* Map the kernel data+bss RW. */
-                               pte[pl1_pi(page)] |= PG_RW | pg_nx;
                        } else if (page >= old_pgd &&
                            page < old_pgd + (old_count * PAGE_SIZE)) {
-                               /* Map the old page tables R. */
-                               pte[pl1_pi(page)] |= PG_RO | pg_nx;
+                               /* map old page tables RO */
+                               pte[pl1_pi(page)] |= PG_RO;
                        } else if (page >= new_pgd &&
                            page < new_pgd + ((new_count + l2_4_count) * PAGE_SIZE)) {
-                               /* Map the new page tables R. */
-                               pte[pl1_pi(page)] |= PG_RO | pg_nx;
+                               /* map new page tables RO */
+                               pte[pl1_pi(page)] |= PG_RO;
 #ifdef i386
                        } else if (page == (vaddr_t)tmpgdt) {
                                /*
@@ -1029,19 +1011,15 @@
        xpq_queue_pin_l2_table(xpmap_ptom_masked(addr));
 #endif
 #else /* PAE */
-
-       /* Recursive entry in pmap_kernel(). */
-       bt_pgd[PDIR_SLOT_PTE] = xpmap_ptom_masked((paddr_t)bt_pgd - KERNBASE)
-           | PG_k | PG_RO | PG_V | pg_nx;
+       /* recursive entry in higher-level per-cpu PD and pmap_kernel() */
+       bt_pgd[PDIR_SLOT_PTE] = xpmap_ptom_masked((paddr_t)bt_pgd - KERNBASE) | PG_k | PG_V;
 #ifdef __x86_64__
-       /* Recursive entry in higher-level per-cpu PD. */
-       bt_cpu_pgd[PDIR_SLOT_PTE] = xpmap_ptom_masked((paddr_t)bt_cpu_pgd - KERNBASE)
-           | PG_k | PG_RO | PG_V | pg_nx;
-#endif
+          bt_cpu_pgd[PDIR_SLOT_PTE] =
+                  xpmap_ptom_masked((paddr_t)bt_cpu_pgd - KERNBASE) | PG_k | PG_V;
+#endif /* __x86_64__ */
        __PRINTK(("bt_pgd[PDIR_SLOT_PTE] va %#" PRIxVADDR " pa %#" PRIxPADDR
            " entry %#" PRIxPADDR "\n", new_pgd, (paddr_t)new_pgd - KERNBASE,
            bt_pgd[PDIR_SLOT_PTE]));
-
        /* Mark tables RO */
        xen_bt_set_readonly((vaddr_t) pde);
 #endif
@@ -1051,7 +1029,6 @@
 #if PTP_LEVELS > 3
        xen_bt_set_readonly(new_pgd);
 #endif
-
        /* Pin the PGD */
        __PRINTK(("pin PGD: %"PRIxVADDR"\n", new_pgd - KERNBASE));
 #ifdef __x86_64__



Home | Main Index | Thread Index | Old Index