From: Joel Fernandes <joel@joelfernandes.org>
To: Alexander Graf <graf@amazon.com>
Cc: "Nishanth Aravamudan" <naravamudan@digitalocean.com>,
"Julien Desfossez" <jdesfossez@digitalocean.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Tim Chen" <tim.c.chen@linux.intel.com>,
"Vineeth Pillai" <viremana@linux.microsoft.com>,
"Aaron Lu" <aaron.lwe@gmail.com>,
"Aubrey Li" <aubrey.intel@gmail.com>,
"Thomas Glexiner" <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>,
"Ingo Molnar" <mingo@kernel.org>,
"Linus Torvalds" <torvalds@linux-foundation.org>,
"Frederic Weisbecker" <fweisbec@gmail.com>,
"Kees Cook" <keescook@chromium.org>,
"Greg Kerr" <kerrnel@google.com>, "Phil Auld" <pauld@redhat.com>,
"Valentin Schneider" <valentin.schneider@arm.com>,
"Mel Gorman" <mgorman@techsingularity.net>,
"Pawan Gupta" <pawan.kumar.gupta@linux.intel.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
vineeth@bitbyteword.org, "Chen Yu" <yu.c.chen@intel.com>,
"Christian Brauner" <christian.brauner@ubuntu.com>,
"Agata Gruza" <agata.gruza@intel.com>,
"Antonio Gomez Iglesias" <antonio.gomez.iglesias@intel.com>,
konrad.wilk@oracle.com, "Dario Faggioli" <dfaggioli@suse.com>,
"Paul Turner" <pjt@google.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Patrick Bellasi" <derkling@google.com>,
"benbjiang(蒋彪)" <benbjiang@tencent.com>,
"Alexandre Chartre" <alexandre.chartre@oracle.com>,
James.Bottomley@hansenpartnership.com, OWeisse@umich.edu,
"Dhaval Giani" <dhaval.giani@oracle.com>,
"Junaid Shahid" <junaids@google.com>,
"Jesse Barnes" <jsbarnes@google.com>,
"Hyser,Chris" <chris.hyser@oracle.com>,
"Ben Segall" <bsegall@google.com>,
"Josh Don" <joshdon@google.com>, "Hao Luo" <haoluo@google.com>,
"Anand K. Mistry" <amistry@google.com>,
"Borislav Petkov" <bp@alien8.de>,
"Daniel Bristot de Oliveira" <bristot@redhat.com>,
"Dietmar Eggemann" <dietmar.eggemann@arm.com>,
"H. Peter Anvin" <hpa@zytor.com>,
"Ingo Molnar" <mingo@redhat.com>,
"Juri Lelli" <juri.lelli@redhat.com>,
"Mel Gorman" <mgorman@suse.de>, "Mike Rapoport" <rppt@kernel.org>,
"Tom Lendacky" <thomas.lendacky@amd.com>,
"Tony Luck" <tony.luck@intel.com>,
"Vincent Guittot" <vincent.guittot@linaro.org>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<x86@kernel.org>
Subject: Re: [RFC 1/2] x86/bugs: Disable coresched on hardware that does not need it
Date: Thu, 12 Nov 2020 08:40:05 -0500 [thread overview]
Message-ID: <20201112134005.GA1549282@google.com> (raw)
In-Reply-To: <76aa80c6-b797-f776-90fc-ef4585c41262@amazon.com>
On Wed, Nov 11, 2020 at 11:29:37PM +0100, Alexander Graf wrote:
>
>
> On 11.11.20 23:15, Joel Fernandes wrote:
> >
> > On Wed, Nov 11, 2020 at 5:13 PM Joel Fernandes <joel@joelfernandes.org> wrote:
> > >
> > > On Wed, Nov 11, 2020 at 5:00 PM Alexander Graf <graf@amazon.com> wrote:
> > > > On 11.11.20 22:14, Joel Fernandes wrote:
> > > > > > Some hardware such as certain AMD variants don't have cross-HT MDS/L1TF
> > > > > > issues. Detect this and don't enable core scheduling as it can
> > > > > > needlessly slow the device done.
> > > > > >
> > > > > > diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> > > > > > index dece79e4d1e9..0e6e61e49b23 100644
> > > > > > --- a/arch/x86/kernel/cpu/bugs.c
> > > > > > +++ b/arch/x86/kernel/cpu/bugs.c
> > > > > > @@ -152,6 +152,14 @@ void __init check_bugs(void)
> > > > > > #endif
> > > > > > }
> > > > > >
> > > > > > +/*
> > > > > > + * Do not need core scheduling if CPU does not have MDS/L1TF vulnerability.
> > > > > > + */
> > > > > > +int arch_allow_core_sched(void)
> > > > > > +{
> > > > > > + return boot_cpu_has_bug(X86_BUG_MDS) || boot_cpu_has_bug(X86_BUG_L1TF);
> > > >
> > > > Can we make this more generic and user settable, similar to the L1 cache
> > > > flushing modes in KVM?
> > > >
> > > > I am not 100% convinced that there are no other thread sibling attacks
> > > > possible without MDS and L1TF. If I'm paranoid, I want to still be able
> > > > to force enable core scheduling.
> > > >
> > > > In addition, we are also using core scheduling as a poor man's mechanism
> > > > to give customers consistent performance for virtual machine thread
> > > > siblings. This is important irrespective of CPU bugs. In such a
> > > > scenario, I want to force enable core scheduling.
> > >
> > > Ok, I can make it new kernel command line option with:
> > > coresched=on
> > > coresched=secure (only if HW has MDS/L1TF)
> > > coresched=off
> >
> > Also, I would keep "secure" as the default. (And probably, we should
> > modify the informational messages in sysfs to reflect this..)
>
> I agree that "secure" should be the default.
Ok.
> Can we also integrate into the "mitigations" kernel command line[1] for this?
Sure, the integration into [1] sounds conceptually fine to me however it is
not super straight forward. Like: What if user wants to force-enable
core-scheduling for the usecase you mention, but still wants the cross-HT
mitigation because they are only tagging VMs (as in your usecase) and not
other tasks. Idk.
The best thing to do could be to keep the "auto disable HT" controls and
logic separate from the "coresched=on" logic and let the user choose. The
exception being, coresched=secure means that on HW that does not have
vulnerability, we will not activate the core scheduling.
thanks,
- Joel
> Alex
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/kernel-parameters.txt#n2839
>
>
>
> Amazon Development Center Germany GmbH
> Krausenstr. 38
> 10117 Berlin
> Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
> Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
> Sitz: Berlin
> Ust-ID: DE 289 237 879
>
>
next prev parent reply other threads:[~2020-11-12 13:40 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-11 21:10 [RFC 0/2] Do not slow down some AMD devices with coresched Joel Fernandes (Google)
2020-11-11 21:10 ` [RFC 1/2] x86/bugs: Disable coresched on hardware that does not need it Joel Fernandes (Google)
2020-11-11 21:14 ` Joel Fernandes
2020-11-11 22:00 ` Alexander Graf
2020-11-11 22:13 ` Joel Fernandes
2020-11-11 22:15 ` Joel Fernandes
2020-11-11 22:29 ` Alexander Graf
2020-11-12 13:40 ` Joel Fernandes [this message]
2020-11-12 14:40 ` Joel Fernandes
2020-11-12 20:09 ` Alexander Graf
2020-11-13 15:55 ` Joel Fernandes
2020-11-16 15:37 ` Alexander Graf
2020-11-12 14:52 ` Alexander Graf
2020-11-12 15:28 ` Joel Fernandes
2020-11-12 20:01 ` Alexander Graf
2020-11-11 21:10 ` [RFC 2/2] sched/debug: Add debug information about whether coresched is enabled Joel Fernandes (Google)
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=20201112134005.GA1549282@google.com \
--to=joel@joelfernandes.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=OWeisse@umich.edu \
--cc=aaron.lwe@gmail.com \
--cc=agata.gruza@intel.com \
--cc=alexandre.chartre@oracle.com \
--cc=amistry@google.com \
--cc=antonio.gomez.iglesias@intel.com \
--cc=aubrey.intel@gmail.com \
--cc=benbjiang@tencent.com \
--cc=bp@alien8.de \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=chris.hyser@oracle.com \
--cc=christian.brauner@ubuntu.com \
--cc=derkling@google.com \
--cc=dfaggioli@suse.com \
--cc=dhaval.giani@oracle.com \
--cc=dietmar.eggemann@arm.com \
--cc=fweisbec@gmail.com \
--cc=graf@amazon.com \
--cc=haoluo@google.com \
--cc=hpa@zytor.com \
--cc=jdesfossez@digitalocean.com \
--cc=joshdon@google.com \
--cc=jsbarnes@google.com \
--cc=junaids@google.com \
--cc=juri.lelli@redhat.com \
--cc=keescook@chromium.org \
--cc=kerrnel@google.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mgorman@techsingularity.net \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=naravamudan@digitalocean.com \
--cc=pauld@redhat.com \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=rostedt@goodmis.org \
--cc=rppt@kernel.org \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=tim.c.chen@linux.intel.com \
--cc=tony.luck@intel.com \
--cc=torvalds@linux-foundation.org \
--cc=valentin.schneider@arm.com \
--cc=vincent.guittot@linaro.org \
--cc=vineeth@bitbyteword.org \
--cc=viremana@linux.microsoft.com \
--cc=x86@kernel.org \
--cc=yu.c.chen@intel.com \
/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