WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Xen: Properly setup uninitialized P2M entries.

To: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Subject: [Xen-devel] [PATCH] Xen: Properly setup uninitialized P2M entries.
From: Gianluca Guida <gianluca.guida@xxxxxxxxxx>
Date: Sat, 1 Aug 2009 01:28:13 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 31 Jul 2009 17:52:13 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
P2M entries higher than xen_start_info->nr_pages allocated by the
domain builder are uninitialized. Set them to INVALID_P2M_ENTRY.

---
 arch/x86/xen/enlighten.c |    3 +++
 arch/x86/xen/mmu.c       |   13 +++++++++++++
 arch/x86/xen/xen-ops.h   |    1 +
 3 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index e099e44..b542d76 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1091,6 +1091,9 @@ asmlinkage void __init xen_start_kernel(void)
        /* set the limit of our address space */
        xen_reserve_top();
 
+       /* fixup p2m entries uninitialized by domain builder */
+       xen_fix_mfn_list();
+
 #ifdef CONFIG_X86_32
        /* set up basic CPUID stuff */
        cpu_detect(&new_cpu_data);
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 8c53fc9..10acb23 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -235,6 +235,19 @@ void __init xen_build_dynamic_phys_to_machine(void)
        xen_build_mfn_list_list();
 }
 
+/*
+ * P2M entries higher than xen_start_info->nr_pages allocated by the
+ * domain builder are uninitialized. Set them to INVALID_P2M_ENTRY.
+ */
+void __init xen_fix_mfn_list(void)
+{
+       unsigned idx;
+       unsigned long max_pfn = min(MAX_DOMAIN_PAGES, xen_start_info->nr_pages);
+
+       for (idx = p2m_index(max_pfn); idx < P2M_ENTRIES_PER_PAGE; idx++)
+               p2m_top[p2m_top_index(max_pfn)][idx] = INVALID_P2M_ENTRY;
+}
+
 unsigned long get_phys_to_machine(unsigned long pfn)
 {
        unsigned topidx, idx;
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 82ba25c..1c51314 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -41,6 +41,7 @@ void xen_enable_syscall(void);
 void xen_vcpu_restore(void);
 
 void __init xen_build_dynamic_phys_to_machine(void);
+void __init xen_fix_mfn_list(void);
 
 void xen_init_irq_ops(void);
 void xen_setup_timer(int cpu);
-- 
1.5.6.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Xen: Properly setup uninitialized P2M entries., Gianluca Guida <=