Re: [PATCH] Fix i486 suspend to disk CR4 oops

From: Pavel Machek
Date: Mon Aug 18 2008 - 05:15:43 EST


>
> * David Fries <david@xxxxxxxxx> wrote:
>
> > arch/x86/power/cpu_32.c __save_processor_state calls read_cr4() only a
> > i486 CPU doesn't have the CR4 register. Trying to read it produces an
> > invalid opcode oops during suspend to disk.
> >
> > Added the check (boot_cpu_data.x86 >= 5) before reading the register.
> > If the value to be written is zero the write is skipped.
> >
> > arch/x86/power/hibernate_asm_32.S
> > done: swapped the use of %eax and %ecx to use jecxz for
> > the zero test and jump over store to %cr4.
> > restore_image: s/%ecx/%eax/ to be consistent with done:
> >
> > In addition to __save_processor_state, acpi_save_state_mem,
> > efi_call_phys_prelog, and efi_call_phys_epilog had checks added (acpi
> > restore was in assembly and already had a check for non-zero). There
> > were other reads and writes of CR4, but MCE and virtualization
> > shouldn't be executed on a i486 anyway.
> >
> > Signed-off-by: David Fries <david@xxxxxxxxx>
>
> applied to tip/x86/urgent, thanks David. I've changed the conditions to
> read_cr4_safe() instead - that's cleaner. Could you please check whether
> the patch below works fine too on your box?
>
> Rafael, Pavel - does the commit below look good to you too?
>
> Ingo
>
> ---------------------->
> >From e437fa5586f2e3b2aaeba649fae52be1f9a6eabb Mon Sep 17 00:00:00 2001
> From: David Fries <david@xxxxxxxxx>
> Date: Sun, 17 Aug 2008 23:03:40 -0500
> Subject: [PATCH] x86: fix i486 suspend to disk CR4 oops
>
> arch/x86/power/cpu_32.c __save_processor_state calls read_cr4()
> only a i486 CPU doesn't have the CR4 register. Trying to read it
> produces an invalid opcode oops during suspend to disk.
>
> Use the safe rc4 reading op instead. If the value to be written is
> zero the write is skipped.
>
> arch/x86/power/hibernate_asm_32.S
> done: swapped the use of %eax and %ecx to use jecxz for
> the zero test and jump over store to %cr4.
> restore_image: s/%ecx/%eax/ to be consistent with done:
>
> In addition to __save_processor_state, acpi_save_state_mem,
> efi_call_phys_prelog, and efi_call_phys_epilog had checks added
> (acpi restore was in assembly and already had a check for
> non-zero). There were other reads and writes of CR4, but MCE and
> virtualization shouldn't be executed on a i486 anyway.
>
> Signed-off-by: David Fries <david@xxxxxxxxx>
> Signed-off-by: Ingo Molnar <mingo@xxxxxxx>

Acked-by: Pavel Machek <pavel@xxxxxxx>


--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/