[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7fad52e6-83cf-4c17-9b3f-4dfa087f8fc4@zytor.com>
Date: Fri, 12 Jul 2024 10:40:48 -0700
From: Xin Li <xin@...or.com>
To: Nikolay Borisov <nik.borisov@...e.com>, linux-kernel@...r.kernel.org
Cc: hpa@...or.com, tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, x86@...nel.org, peterz@...radead.org,
andrew.cooper3@...rix.com, houwenlong.hwl@...group.com
Subject: Re: [PATCH v2 1/3] x86/fred: Parse cmdline param "fred=" in
cpu_parse_early_param()
On 7/10/2024 11:53 AM, Nikolay Borisov wrote:
> On 9.07.24 г. 18:40 ч., Xin Li (Intel) wrote:
>> @@ -1510,6 +1510,11 @@ static void __init cpu_parse_early_param(void)
>> if (cmdline_find_option_bool(boot_command_line, "nousershstk"))
>> setup_clear_cpu_cap(X86_FEATURE_USER_SHSTK);
>> + /* Minimize the gap between FRED is available and available but
>> disabled. */
>> + arglen = cmdline_find_option(boot_command_line, "fred", arg,
>> sizeof(arg));
>> + if (arglen != 2 || strncmp(arg, "on", 2))
>
> I'm confused why you keep perverting the calling convention of
> cmdline_find_option. The doc clearly states:
>
> * Returns the position of that @option (starts counting with 1)
> * or 0 on not found. @option will only be found if it is found
> * as an entire word in @cmdline. For instance, if @option="car"
> * then a cmdline which contains "cart" will not match.
>
> You should only care if arglen is non 0, which if it is you check if its
> value equal 'on', why bother with its starting position?
>
Well, just look at how it is used in match_option() in
arch/x86/kernel/cpu/bugs.c and arch/x86/kernel/cpu/intel.c.
This is a short version and it will be expanded once we have more
option strings well defined (match_option() should be a common lib
function then).
Powered by blists - more mailing lists