historical-speck.lore.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: speck@linutronix.de
Subject: [MODERATED] Re: [PATCH] NX build fixup
Date: Fri, 1 Nov 2019 11:31:50 -0500	[thread overview]
Message-ID: <20191101163150.z7qlfwp6vai3ttp5@treble> (raw)
In-Reply-To: <20191101154157.GA24333@sec>

On Fri, Nov 01, 2019 at 03:43:31PM +0000, speck for Tyler Hicks wrote:
> From: Tyler Hicks <tyhicks@canonical.com>
> Subject: [PATCH] cpu/speculation: Uninline and export CPU mitigations helpers
> 
> A kernel module may need to check the value of the "mitigations=" kernel
> command line parameter as part of its setup when the module needs
> to perform software mitigations for a CPU flaw. Uninline and export the
> helper functions surrounding the cpu_mitigations enum to allow for their
> usage from a module.
> 
> Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
> ---
> 
> Only compile tested, with both CONFIG_KVM=y and CONFIG_KVM=m. Paolo, if
> this looks good to you and Pawan, please include it in NX v9.
> 
>  include/linux/cpu.h | 13 ++-----------
>  kernel/cpu.c        | 14 ++++++++++++++
>  2 files changed, 16 insertions(+), 11 deletions(-)
> 
> diff --git a/include/linux/cpu.h b/include/linux/cpu.h
> index 2a093434e975..f1965255526a 100644
> --- a/include/linux/cpu.h
> +++ b/include/linux/cpu.h
> @@ -230,16 +230,7 @@ enum cpu_mitigations {
>  
>  extern enum cpu_mitigations cpu_mitigations;
>  
> -/* mitigations=off */
> -static inline bool cpu_mitigations_off(void)
> -{
> -	return cpu_mitigations == CPU_MITIGATIONS_OFF;
> -}
> -
> -/* mitigations=auto,nosmt */
> -static inline bool cpu_mitigations_auto_nosmt(void)
> -{
> -	return cpu_mitigations == CPU_MITIGATIONS_AUTO_NOSMT;
> -}
> +extern bool cpu_mitigations_off(void);
> +extern bool cpu_mitigations_auto_nosmt(void);

You could probably also remove the "extern enum cpu_mitigations
cpu_mitigations" and just make it a static variable in kernel/cpu.c.

Same with the enum itself, it could be made private.

Or, as a completely different approach, cpu_mitigations could be
exported.  Then it's just a one-liner patch.  Either way works for me...

-- 
Josh

  reply	other threads:[~2019-11-01 16:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-31 23:33 [MODERATED] [PATCH v8 0/5] NX 0 Paolo Bonzini
2019-10-31 23:33 ` [MODERATED] [PATCH v8 1/5] NX 1 Paolo Bonzini
2019-10-31 23:33 ` [MODERATED] [PATCH v8 2/5] NX 2 Paolo Bonzini
2019-10-31 23:33 ` [MODERATED] [PATCH v8 3/5] NX 3 Paolo Bonzini
2019-11-01  0:24   ` [MODERATED] " Pawan Gupta
2019-11-01  7:07     ` Paolo Bonzini
2019-11-01 18:38       ` mark gross
2019-11-01 18:51         ` Tyler Hicks
2019-11-01 20:36           ` mark gross
2019-11-02  7:36             ` Paolo Bonzini
2019-11-01 14:58     ` Tyler Hicks
2019-11-01 15:43       ` [MODERATED] [PATCH] NX build fixup Tyler Hicks
2019-11-01 16:31         ` Josh Poimboeuf [this message]
2019-11-01 20:39           ` [MODERATED] [PATCH v2] " Tyler Hicks
2019-11-01 21:14             ` [MODERATED] " Josh Poimboeuf
2019-11-01 21:38             ` [MODERATED] Re: [PATCH v2] NX mitigations=off fix Pawan Gupta
2019-10-31 23:33 ` [MODERATED] [PATCH v8 4/5] NX 4 Paolo Bonzini
2019-10-31 23:33 ` [MODERATED] [PATCH v8 5/5] NX 5 Paolo Bonzini

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=20191101163150.z7qlfwp6vai3ttp5@treble \
    --to=jpoimboe@redhat.com \
    --cc=speck@linutronix.de \
    --subject='[MODERATED] Re: [PATCH] NX build fixup' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).