[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1809122112480.1473@nanos.tec.linutronix.de>
Date: Wed, 12 Sep 2018 21:14:48 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Jiri Kosina <jikos@...nel.org>
cc: Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Andrea Arcangeli <aarcange@...hat.com>,
"Woodhouse, David" <dwmw@...zon.co.uk>,
Andi Kleen <ak@...ux.intel.com>,
Tim Chen <tim.c.chen@...ux.intel.com>,
"Schaufler, Casey" <casey.schaufler@...el.com>,
linux-kernel@...r.kernel.org, x86@...nel.org
Subject: Re: [PATCH v6 2/3] x86/speculation: Enable cross-hyperthread spectre
v2 STIBP mitigation
On Wed, 12 Sep 2018, Jiri Kosina wrote:
> case X86_BUG_SPECTRE_V2:
> - return sprintf(buf, "%s%s%s%s\n", spectre_v2_strings[spectre_v2_enabled],
> + mutex_lock(&spec_ctrl_mutex);
> + ret = sprintf(buf, "%s%s%s%s%s\n", spectre_v2_strings[spectre_v2_enabled],
> boot_cpu_has(X86_FEATURE_USE_IBPB) ? ", IBPB" : "",
> boot_cpu_has(X86_FEATURE_USE_IBRS_FW) ? ", IBRS_FW" : "",
> + (x86_spec_ctrl_base & SPEC_CTRL_STIBP) ? ", STIBP" : "",
> spectre_v2_module_string());
> + mutex_unlock(&spec_ctrl_mutex);
The mutex for this printing is overkill. It's a read after all and if there
is a concurrent SMT control fiddling going on then you have a chance of
getting the wrong information as well. I'll zap it.
Thanks,
tglx
Powered by blists - more mailing lists