From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
George Dunlap <george.dunlap@citrix.com>,
Julien Grall <julien@xen.org>,
Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v3 3/4] x86/spec: fix INDIRECT_THUNK option to only be set when build-enabled
Date: Tue, 27 Feb 2024 12:18:40 +0100 [thread overview]
Message-ID: <Zd3FEA_tt4GJexSC@macbook> (raw)
In-Reply-To: <81e32609-37cd-4c2d-ae27-6caafc7dab33@suse.com>
On Mon, Feb 26, 2024 at 01:50:46PM +0100, Jan Beulich wrote:
> On 26.02.2024 12:07, Roger Pau Monne wrote:
> > Attempt to provide a more helpful error message when the user attempts to set
> > spec-ctrl=bti-thunk option but the support is build-time disabled.
> >
> > While there also adjust the command line documentation to mention
> > CONFIG_INDIRECT_THUNK instead of INDIRECT_THUNK.
> >
> > Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> with one minor remark:
>
> > --- a/xen/arch/x86/spec_ctrl.c
> > +++ b/xen/arch/x86/spec_ctrl.c
> > @@ -241,7 +241,12 @@ static int __init cf_check parse_spec_ctrl(const char *s)
> > {
> > s += 10;
> >
> > - if ( !cmdline_strcmp(s, "retpoline") )
> > + if ( !IS_ENABLED(CONFIG_INDIRECT_THUNK) )
> > + {
> > + no_config_param("INDIRECT_THUNK", "spec-ctrl=bti-thunk", s, ss);
> > + rc = -EINVAL;
> > + }
> > + else if ( !cmdline_strcmp(s, "retpoline") )
> > opt_thunk = THUNK_RETPOLINE;
> > else if ( !cmdline_strcmp(s, "lfence") )
> > opt_thunk = THUNK_LFENCE;
>
> How about
>
> if ( !IS_ENABLED(CONFIG_INDIRECT_THUNK) )
> {
> no_config_param("INDIRECT_THUNK", "spec-ctrl", s - 10, ss);
> rc = -EINVAL;
> }
> else if ( !cmdline_strcmp(s, "retpoline") )
>
> or (likely less liked by you and Andrew) "s += 10;" dropped and then
>
> if ( !IS_ENABLED(CONFIG_INDIRECT_THUNK) )
> {
> no_config_param("INDIRECT_THUNK", "spec-ctrl", s, ss);
> rc = -EINVAL;
> }
> else if ( !cmdline_strcmp(s += 10, "retpoline") )
>
> conserving a little on string literal space (sadly, despite the function
> being __init, string literals remain post-init due to living in .rodata)?
TBH I'm not overly worried about those 10 extra characters, but if I
had to choose I prefer the first option (so `s - 10`).
Thanks, Roger.
next prev parent reply other threads:[~2024-02-27 11:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-26 11:07 [PATCH v3 0/4] x86/spec: improve command line parsing Roger Pau Monne
2024-02-26 11:07 ` [PATCH v3 1/4] x86/spec: print the built-in SPECULATIVE_HARDEN_* options Roger Pau Monne
2024-02-26 12:39 ` Jan Beulich
2024-02-27 11:13 ` Roger Pau Monné
2024-02-26 11:07 ` [PATCH v3 2/4] x86/spec: fix BRANCH_HARDEN option to only be set when build-enabled Roger Pau Monne
2024-02-26 12:42 ` Jan Beulich
2024-02-26 11:07 ` [PATCH v3 3/4] x86/spec: fix INDIRECT_THUNK " Roger Pau Monne
2024-02-26 12:50 ` Jan Beulich
2024-02-27 11:18 ` Roger Pau Monné [this message]
2024-02-26 11:07 ` [PATCH v3 4/4] x86/spec: do not print thunk option selection if not built-in Roger Pau Monne
2024-02-26 12:54 ` Jan Beulich
2024-02-27 11:20 ` Roger Pau Monné
2024-02-27 13:23 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zd3FEA_tt4GJexSC@macbook \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.