From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752590AbcAOUv4 (ORCPT ); Fri, 15 Jan 2016 15:51:56 -0500 Received: from mga09.intel.com ([134.134.136.24]:53785 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750780AbcAOUvz (ORCPT ); Fri, 15 Jan 2016 15:51:55 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,301,1449561600"; d="scan'208";a="30120161" Date: Fri, 15 Jan 2016 12:50:35 -0800 From: Yu-cheng Yu To: Borislav Petkov Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, torvalds@linux-foundation.org, tglx@linutronix.de, oleg@redhat.com, ravi.v.shankar@intel.com, fenghua.yu@intel.com, mingo@kernel.org, dave.hansen@linux.intel.com, quentin.casasnovas@oracle.com, bp@suse.de, hpa@zytor.com, luto@amacapital.net, sai.praneeth.prakhya@intel.com, linux-tip-commits@vger.kernel.org Subject: Re: [tip:x86/asm] x86/fpu: Fix early FPU command-line parsing Message-ID: <20160115205035.GA32625@test-lenovo> References: <1452119094-7252-2-git-send-email-yu-cheng.yu@intel.com> <20160115202858.GK25104@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160115202858.GK25104@pd.tnic> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 15, 2016 at 09:28:58PM +0100, Borislav Petkov wrote: > > +static void __init fpu__init_parse_early_param(void) > > +{ > > + /* > > + * No need to check "eagerfpu=auto" again, since it is the > > + * initial default. > > + */ > > + if (cmdline_find_option_bool(boot_command_line, "eagerfpu=off")) > > + eagerfpu = DISABLE; > > + else if (cmdline_find_option_bool(boot_command_line, "eagerfpu=on")) > > + eagerfpu = ENABLE; > > + > > + if (cmdline_find_option_bool(boot_command_line, "no387")) > > + setup_clear_cpu_cap(X86_FEATURE_FPU); > > + > > + if (cmdline_find_option_bool(boot_command_line, "nofxsr")) { > > + setup_clear_cpu_cap(X86_FEATURE_FXSR); > > + setup_clear_cpu_cap(X86_FEATURE_FXSR_OPT); > > + setup_clear_cpu_cap(X86_FEATURE_XMM); > > + } > > + > > + if (cmdline_find_option_bool(boot_command_line, "noxsave")) > > + fpu__xstate_clear_all_cpu_caps(); > > + > > + if (cmdline_find_option_bool(boot_command_line, "noxsaveopt")) > > + setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT); > > + > > + if (cmdline_find_option_bool(boot_command_line, "noxsaves")) > > + setup_clear_cpu_cap(X86_FEATURE_XSAVES); > > This could certainly be improved: we're iterating over the *whole* > command line each time for each option unconditionally instead of > iterating word by word and comparing it with all strings. > > We'd need something like cmdline_for_each_word() or so, though... > That is a good point. I will work on it. Thanks, Yu-cheng