Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030225AbbEES0r (ORCPT ); Tue, 5 May 2015 14:26:47 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:37389 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030691AbbEERxC (ORCPT ); Tue, 5 May 2015 13:53:02 -0400 From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Andy Lutomirski , Borislav Petkov , Dave Hansen , Fenghua Yu , "H. Peter Anvin" , Linus Torvalds , Oleg Nesterov , Thomas Gleixner Subject: [PATCH 112/208] x86/fpu: Move the fpstate_xstate_init_size() call into fpu__init_system() Date: Tue, 5 May 2015 19:50:04 +0200 Message-Id: <1430848300-27877-34-git-send-email-mingo@kernel.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1430848300-27877-1-git-send-email-mingo@kernel.org> References: <1430848300-27877-1-git-send-email-mingo@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2230 Lines: 71 The fpstate_xstate_init_size() function sets up a basic xstate_size, called during fpu__detect() currently. Its real dependency is to be called before fpu__init_system_xstate(). So move the function call site into fpu__init_system(), to right before the fpu__init_system_xstate() call. Also add a once-per-boot flag to fpstate_xstate_init_size(), we'll remove this quirk later once we've cleaned up the init dependencies. This moves the two related functions closer to each other and makes them both part of the _init_system() functionality. Currently we do the fpstate_xstate_init_size() Reviewed-by: Borislav Petkov Cc: Andy Lutomirski Cc: Dave Hansen Cc: Fenghua Yu Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Thomas Gleixner Signed-off-by: Ingo Molnar --- arch/x86/kernel/fpu/init.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c index 567e7e6cdc6b..ca3468d8bc31 100644 --- a/arch/x86/kernel/fpu/init.c +++ b/arch/x86/kernel/fpu/init.c @@ -96,6 +96,12 @@ static void mxcsr_feature_mask_init(void) static void fpstate_xstate_init_size(void) { + static bool on_boot_cpu = 1; + + if (!on_boot_cpu) + return; + on_boot_cpu = 0; + /* * Note that xstate_size might be overwriten later during * fpu__init_system_xstate(). @@ -227,7 +233,10 @@ void fpu__init_system(void) fx_finit(&init_xstate_ctx.i387); mxcsr_feature_mask_init(); + + fpstate_xstate_init_size(); fpu__init_system_xstate(); + fpu__init_system_ctx_switch(); fpu__init_cpu_ctx_switch(); } @@ -270,6 +279,4 @@ void fpu__detect(struct cpuinfo_x86 *c) clear_cpu_cap(c, X86_FEATURE_FPU); /* The final cr0 value is set later, in fpu_init() */ - - fpstate_xstate_init_size(); } -- 2.1.0 -- 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/