From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762889AbbEESaB (ORCPT ); Tue, 5 May 2015 14:30:01 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:33338 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030608AbbEERwq (ORCPT ); Tue, 5 May 2015 13:52:46 -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 102/208] x86/fpu: Propagate once per boot quirk into fpu__init_system_xstate() Date: Tue, 5 May 2015 19:49:54 +0200 Message-Id: <1430848300-27877-24-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 Linearize the call sequence in xsave_init(): fpu__init_system_xstate(); fpu__init_cpu_xstate(); We do this by propagating the boot-once quirk into fpu__init_system_xstate(). fpu__init_cpu_xstate() is safe to be called multiple time. 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 | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/fpu/xsave.c b/arch/x86/kernel/fpu/xsave.c index fd656cbdd315..9d5ff90916b1 100644 --- a/arch/x86/kernel/fpu/xsave.c +++ b/arch/x86/kernel/fpu/xsave.c @@ -652,6 +652,11 @@ static void __init init_xstate_size(void) void fpu__init_system_xstate(void) { unsigned int eax, ebx, ecx, edx; + static bool on_boot_cpu = 1; + + if (!on_boot_cpu) + return; + on_boot_cpu = 0; if (!cpu_has_xsave) { pr_info("x86/fpu: Legacy x87 FPU detected.\n"); @@ -714,14 +719,8 @@ void fpu__init_system_xstate(void) */ void xsave_init(void) { - static char on_boot_cpu = 1; - - if (on_boot_cpu) { - on_boot_cpu = 0; - fpu__init_system_xstate(); - } else { - fpu__init_cpu_xstate(); - } + fpu__init_system_xstate(); + fpu__init_cpu_xstate(); } /* -- 2.1.0