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

From: Andi Kleen
Date: Mon Aug 18 2008 - 02:05:06 EST


"H. Peter Anvin" <hpa@xxxxxxxxx> writes:

> Maciej W. Rozycki wrote:
>> On Sun, 17 Aug 2008, David Fries 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.
>> [...]
>>> diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
>>> index 81e5ab6..bd0f2a3 100644
>>> --- a/arch/x86/kernel/acpi/sleep.c
>>> +++ b/arch/x86/kernel/acpi/sleep.c
>>> @@ -86,7 +86,9 @@ int acpi_save_state_mem(void)
>>> #endif /* !CONFIG_64BIT */
>>> header->pmode_cr0 = read_cr0();
>>> - header->pmode_cr4 = read_cr4();
>>> + /* cr4 was introduced in the Pentium CPU */
>>> + if (boot_cpu_data.x86 >= 5)
>>> + header->pmode_cr4 = read_cr4();
>>> header->realmode_flags = acpi_realmode_flags;
>>> header->real_magic = 0x12345678;
>>>
>> NACK. Later i486 chips do have CR4 -- for PSE, VME, etc. (the set
>> of
>> features varies across the line). Use a fixup as elsewhere or something.
>>
>
> The other alternative is to probe for the CPUID instruction (via
> EFLAGS.ID) -- CR4 is present if and only if CPUID exists.

Can be already checked for with boot_cpu_data.extended_cpuid_level.

-Andi
--
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/