[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160115205035.GA32625@test-lenovo>
Date: Fri, 15 Jan 2016 12:50:35 -0800
From: Yu-cheng Yu <yu-cheng.yu@...el.com>
To: Borislav Petkov <bp@...en8.de>
Cc: linux-kernel@...r.kernel.org, peterz@...radead.org,
torvalds@...ux-foundation.org, tglx@...utronix.de, oleg@...hat.com,
ravi.v.shankar@...el.com, fenghua.yu@...el.com, mingo@...nel.org,
dave.hansen@...ux.intel.com, quentin.casasnovas@...cle.com,
bp@...e.de, hpa@...or.com, luto@...capital.net,
sai.praneeth.prakhya@...el.com, linux-tip-commits@...r.kernel.org
Subject: Re: [tip:x86/asm] x86/fpu: Fix early FPU command-line parsing
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
Powered by blists - more mailing lists