lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 11 Nov 2020 16:14:20 -0500 From: Joel Fernandes <joel@...lfernandes.org> To: Nishanth Aravamudan <naravamudan@...italocean.com>, Julien Desfossez <jdesfossez@...italocean.com>, Peter Zijlstra <peterz@...radead.org>, Tim Chen <tim.c.chen@...ux.intel.com>, Vineeth Pillai <viremana@...ux.microsoft.com>, Aaron Lu <aaron.lwe@...il.com>, Aubrey Li <aubrey.intel@...il.com>, Thomas Glexiner <tglx@...utronix.de>, LKML <linux-kernel@...r.kernel.org> Cc: Ingo Molnar <mingo@...nel.org>, Linus Torvalds <torvalds@...ux-foundation.org>, Frederic Weisbecker <fweisbec@...il.com>, Kees Cook <keescook@...omium.org>, Greg Kerr <kerrnel@...gle.com>, Phil Auld <pauld@...hat.com>, Valentin Schneider <valentin.schneider@....com>, Mel Gorman <mgorman@...hsingularity.net>, Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>, Paolo Bonzini <pbonzini@...hat.com>, vineeth@...byteword.org, Chen Yu <yu.c.chen@...el.com>, Christian Brauner <christian.brauner@...ntu.com>, Agata Gruza <agata.gruza@...el.com>, Antonio Gomez Iglesias <antonio.gomez.iglesias@...el.com>, graf@...zon.com, konrad.wilk@...cle.com, Dario Faggioli <dfaggioli@...e.com>, Paul Turner <pjt@...gle.com>, Steven Rostedt <rostedt@...dmis.org>, Patrick Bellasi <derkling@...gle.com>, benbjiang(蒋彪) <benbjiang@...cent.com>, Alexandre Chartre <alexandre.chartre@...cle.com>, James.Bottomley@...senpartnership.com, OWeisse@...ch.edu, Dhaval Giani <dhaval.giani@...cle.com>, Junaid Shahid <junaids@...gle.com>, Jesse Barnes <jsbarnes@...gle.com>, "Hyser,Chris" <chris.hyser@...cle.com>, Ben Segall <bsegall@...gle.com>, Josh Don <joshdon@...gle.com>, Hao Luo <haoluo@...gle.com>, "Anand K. Mistry" <amistry@...gle.com>, Borislav Petkov <bp@...en8.de>, Daniel Bristot de Oliveira <bristot@...hat.com>, Dietmar Eggemann <dietmar.eggemann@....com>, "H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>, Juri Lelli <juri.lelli@...hat.com>, Mel Gorman <mgorman@...e.de>, Mike Rapoport <rppt@...nel.org>, Tom Lendacky <thomas.lendacky@....com>, Tony Luck <tony.luck@...el.com>, Vincent Guittot <vincent.guittot@...aro.org>, "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org> Subject: Re: [RFC 1/2] x86/bugs: Disable coresched on hardware that does not need it Sorry, forgot to CC +Tom Lendacky . Please take a look Tom, thanks. On Wed, Nov 11, 2020 at 4:10 PM Joel Fernandes (Google) <joel@...lfernandes.org> 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. > > Signed-off-by: Joel Fernandes (Google) <joel@...lfernandes.org> > --- > arch/x86/kernel/cpu/bugs.c | 8 ++++++++ > kernel/sched/core.c | 7 +++++++ > kernel/sched/sched.h | 5 +++++ > 3 files changed, 20 insertions(+) > > 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); > +} > + > void > x86_virt_spec_ctrl(u64 guest_spec_ctrl, u64 guest_virt_spec_ctrl, bool setguest) > { > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 64c559192634..c6158b4959fe 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -319,6 +319,13 @@ static void __sched_core_enable(void) > for_each_online_cpu(cpu) > BUG_ON(!sched_core_empty(cpu_rq(cpu))); > > + /* > + * Some architectures may not want coresched. (ex, AMD does not have > + * MDS/L1TF issues so it wants SMT completely on). > + */ > + if (!arch_allow_core_sched()) > + return; > + > static_branch_enable(&__sched_core_enabled); > stop_machine(__sched_core_stopper, (void *)true, NULL); > > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h > index 3cf08c77b678..a1b39764a6ed 100644 > --- a/kernel/sched/sched.h > +++ b/kernel/sched/sched.h > @@ -1203,6 +1203,11 @@ int cpu_core_tag_color_write_u64(struct cgroup_subsys_state *css, > > bool cfs_prio_less(struct task_struct *a, struct task_struct *b, bool fi); > > +int __weak arch_allow_core_sched(void) > +{ > + return true; > +} > + > #else /* !CONFIG_SCHED_CORE */ > > static inline bool sched_core_enqueued(struct task_struct *task) { return false; } > -- > 2.29.2.222.g5d2a92d10f8-goog >
Powered by blists - more mailing lists