From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756677AbbEEScb (ORCPT ); Tue, 5 May 2015 14:32:31 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:36361 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030550AbbEERwg (ORCPT ); Tue, 5 May 2015 13:52:36 -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 096/208] x86/fpu: Make setup_init_fpu_buf() run-once explicitly Date: Tue, 5 May 2015 19:49:48 +0200 Message-Id: <1430848300-27877-18-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 Remove the dependency on the init_xstate_buf == NULL check to implement once-per-bootup logic in eager_fpu_init(), by making setup_init_fpu_buf() run once per bootup explicitly. This is in preparation to make init_xstate_buf statically allocated. The various boot-once quirks in the FPU init code will be removed in a later cleanup stage. 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/xsave.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/fpu/xsave.c b/arch/x86/kernel/fpu/xsave.c index adeab16655ae..d11b33514130 100644 --- a/arch/x86/kernel/fpu/xsave.c +++ b/arch/x86/kernel/fpu/xsave.c @@ -565,8 +565,14 @@ void setup_xstate_comp(void) /* * setup the xstate image representing the init state */ -static void __init setup_init_fpu_buf(void) +static void setup_init_fpu_buf(void) { + static int on_boot_cpu = 1; + + if (!on_boot_cpu) + return; + on_boot_cpu = 0; + /* * Setup init_xstate_buf to represent the init state of * all the features managed by the xsave @@ -738,8 +744,7 @@ void __init_refok eager_fpu_init(void) return; } - if (!init_xstate_buf) - setup_init_fpu_buf(); + setup_init_fpu_buf(); } /* -- 2.1.0