From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932640AbbEEQ35 (ORCPT ); Tue, 5 May 2015 12:29:57 -0400 Received: from mail-wg0-f51.google.com ([74.125.82.51]:33819 "EHLO mail-wg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761205AbbEEQ3p (ORCPT ); Tue, 5 May 2015 12:29:45 -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 075/208] x86/fpu: Remove xsave_init() __init obfuscation Date: Tue, 5 May 2015 18:24:55 +0200 Message-Id: <1430843228-13749-76-git-send-email-mingo@kernel.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1430843228-13749-1-git-send-email-mingo@kernel.org> References: <1430843228-13749-1-git-send-email-mingo@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org So this code surprised me - and being surprised when reading FPU code does not help maintainability of an already overly complex subsystem. Remove the obfuscation and just don't use __init annotation for now. Anyone who wants to free these ~600 bytes of xstate_enable_boot_cpu() should implement it cleanly. 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 | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/fpu/xsave.c b/arch/x86/kernel/fpu/xsave.c index 4ff726e4e29b..6c1cbb2487fe 100644 --- a/arch/x86/kernel/fpu/xsave.c +++ b/arch/x86/kernel/fpu/xsave.c @@ -606,8 +606,11 @@ static void __init init_xstate_size(void) /* * Enable and initialize the xsave feature. + * + * ( Not marked __init because of false positive section warnings + * generated by xsave_init(). ) */ -static void __init xstate_enable_boot_cpu(void) +static void /* __init */ xstate_enable_boot_cpu(void) { unsigned int eax, ebx, ecx, edx; @@ -663,21 +666,20 @@ static void __init xstate_enable_boot_cpu(void) /* * For the very first instance, this calls xstate_enable_boot_cpu(); * for all subsequent instances, this calls xstate_enable(). - * - * This is somewhat obfuscated due to the lack of powerful enough - * overrides for the section checks. */ void xsave_init(void) { - static __refdata void (*next_func)(void) = xstate_enable_boot_cpu; - void (*this_func)(void); + static char on_boot_cpu = 1; if (!cpu_has_xsave) return; - this_func = next_func; - next_func = xstate_enable; - this_func(); + if (on_boot_cpu) { + on_boot_cpu = 0; + xstate_enable_boot_cpu(); + } else { + xstate_enable(); + } } /* -- 2.1.0