All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Stephen Rothwell <sfr@canb.auug.org.au>,
	Sean Christopherson <seanjc@google.com>
Cc: Jonathan Corbet <corbet@lwn.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, Peter Zijlstra <peterz@infradead.org>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
	Daniel Sneddon <daniel.sneddon@linux.intel.com>,
	linuxppc-dev@lists.ozlabs.org, linux-arch@vger.kernel.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Heiko Carstens <hca@linux.ibm.com>
Subject: Re: [PATCH 1/3] x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n
Date: Sat, 13 Apr 2024 19:27:36 +1000	[thread overview]
Message-ID: <87edb9d33r.fsf@mail.lhotse> (raw)
In-Reply-To: <20240413115324.53303a68@canb.auug.org.au>

Stephen Rothwell <sfr@canb.auug.org.au> writes:
> Hi Sean,
>
> I noticed this commit in linux-next.
>
> On Tue,  9 Apr 2024 10:51:05 -0700 Sean Christopherson <seanjc@google.com> wrote:
>>
>> Initialize cpu_mitigations to CPU_MITIGATIONS_OFF if the kernel is built
>> with CONFIG_SPECULATION_MITIGATIONS=n, as the help text quite clearly
>> states that disabling SPECULATION_MITIGATIONS is supposed to turn off all
>> mitigations by default.
>> 
>>   │ If you say N, all mitigations will be disabled. You really
>>   │ should know what you are doing to say so.
>> 
>> As is, the kernel still defaults to CPU_MITIGATIONS_AUTO, which results in
>> some mitigations being enabled in spite of SPECULATION_MITIGATIONS=n.
>> 
>> Fixes: f43b9876e857 ("x86/retbleed: Add fine grained Kconfig knobs")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Sean Christopherson <seanjc@google.com>
>> ---
>>  kernel/cpu.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/kernel/cpu.c b/kernel/cpu.c
>> index 8f6affd051f7..07ad53b7f119 100644
>> --- a/kernel/cpu.c
>> +++ b/kernel/cpu.c
>> @@ -3207,7 +3207,8 @@ enum cpu_mitigations {
>>  };
>>  
>>  static enum cpu_mitigations cpu_mitigations __ro_after_init =
>> -	CPU_MITIGATIONS_AUTO;
>> +	IS_ENABLED(CONFIG_SPECULATION_MITIGATIONS) ? CPU_MITIGATIONS_AUTO :
>> +						     CPU_MITIGATIONS_OFF;
>>  
>>  static int __init mitigations_parse_cmdline(char *arg)
>>  {
>> -- 
>> 2.44.0.478.gd926399ef9-goog
>> 
>
> I noticed because it turned off all mitigations for my PowerPC qemu
> boot tests - probably because CONFIG_SPECULATION_MITIGATIONS only
> exists in arch/x86/Kconfig ... thus for other architectures that have
> cpu mitigations, this will always default them to off, right?

Yep.

The patch has the effect of changing the default for non-x86 arches from
auto to off.

I see at least powerpc, arm64 and s390 use cpu_mitigations_off() and
will be affected.

cheers

WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au>
To: Stephen Rothwell <sfr@canb.auug.org.au>,
	Sean Christopherson <seanjc@google.com>
Cc: linux-arch@vger.kernel.org, x86@kernel.org,
	Will Deacon <will@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
	Peter Zijlstra <peterz@infradead.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linuxppc-dev@lists.ozlabs.org,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Daniel Sneddon <daniel.sneddon@linux.intel.com>
Subject: Re: [PATCH 1/3] x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n
Date: Sat, 13 Apr 2024 19:27:36 +1000	[thread overview]
Message-ID: <87edb9d33r.fsf@mail.lhotse> (raw)
In-Reply-To: <20240413115324.53303a68@canb.auug.org.au>

Stephen Rothwell <sfr@canb.auug.org.au> writes:
> Hi Sean,
>
> I noticed this commit in linux-next.
>
> On Tue,  9 Apr 2024 10:51:05 -0700 Sean Christopherson <seanjc@google.com> wrote:
>>
>> Initialize cpu_mitigations to CPU_MITIGATIONS_OFF if the kernel is built
>> with CONFIG_SPECULATION_MITIGATIONS=n, as the help text quite clearly
>> states that disabling SPECULATION_MITIGATIONS is supposed to turn off all
>> mitigations by default.
>> 
>>   │ If you say N, all mitigations will be disabled. You really
>>   │ should know what you are doing to say so.
>> 
>> As is, the kernel still defaults to CPU_MITIGATIONS_AUTO, which results in
>> some mitigations being enabled in spite of SPECULATION_MITIGATIONS=n.
>> 
>> Fixes: f43b9876e857 ("x86/retbleed: Add fine grained Kconfig knobs")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Sean Christopherson <seanjc@google.com>
>> ---
>>  kernel/cpu.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/kernel/cpu.c b/kernel/cpu.c
>> index 8f6affd051f7..07ad53b7f119 100644
>> --- a/kernel/cpu.c
>> +++ b/kernel/cpu.c
>> @@ -3207,7 +3207,8 @@ enum cpu_mitigations {
>>  };
>>  
>>  static enum cpu_mitigations cpu_mitigations __ro_after_init =
>> -	CPU_MITIGATIONS_AUTO;
>> +	IS_ENABLED(CONFIG_SPECULATION_MITIGATIONS) ? CPU_MITIGATIONS_AUTO :
>> +						     CPU_MITIGATIONS_OFF;
>>  
>>  static int __init mitigations_parse_cmdline(char *arg)
>>  {
>> -- 
>> 2.44.0.478.gd926399ef9-goog
>> 
>
> I noticed because it turned off all mitigations for my PowerPC qemu
> boot tests - probably because CONFIG_SPECULATION_MITIGATIONS only
> exists in arch/x86/Kconfig ... thus for other architectures that have
> cpu mitigations, this will always default them to off, right?

Yep.

The patch has the effect of changing the default for non-x86 arches from
auto to off.

I see at least powerpc, arm64 and s390 use cpu_mitigations_off() and
will be affected.

cheers

  reply	other threads:[~2024-04-13  9:27 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-09 17:51 [PATCH 0/3] x86/cpu: Fix SPECULATIVE_MITIGATION=n kernels Sean Christopherson
2024-04-09 17:51 ` [PATCH 1/3] x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n Sean Christopherson
2024-04-10 14:31   ` [tip: x86/urgent] " tip-bot2 for Sean Christopherson
2024-04-13  1:53   ` [PATCH 1/3] " Stephen Rothwell
2024-04-13  1:53     ` Stephen Rothwell
2024-04-13  9:27     ` Michael Ellerman [this message]
2024-04-13  9:27       ` Michael Ellerman
2024-04-13  9:38       ` Michael Ellerman
2024-04-13  9:38         ` Michael Ellerman
2024-04-14 22:42         ` Stephen Rothwell
2024-04-14 22:42           ` Stephen Rothwell
2024-04-15 11:16         ` Geert Uytterhoeven
2024-04-15 11:16           ` Geert Uytterhoeven
2024-04-15 14:31           ` Sean Christopherson
2024-04-15 14:31             ` Sean Christopherson
2024-04-16 11:06             ` Michael Ellerman
2024-04-16 11:06               ` Michael Ellerman
2024-04-19 14:03             ` Will Deacon
2024-04-19 14:03               ` Will Deacon
2024-04-19 14:06               ` Sean Christopherson
2024-04-19 14:06                 ` Sean Christopherson
2024-04-19 14:38                 ` Will Deacon
2024-04-19 14:38                   ` Will Deacon
2024-04-15 11:13   ` Geert Uytterhoeven
2024-04-15 11:13     ` Geert Uytterhoeven
2024-04-09 17:51 ` [PATCH 2/3] x86/cpu: Disable BHI mitigation by default when SPECULATION_MITIGATIONS=n Sean Christopherson
2024-04-10 14:31   ` [tip: x86/urgent] " tip-bot2 for Sean Christopherson
2024-04-09 17:51 ` [PATCH 3/3] x86/cpu: Ignore "mitigations" kernel parameter if SPECULATION_MITIGATIONS=n Sean Christopherson
2024-04-10 14:18   ` Ingo Molnar
2024-04-09 18:55 ` [PATCH 0/3] x86/cpu: Fix SPECULATIVE_MITIGATION=n kernels Daniel Sneddon

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=87edb9d33r.fsf@mail.lhotse \
    --to=mpe@ellerman.id.au \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=corbet@lwn.net \
    --cc=daniel.sneddon@linux.intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hca@linux.ibm.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mingo@redhat.com \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=peterz@infradead.org \
    --cc=seanjc@google.com \
    --cc=sfr@canb.auug.org.au \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    --cc=x86@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 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.