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-changelog

[Xen-changelog] [xen-unstable] [XEN] Debug builds check for correct usag

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEN] Debug builds check for correct usage of percpu areas.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 22 Aug 2006 16:00:45 +0000
Delivery-date: Tue, 22 Aug 2006 09:01:10 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 56b05c6720337c6da4604a85337eba263a9bd733
# Parent  80c5350a68f1f9499b08f76345882b2bcf059c2a
[XEN] Debug builds check for correct usage of percpu areas.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/setup.c |   41 +++++++++++++++++++++++++++--------------
 1 files changed, 27 insertions(+), 14 deletions(-)

diff -r 80c5350a68f1 -r 56b05c672033 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Tue Aug 22 11:19:48 2006 +0100
+++ b/xen/arch/x86/setup.c      Tue Aug 22 11:33:59 2006 +0100
@@ -160,19 +160,29 @@ void discard_initial_images(void)
 
 extern char __per_cpu_start[], __per_cpu_data_end[], __per_cpu_end[];
 
-static void percpu_init_areas(void)
+static void __init percpu_init_areas(void)
 {
     unsigned int i, data_size = __per_cpu_data_end - __per_cpu_start;
 
     BUG_ON(data_size > PERCPU_SIZE);
 
-    for ( i = 1; i < NR_CPUS; i++ )
-        memcpy(__per_cpu_start + (i << PERCPU_SHIFT),
-               __per_cpu_start,
-               data_size);
-}
-
-static void percpu_free_unused_areas(void)
+    for_each_cpu ( i )
+    {
+        memguard_unguard_range(__per_cpu_start + (i << PERCPU_SHIFT),
+                               1 << PERCPU_SHIFT);
+        if ( i != 0 )
+            memcpy(__per_cpu_start + (i << PERCPU_SHIFT),
+                   __per_cpu_start,
+                   data_size);
+    }
+}
+
+static void __init percpu_guard_areas(void)
+{
+    memguard_guard_range(__per_cpu_start, __per_cpu_end - __per_cpu_start);
+}
+
+static void __init percpu_free_unused_areas(void)
 {
     unsigned int i, first_unused;
 
@@ -186,11 +196,13 @@ static void percpu_free_unused_areas(voi
     for ( ; i < NR_CPUS; i++ )
         BUG_ON(cpu_online(i));
 
+#ifndef MEMORY_GUARD
     init_xenheap_pages(__pa(__per_cpu_start) + (first_unused << PERCPU_SHIFT),
                        __pa(__per_cpu_end));
-}
-
-static void init_idle_domain(void)
+#endif
+}
+
+static void __init init_idle_domain(void)
 {
     struct domain *idle_domain;
 
@@ -259,8 +271,6 @@ void __init __start_xen(multiboot_info_t
         printk("FATAL ERROR: Misaligned CPU0 stack.\n");
         EARLY_FAIL();
     }
-
-    percpu_init_areas();
 
     xenheap_phys_end = opt_xenheap_megabytes << 20;
 
@@ -399,6 +409,7 @@ void __init __start_xen(multiboot_info_t
     }
 
     memguard_init();
+    percpu_guard_areas();
 
     printk("System RAM: %luMB (%lukB)\n", 
            nr_pages >> (20 - PAGE_SHIFT),
@@ -477,12 +488,14 @@ void __init __start_xen(multiboot_info_t
     acpi_boot_table_init();
     acpi_boot_init();
 
-    if ( smp_found_config ) 
+    if ( smp_found_config )
         get_smp_config();
 
     init_apic_mappings();
 
     init_IRQ();
+
+    percpu_init_areas();
 
     init_idle_domain();
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XEN] Debug builds check for correct usage of percpu areas., Xen patchbot-unstable <=