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

[Xen-devel] [PATCH] x86: store cr4 during suspend/resume

Currently cr4 is not cached before suspension, and mmu_cr4_features is
used in order to restore the expected cr4 value. This is correct so
far because the tasklet that executes the suspend/resume code is
running in the idle vCPU context.

In order to make the code less fragile, explicitly save the current
cr4 value before suspension, so that it can be restored afterwards.
This ensures that the cr4 value cached in the cpu_info doesn't get out
of sync after resume from suspension.

Suggested-by: Jan Beulich <jbeulich@xxxxxxxx>
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
 xen/arch/x86/acpi/wakeup_prot.S | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_prot.S
index 74261cb4f1..57431e4e2d 100644
--- a/xen/arch/x86/acpi/wakeup_prot.S
+++ b/xen/arch/x86/acpi/wakeup_prot.S
@@ -40,6 +40,9 @@ ENTRY(do_suspend_lowlevel)
         mov     %cr3, GREG(ax)
         mov     GREG(ax), REF(saved_cr3)
+        mov     %cr4, GREG(ax)
+        mov     GREG(ax), REF(saved_cr4)
         call    save_rest_processor_state
         mov     $3, %rdi
@@ -53,8 +56,7 @@ ENTRY(do_suspend_lowlevel)
         lgdt    boot_gdtr(%rip)
-        /* mmu_cr4_features contains latest cr4 setting */
-        mov     REF(mmu_cr4_features), GREG(ax)
+        mov     REF(saved_cr4), GREG(ax)
         mov     GREG(ax), %cr4
         mov     REF(saved_cr3), GREG(ax)
@@ -124,3 +126,4 @@ DECLARE_GREG(15)
 saved_cr0:      .quad   0
 saved_cr3:      .quad   0
+saved_cr4:      .quad   0

Xen-devel mailing list



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