From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754851AbbCPMpm (ORCPT ); Mon, 16 Mar 2015 08:45:42 -0400 Received: from cantor2.suse.de ([195.135.220.15]:50370 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753390AbbCPMpj (ORCPT ); Mon, 16 Mar 2015 08:45:39 -0400 Date: Mon, 16 Mar 2015 13:44:05 +0100 From: Borislav Petkov To: Oleg Nesterov Cc: Dave Hansen , Ingo Molnar , Andy Lutomirski , Linus Torvalds , Pekka Riikonen , Rik van Riel , Suresh Siddha , LKML , "Yu, Fenghua" , Quentin Casasnovas Subject: Re: [PATCH 1/1] x86/cpu: kill eager_fpu_init_bp() Message-ID: <20150316124405.GF22995@pd.tnic> References: <54F74F59.5070107@intel.com> <20150313182656.GA8249@redhat.com> <20150314111648.GD3114@pd.tnic> <20150314151308.GB13029@redhat.com> <20150314151334.GC13029@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20150314151334.GC13029@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 14, 2015 at 04:13:34PM +0100, Oleg Nesterov wrote: > Now that eager_fpu_init_bp() does setup_init_fpu_buf() and nothing else > we can remove it and move this code into its "caller", eager_fpu_init(). > > This avoids the confusing games with "static __refdata void (*boot_func)". > init_xstate_buf can be NULL only on boot, so it is safe to the "__init" > setup_init_fpu_buf() function, just we need to add the "__init_refok" > marker. > > Signed-off-by: Oleg Nesterov Applied, thanks. I added a note above eager_fpu_init() why it is marked as __init_refok: --- From: Oleg Nesterov Date: Sat, 14 Mar 2015 16:13:34 +0100 Subject: [PATCH] x86/fpu: Kill eager_fpu_init_bp() Now that eager_fpu_init_bp() does setup_init_fpu_buf() only and nothing else, we can remove it and move this code into its "caller", eager_fpu_init(). This avoids the confusing games with "static __refdata void (*boot_func)": init_xstate_buf can be NULL only during boot, so it is safe to call the __init-annotated setup_init_fpu_buf() function in eager_fpu_init(), we just need to mark it as __init_refok. Signed-off-by: Oleg Nesterov Cc: Dave Hansen Cc: Ingo Molnar Cc: Andy Lutomirski Cc: Linus Torvalds Cc: Pekka Riikonen Cc: Rik van Riel Cc: Suresh Siddha Cc: Fenghua Yu Cc: Quentin Casasnovas Link: http://lkml.kernel.org/r/20150314151334.GC13029@redhat.com Signed-off-by: --- arch/x86/kernel/xsave.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c index ada8df7b89c0..87a815b85f3e 100644 --- a/arch/x86/kernel/xsave.c +++ b/arch/x86/kernel/xsave.c @@ -678,16 +678,12 @@ void xsave_init(void) this_func(); } -static inline void __init eager_fpu_init_bp(void) -{ - if (!init_xstate_buf) - setup_init_fpu_buf(); -} - -void eager_fpu_init(void) +/* + * setup_init_fpu_buf() is __init and it is OK to call it here because + * init_xstate_buf will be unset only once during boot. + */ +void __init_refok eager_fpu_init(void) { - static __refdata void (*boot_func)(void) = eager_fpu_init_bp; - WARN_ON(used_math()); current_thread_info()->status = 0; @@ -699,10 +695,8 @@ void eager_fpu_init(void) return; } - if (boot_func) { - boot_func(); - boot_func = NULL; - } + if (!init_xstate_buf) + setup_init_fpu_buf(); } /* -- 2.3.3 -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --