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] [LINUX] Clean up reboot.c suspend handlin

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [LINUX] Clean up reboot.c suspend handling.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 28 Jul 2006 16:22:01 +0000
Delivery-date: Fri, 28 Jul 2006 09:32:57 -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 7ee2c02c6db072199a59055f6a2d11d4f36c165c
# Parent  e5c84586c333c7be0a70228cca51865c29bab21c
[LINUX] Clean up reboot.c suspend handling.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c |    5 
 linux-2.6-xen-sparse/drivers/xen/core/reboot.c  |  148 ++++++++++++------------
 2 files changed, 80 insertions(+), 73 deletions(-)

diff -r e5c84586c333 -r 7ee2c02c6db0 
linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c   Fri Jul 28 10:51:38 
2006 +0100
+++ b/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c   Fri Jul 28 11:10:08 
2006 +0100
@@ -652,8 +652,13 @@ void mm_pin_all(void)
 void mm_pin_all(void)
 {
        struct page *page;
+
+       /* Only pgds on the pgd_list please: none hidden in the slab cache. */
+       kmem_cache_shrink(pgd_cache);
+
        if (xen_feature(XENFEAT_writable_page_tables))
                return;
+
        for (page = pgd_list; page; page = (struct page *)page->index) {
                if (!test_bit(PG_pinned, &page->flags))
                        __pgd_pin((pgd_t *)page_address(page));
diff -r e5c84586c333 -r 7ee2c02c6db0 
linux-2.6-xen-sparse/drivers/xen/core/reboot.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c    Fri Jul 28 10:51:38 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c    Fri Jul 28 11:10:08 
2006 +0100
@@ -19,14 +19,6 @@
 #include <xen/xencons.h>
 #include <xen/cpu_hotplug.h>
 
-#if defined(__i386__) || defined(__x86_64__)
-/*
- * Power off function, if any
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-#endif
-
 extern void ctrl_alt_del(void);
 
 #define SHUTDOWN_INVALID  -1
@@ -40,6 +32,13 @@ extern void ctrl_alt_del(void);
 #define SHUTDOWN_HALT      4
 
 #if defined(__i386__) || defined(__x86_64__)
+
+/*
+ * Power off function, if any
+ */
+void (*pm_power_off)(void);
+EXPORT_SYMBOL(pm_power_off);
+
 void machine_emergency_restart(void)
 {
        /* We really want to get pending console data out before we die. */
@@ -70,7 +69,8 @@ EXPORT_SYMBOL(machine_restart);
 EXPORT_SYMBOL(machine_restart);
 EXPORT_SYMBOL(machine_halt);
 EXPORT_SYMBOL(machine_power_off);
-#endif
+
+#endif /* defined(__i386__) || defined(__x86_64__) */
 
 /******************************************************************************
  * Stop/pickle callback handling.
@@ -82,6 +82,7 @@ static DECLARE_WORK(shutdown_work, __shu
 static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL);
 
 #if defined(__i386__) || defined(__x86_64__)
+
 /* Ensure we run on the idle task page tables so that we will
    switch page tables before running user space. This is needed
    on architectures with separate kernel and user page tables
@@ -98,70 +99,23 @@ static void switch_idle_mm(void)
        current->active_mm = &init_mm;
        mmdrop(mm);
 }
-#endif
-
-static int __do_suspend(void *ignore)
-{
-       int err;
-#if defined(__i386__) || defined(__x86_64__)
+
+static void pre_suspend(void)
+{
+       HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
+       clear_fixmap(FIX_SHARED_INFO);
+
+       xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn);
+       xen_start_info->console_mfn = mfn_to_pfn(xen_start_info->console_mfn);
+}
+
+static void post_suspend(void)
+{
        int i, j, k, fpp;
        extern unsigned long max_pfn;
        extern unsigned long *pfn_to_mfn_frame_list_list;
        extern unsigned long *pfn_to_mfn_frame_list[];
-#endif
-
-       extern void time_resume(void);
-
-       BUG_ON(smp_processor_id() != 0);
-       BUG_ON(in_interrupt());
-
-#if defined(__i386__) || defined(__x86_64__)
-       if (xen_feature(XENFEAT_auto_translated_physmap)) {
-               printk(KERN_WARNING "Cannot suspend in "
-                      "auto_translated_physmap mode.\n");
-               return -EOPNOTSUPP;
-       }
-#endif
-
-       err = smp_suspend();
-       if (err)
-               return err;
-
-       xenbus_suspend();
-
-       preempt_disable();
-
-#ifdef __i386__
-       kmem_cache_shrink(pgd_cache);
-#endif
-#if defined(__i386__) || defined(__x86_64__)
-       mm_pin_all();
-
-       __cli();
-#elif defined(__ia64__)
-       local_irq_disable();
-#endif
-       preempt_enable();
-
-       gnttab_suspend();
-
-#if defined(__i386__) || defined(__x86_64__)
-       HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
-       clear_fixmap(FIX_SHARED_INFO);
-
-       xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn);
-       xen_start_info->console_mfn = mfn_to_pfn(xen_start_info->console_mfn);
-#endif
-
-       /*
-        * We'll stop somewhere inside this hypercall. When it returns,
-        * we'll start resuming after the restore.
-        */
-       HYPERVISOR_suspend(virt_to_mfn(xen_start_info));
-
-       shutting_down = SHUTDOWN_INVALID;
-
-#if defined(__i386__) || defined(__x86_64__)
+
        set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
 
        HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
@@ -183,21 +137,69 @@ static int __do_suspend(void *ignore)
                        virt_to_mfn(&phys_to_machine_mapping[i]);
        }
        HYPERVISOR_shared_info->arch.max_pfn = max_pfn;
+}
+
+#else /* !(defined(__i386__) || defined(__x86_64__)) */
+
+#define switch_idle_mm()       ((void)0)
+#define mm_pin_all()           ((void)0)
+#define pre_suspend()          ((void)0)
+#define post_suspend()         ((void)0)
+
 #endif
 
+static int __do_suspend(void *ignore)
+{
+       int err;
+
+       extern void time_resume(void);
+
+       BUG_ON(smp_processor_id() != 0);
+       BUG_ON(in_interrupt());
+
+#if defined(__i386__) || defined(__x86_64__)
+       if (xen_feature(XENFEAT_auto_translated_physmap)) {
+               printk(KERN_WARNING "Cannot suspend in "
+                      "auto_translated_physmap mode.\n");
+               return -EOPNOTSUPP;
+       }
+#endif
+
+       err = smp_suspend();
+       if (err)
+               return err;
+
+       xenbus_suspend();
+
+       preempt_disable();
+
+       mm_pin_all();
+       local_irq_disable();
+       preempt_enable();
+
+       gnttab_suspend();
+
+       pre_suspend();
+
+       /*
+        * We'll stop somewhere inside this hypercall. When it returns,
+        * we'll start resuming after the restore.
+        */
+       HYPERVISOR_suspend(virt_to_mfn(xen_start_info));
+
+       shutting_down = SHUTDOWN_INVALID;
+
+       post_suspend();
+
        gnttab_resume();
 
        irq_resume();
 
        time_resume();
 
-#if defined(__i386__) || defined(__x86_64__)
        switch_idle_mm();
 
-       __sti();
-#elif defined(__ia64__)
        local_irq_enable();
-#endif
 
        xencons_resume();
 

_______________________________________________
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] [LINUX] Clean up reboot.c suspend handling., Xen patchbot-unstable <=