linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Song <liusong@linux.alibaba.com>
To: catalin.marinas@arm.com, will@kernel.org, james.morse@arm.com
Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64: spectre: increase parameters that can be used to turn off bhb mitigation individually
Date: Thu, 25 Aug 2022 23:25:00 +0800	[thread overview]
Message-ID: <6d6a7c14-ab8f-ef6f-8e9b-54732abaf3e3@linux.alibaba.com> (raw)
In-Reply-To: <1659691274-48554-1-git-send-email-liusong@linux.alibaba.com>

Hi,

Is there any potential problem with this modification? Looking forward 
to your reply.

Thanks

> From: Liu Song <liusong@linux.alibaba.com>
>
> In our environment, it was found that the mitigation BHB has a great
> impact on the benchmark performance. For example, in the lmbench test,
> the "process fork && exit" test performance drops by 20%.
> So it is necessary to have the ability to turn off the mitigation
> individually through cmdline, thus avoiding having to compile the
> kernel by adjusting the config.
>
> Signed-off-by: Liu Song <liusong@linux.alibaba.com>
> ---
>   arch/arm64/kernel/proton-pack.c | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c
> index 40be3a7..bd16903 100644
> --- a/arch/arm64/kernel/proton-pack.c
> +++ b/arch/arm64/kernel/proton-pack.c
> @@ -988,6 +988,14 @@ static void this_cpu_set_vectors(enum arm64_bp_harden_el1_vectors slot)
>   	isb();
>   }
>   
> +static bool __read_mostly __nospectre_bhb;
> +static int __init parse_spectre_bhb_param(char *str)
> +{
> +	__nospectre_bhb = true;
> +	return 0;
> +}
> +early_param("nospectre_bhb", parse_spectre_bhb_param);
> +
>   void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *entry)
>   {
>   	bp_hardening_cb_t cpu_cb;
> @@ -1001,7 +1009,7 @@ void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *entry)
>   		/* No point mitigating Spectre-BHB alone. */
>   	} else if (!IS_ENABLED(CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY)) {
>   		pr_info_once("spectre-bhb mitigation disabled by compile time option\n");
> -	} else if (cpu_mitigations_off()) {
> +	} else if (cpu_mitigations_off() || __nospectre_bhb) {
>   		pr_info_once("spectre-bhb mitigation disabled by command line option\n");
>   	} else if (supports_ecbhb(SCOPE_LOCAL_CPU)) {
>   		state = SPECTRE_MITIGATED;

  reply	other threads:[~2022-08-25 15:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05  9:21 [PATCH] arm64: spectre: increase parameters that can be used to turn off bhb mitigation individually Liu Song
2022-08-25 15:25 ` Liu Song [this message]
2022-08-26 10:39 ` Will Deacon
2022-08-26 11:08   ` Liu Song
2022-08-26 12:44     ` [PATCH v2] " Liu Song

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=6d6a7c14-ab8f-ef6f-8e9b-54732abaf3e3@linux.alibaba.com \
    --to=liusong@linux.alibaba.com \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will@kernel.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 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).