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 Fix a year old bug that was only fixed in j...



details:   https://anonhg.NetBSD.org/src/rev/ed6f65ca2a3b
branches:  trunk
changeset: 763694:ed6f65ca2a3b
user:      jym <jym%NetBSD.org@localhost>
date:      Wed Mar 30 21:53:58 2011 +0000

description:
Fix a year old bug that was only fixed in jym-xensuspend branch, but
not in HEAD:
- use uvm_km_alloc() instead of kmem_alloc() to enforce alignement when
allocating p2m_frame pages (xentools can only deal with page-aligned
addresses)
- do not use paddr_t for p2m_frame_list_list with PAE, xentools expect
32 bits PFNs even with 64 bits PTE.

Required to make ``xm dump-core'' work as expected.

diffstat:

 sys/arch/xen/x86/hypervisor_machdep.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (52 lines):

diff -r 921042dfcfd7 -r ed6f65ca2a3b sys/arch/xen/x86/hypervisor_machdep.c
--- a/sys/arch/xen/x86/hypervisor_machdep.c     Wed Mar 30 21:40:01 2011 +0000
+++ b/sys/arch/xen/x86/hypervisor_machdep.c     Wed Mar 30 21:53:58 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hypervisor_machdep.c,v 1.13 2009/10/23 02:32:34 snj Exp $      */
+/*     $NetBSD: hypervisor_machdep.c,v 1.14 2011/03/30 21:53:58 jym Exp $      */
 
 /*
  *
@@ -54,7 +54,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.13 2009/10/23 02:32:34 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.14 2011/03/30 21:53:58 jym Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -385,10 +385,11 @@
          * A L1 page contains the list of MFN we are looking for
          */
         max_pfn = xen_start_info.nr_pages;
-        fpp = PAGE_SIZE / sizeof(paddr_t);
+        fpp = PAGE_SIZE / sizeof(xen_pfn_t);
 
         /* we only need one L3 page */
-        l3_p2m_page = kmem_alloc(PAGE_SIZE, KM_NOSLEEP);
+        l3_p2m_page = (vaddr_t *)uvm_km_alloc(kernel_map, PAGE_SIZE,
+           PAGE_SIZE, UVM_KMF_WIRED | UVM_KMF_NOWAIT);
         if (l3_p2m_page == NULL)
                 panic("could not allocate memory for l3_p2m_page");
 
@@ -398,7 +399,9 @@
          */
         l2_p2m_page_size = howmany(max_pfn, fpp);
 
-        l2_p2m_page = kmem_alloc(l2_p2m_page_size * PAGE_SIZE, KM_NOSLEEP);
+        l2_p2m_page = (vaddr_t *)uvm_km_alloc(kernel_map,
+           l2_p2m_page_size * PAGE_SIZE,
+           PAGE_SIZE, UVM_KMF_WIRED | UVM_KMF_NOWAIT);
         if (l2_p2m_page == NULL)
                 panic("could not allocate memory for l2_p2m_page");
 
@@ -418,7 +421,7 @@
         unsigned long max_pfn;
 
         max_pfn = xen_start_info.nr_pages;
-        fpp = PAGE_SIZE / sizeof(paddr_t);
+        fpp = PAGE_SIZE / sizeof(xen_pfn_t);
 
         for (i = 0; i < l2_p2m_page_size; i++) {
                 /*



Home | Main Index | Thread Index | Old Index