Re: 2.6.38.2 breaks suspend to disk

From: Yinghai Lu
Date: Fri Apr 01 2011 - 12:07:26 EST


On 04/01/2011 04:32 AM, Stefano Stabellini wrote:
On Thu, 31 Mar 2011, Yinghai Lu wrote:
Stefano, can you explain why it fixes the problem?

or original patch uncover the bug?

as I wrote in the other email, e5f15b45ddf3afa2bbbb10c7ea34fb32b6de0a0e
removes cleanup_highmap_brk_end but this function was not only dealing
with mappings but it was also setting mmu_cr4_features, therefore the
setting of mmu_cr4_features was lost.

I think the real bug is that mmu_cr4_features ended up in
cleanup_highmap_brk_end by mistake.


originally mmu_cr4 is saved in init_memory_mapping.

and init_memory_mapping will update cr4.

so please use this version instead.


From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

[PATCH -v2] x86: Save cr4 to mmu_cr4_features at boot time

Save cr4 to mmu_cr4_features at boot time

Michael reported 2.6.38.2 hibernation is broken by one backported patch.
it cause a freeze when resuming from hibernation

| "x86: Cleanup highmap after brk is concluded"
| commit id e5f15b45ddf3afa2bbbb10c7ea34fb32b6de0a0e.

it turns out the mmu_cr4 save it lost somehow.

-v2: need to save mmu_cr4 after init_memory_mapping(), because it updates mmu_cr4
and originally that storing action is after updating. -- by Yinghai

Bisected-and-tested-by: Michael Leun <lkml20101129@xxxxxxxxxxxxxxx>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>

---
arch/x86/kernel/setup.c | 9 +++++++++
1 file changed, 9 insertions(+)

Index: linux-2.6/arch/x86/kernel/setup.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup.c
+++ linux-2.6/arch/x86/kernel/setup.c
@@ -294,10 +294,17 @@ static void __init init_gbpages(void)
else
direct_gbpages = 0;
}
+static void __init store_mmu_cr4(void)
+{
+ mmu_cr4_features = read_cr4();
+}
#else
static inline void init_gbpages(void)
{
}
+static void __init store_mmu_cr4(void)
+{
+}
static void __init cleanup_highmap(void)
{
}
@@ -929,6 +936,8 @@ void __init setup_arch(char **cmdline_p)
/* max_pfn_mapped is updated here */
max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT);
max_pfn_mapped = max_low_pfn_mapped;
+ /* after init_memory_mapping updating cr4*/
+ store_mmu_cr4();
#ifdef CONFIG_X86_64
if (max_pfn > max_low_pfn) {
--
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/