From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755227AbbB0Tu0 (ORCPT ); Fri, 27 Feb 2015 14:50:26 -0500 Received: from smtprelay0058.hostedemail.com ([216.40.44.58]:59017 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754458AbbB0TuX (ORCPT ); Fri, 27 Feb 2015 14:50:23 -0500 X-Session-Marker: 6E657665747340676F6F646D69732E6F7267 X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::,RULES_HIT:41:355:379:541:800:960:967:973:988:989:1260:1263:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2525:2553:2560:2563:2682:2685:2859:2902:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4401:5007:6119:6261:7903:8599:9025:10004:10400:10848:10913:10967:11026:11232:11657:11658:11914:12043:12438:12517:12519:12555:12679:12740:12783:13069:13161:13229:13311:13357:13972:14093:14094:14394:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: mark39_5a601f567cd54 X-Filterd-Recvd-Size: 2701 Date: Fri, 27 Feb 2015 14:50:19 -0500 From: Steven Rostedt To: Linus Torvalds Cc: LKML , Andy Lutomirski , Thomas Gleixner , "Peter Zijlstra (Intel)" , Ingo Molnar Subject: [PATCH] x86: Init per-cpu shadow copy of CR4 for i386 too Message-ID: <20150227145019.2bdd4354@gandalf.local.home> In-Reply-To: References: <20150227125208.71c36402@gandalf.local.home> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 27 Feb 2015 10:59:52 -0800 Linus Torvalds wrote: > Presumably there is some initialization missing - I suspect that the > cached value of cr4 is from the *previous* time the CPU was up, and we > don't correctly initialize the cached copy at early CPU bringup. Found it. The problem is that there's two cpu_init()s in common.c. Andy only added the cr4 init to one of them. x86: Init per-cpu shadow copy of CR4 for i386 too The commit 1e02ce4cccdc "x86: Store a per-cpu shadow copy of CR4" added a shadow CR4 such that reads and writes that do not modify the CR4 execute much faster than always reading the register itself. The change modified cpu_init() in common.c, so that the shadow CR4 gets initialized before anything uses it. Unfortunately, there's two cpu_init()s in common.c. There's one for x86_64 and one for i386. The commit only added the shadow init to x86_64. The i386 needs the init too. Link: http://lkml.kernel.org/r/20150227125208.71c36402@gandalf.local.home Fixes: 1e02ce4cccdc "x86: Store a per-cpu shadow copy of CR4" Signed-off-by: Steven Rostedt --- diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index b5c8ff5e9dfc..2346c95c6ab1 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1396,6 +1396,12 @@ void cpu_init(void) wait_for_master_cpu(cpu); + /* + * Initialize the CR4 shadow before doing anything that could + * try to read it. + */ + cr4_init_shadow(); + show_ucode_info_early(); printk(KERN_INFO "Initializing CPU#%d\n", cpu);