lkml.org 
[lkml]   [2011]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: 2.6.38.2 breaks suspend to disk
From
On Fri, Apr 1, 2011 at 2:30 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 04/01/2011 02:24 PM, Yinghai Lu wrote:
>> On Fri, Apr 1, 2011 at 1:21 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>>> On 04/01/2011 12:54 PM, Yinghai Lu wrote:
>>>>
>>>> ok, please check if you are happy with this one.
>>>>
>>>
>>> The best would simply be:
>>>
>>>        mmu_cr4_features = read_cr4_safe();
>>>
>>> If this has to run before we can handle exceptions, one can verify the
>>> existence by testing for the CPUID instruction (a CPU has CR4 if and
>>> only if it has CPUID):
>>>
>>>        if (boot_cpu_data.cpuid_level >= 0)
>>>                mmu_cr4_features = read_cr4_safe();
>>>
>>> ... since we set cpuid_level to -1 if there is no CPUID instruction.
>>
>> in that case could use read_cr4 directly.
>>
>> please check attached -v4
>>
>
> Err, yes, that's what I meant.
>
> Now, why the heck did you introduce a bunch of CONFIG_HIBERNATION #ifdefs?

mmu_cr4_features: have two usages:
1. for 32bit to control cr4 access in head_32.S
2. for hibernation resume.

include/asm/processor.h:extern unsigned long mmu_cr4_features;
include/asm/processor.h: mmu_cr4_features |= mask;
include/asm/processor.h: mmu_cr4_features &= ~mask;
kernel/head_32.S:#define cr4_bits pa(mmu_cr4_features)
kernel/setup.c: * mmu_cr4_features two purpose:
kernel/setup.c:unsigned long mmu_cr4_features;
kernel/setup.c:unsigned long mmu_cr4_features = X86_CR4_PAE;
kernel/setup.c: mmu_cr4_features = read_cr4();
power/hibernate_asm_32.S: movl mmu_cr4_features, %ecx
power/hibernate_asm_32.S: movl mmu_cr4_features, %ecx
power/hibernate_asm_64.S: movq mmu_cr4_features(%rip), %rax
power/hibernate_asm_64.S: movq mmu_cr4_features(%rip), %rax

So we don't need to read back cr4 and save it if CONFIG_HIBERNATION is
not defined.

Thanks

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-04-01 23:39    [W:1.875 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site