Re: [patch 21/24] x86/speculation: Prepare arch_smt_update() for PRCTL mode

From: Thomas Gleixner
Date: Thu Nov 22 2018 - 18:22:13 EST


On Thu, 22 Nov 2018, Ingo Molnar wrote:
> * Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> > +static void update_stibp_msr(void *info)
> > {
> > - /* Enhanced IBRS makes using STIBP unnecessary. */
> > - if (spectre_v2_enabled == SPECTRE_V2_IBRS_ENHANCED)
> > - return false;
> > -
> > - /* Check for strict app2app mitigation mode */
> > - return spectre_v2_app2app == SPECTRE_V2_APP2APP_STRICT;
> > + wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base);
> > }
>
>
> Does Sparse or other tooling warn about unused function parameters? If
> yes then it might make sense to mark it __used?

That would be __useless :)

> So I'm wondering, shouldn't firmware_restrict_branch_speculation_start()/_end()
> also enable/disable STIBP? It already enabled/disables IBRS.

IBRS includes STIBP. We don't use IBRS in the kernel otherwise because
you'd have to do more MSR writes on the protection boundaries.

We only use ENHANCED IBRS if it's available, which also makes STIBP
redundant.

Thanks,

tglx