[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Fix long-standing save/restore bug on x86-64.



# HG changeset patch
# User smh22@xxxxxxxxxxxxxxxxxxxx
# Node ID 8970d080f719e81092a0ec6a50394ff34c4681b1
# Parent  71f74f569b261a4582088103d9d622cafceb84e3
Fix long-standing save/restore bug on x86-64. 

Signed-off-by: Steven Hand <steven@xxxxxxxxxxxxx>

diff -r 71f74f569b26 -r 8970d080f719 
linux-2.6-xen-sparse/drivers/xen/core/reboot.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c    Thu Apr  6 14:55:37 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c    Thu Apr  6 15:15:28 2006
@@ -85,6 +85,23 @@
 #define smp_resume()   ((void)0)
 #endif
 
+/* 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
+   because the user page table pointer is not saved/restored. */
+static void switch_idle_mm(void)
+{
+       struct mm_struct *mm = current->active_mm;
+
+       if (mm == &init_mm)
+               return;
+
+       atomic_inc(&init_mm.mm_count);
+       switch_mm(mm, &init_mm, current);
+       current->active_mm = &init_mm;
+       mmdrop(mm);
+}
+
 static int __do_suspend(void *ignore)
 {
        int i, j, k, fpp, err;
@@ -163,6 +180,8 @@
        irq_resume();
 
        time_resume();
+
+       switch_idle_mm();
 
        __sti();
 

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.