# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1172876496 0
# Node ID 29d4bca7a5037be8daa19e195b38191b02590c49
# Parent d5ca4c37b3c53688cd556af6730017b902da5bc2
linux: Some save/restore simplifications and cleanups.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c | 38 ++++++++---------
linux-2.6-xen-sparse/include/xen/cpu_hotplug.h | 2
2 files changed, 20 insertions(+), 20 deletions(-)
diff -r d5ca4c37b3c5 -r 29d4bca7a503
linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c Fri Mar 02
22:57:27 2007 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c Fri Mar 02
23:01:36 2007 +0000
@@ -59,23 +59,6 @@ EXPORT_SYMBOL(machine_halt);
EXPORT_SYMBOL(machine_halt);
EXPORT_SYMBOL(machine_power_off);
-/* 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 void pre_suspend(void)
{
HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
@@ -99,7 +82,9 @@ static void post_suspend(int suspend_can
xen_start_info->console.domU.mfn =
pfn_to_mfn(xen_start_info->console.domU.mfn);
} else {
+#ifdef CONFIG_SMP
cpu_initialized_map = cpumask_of_cpu(0);
+#endif
}
set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
@@ -172,10 +157,25 @@ static int take_machine_down(void *p_fas
post_suspend(suspend_cancelled);
gnttab_resume();
- if (!suspend_cancelled)
+ if (!suspend_cancelled) {
irq_resume();
+#ifdef __x86_64__
+ /*
+ * Older versions of Xen do not save/restore the user %cr3.
+ * We do it here just in case, but there's no need if we are
+ * in fast-suspend mode as that implies a new enough Xen.
+ */
+ if (!fast_suspend) {
+ struct mmuext_op op;
+ op.cmd = MMUEXT_NEW_USER_BASEPTR;
+ op.arg1.mfn = pfn_to_mfn(__pa(__user_pgd(
+ current->active_mm->pgd)) >> PAGE_SHIFT);
+ if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF))
+ BUG();
+ }
+#endif
+ }
time_resume();
- switch_idle_mm();
local_irq_enable();
if (fast_suspend && !suspend_cancelled) {
diff -r d5ca4c37b3c5 -r 29d4bca7a503
linux-2.6-xen-sparse/include/xen/cpu_hotplug.h
--- a/linux-2.6-xen-sparse/include/xen/cpu_hotplug.h Fri Mar 02 22:57:27
2007 +0000
+++ b/linux-2.6-xen-sparse/include/xen/cpu_hotplug.h Fri Mar 02 23:01:36
2007 +0000
@@ -4,7 +4,7 @@
#include <linux/kernel.h>
#include <linux/cpumask.h>
-#if defined(CONFIG_X86)
+#if defined(CONFIG_X86) && defined(CONFIG_SMP)
extern cpumask_t cpu_initialized_map;
#define cpu_set_initialized(cpu) cpu_set(cpu, cpu_initialized_map)
#else
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|