From patchwork Thu Apr 7 21:15:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herton Ronaldo Krzesinski X-Patchwork-Id: 90233 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 0851CB6F85 for ; Fri, 8 Apr 2011 07:16:11 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Q7wYa-0008Ce-92; Thu, 07 Apr 2011 21:16:00 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Q7wYX-0008BY-Tn for kernel-team@lists.ubuntu.com; Thu, 07 Apr 2011 21:15:57 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Q7wYW-0006ck-QP for ; Thu, 07 Apr 2011 21:15:57 +0000 Received: from 201.47.15.22.dynamic.adsl.gvt.net.br ([201.47.15.22] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Q7wYW-00062H-Ai for kernel-team@lists.ubuntu.com; Thu, 07 Apr 2011 21:15:56 +0000 From: Herton Ronaldo Krzesinski To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][Natty] x86, hibernate: Initialize mmu_cr4_features during boot Date: Thu, 7 Apr 2011 18:15:48 -0300 Message-Id: <1302210948-5799-2-git-send-email-herton.krzesinski@canonical.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1302210948-5799-1-git-send-email-herton.krzesinski@canonical.com> References: <1302210948-5799-1-git-send-email-herton.krzesinski@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: H. Peter Anvin Restore the initialization of mmu_cr4_features during boot, which was removed without comment in checkin e5f15b45ddf3afa2bbbb10c7ea34fb32b6de0a0e x86: Cleanup highmap after brk is concluded thereby breaking resume from hibernate. This restores previous functionality in approximately the same place, and corrects the reading of %cr4 on pre-CPUID hardware (%cr4 exists if and only if CPUID is supported.) However, part of the problem is that the hibernate suspend/resume sequence should manage the save/restore of %cr4 explicitly. Signed-off-by: H. Peter Anvin Cc: Rafael J. Wysocki Cc: Stefano Stabellini Cc: Yinghai Lu LKML-Reference: <201104020154.57136.rjw@sisk.pl> (cherry picked from commit 4da9484bdece39ab0b098fa711e095e3e9fc8684) Tested-by: Herton Ronaldo Krzesinski BugLink: http://bugs.launchpad.net/bugs/752870 Signed-off-by: Herton Ronaldo Krzesinski Acked-by: Stefan Bader Acked-by: John Johansnen --- arch/x86/kernel/setup.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index e543fe9..4e59873 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -1013,6 +1013,11 @@ void __init setup_arch(char **cmdline_p) paging_init(); x86_init.paging.pagetable_setup_done(swapper_pg_dir); + if (boot_cpu_data.cpuid_level >= 0) { + /* A CPU has %cr4 if and only if it has CPUID */ + mmu_cr4_features = read_cr4(); + } + #ifdef CONFIG_X86_32 /* sync back kernel address range */ clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY,