Re: [PATCH v6 3/6] arch/x86/mm: Refactor cond_ibpb() to support other use cases
From: Thomas Gleixner
Date: Wed May 13 2020 - 10:16:29 EST
Balbir Singh <sblbir@xxxxxxxxxx> writes:
> @@ -550,8 +549,10 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next,
> * Avoid user/user BTB poisoning by flushing the branch
> * predictor when switching between processes. This stops
> * one process from doing Spectre-v2 attacks on another.
> + * The hook can also be used for mitigations that rely
> + * on switch_mm for hooks.
The new function name has absolutely nothing to do with IBPB and is
clearly talking about mitigations. So the IBPB comment wants to move and
that extra sentence you bolted on can go away. It's nonsensical word
salad anyway.
>
> /* Reinitialize tlbstate. */
> - this_cpu_write(cpu_tlbstate.last_user_mm_ibpb, LAST_USER_MM_IBPB);
> + this_cpu_write(cpu_tlbstate.last_user_mm_spec, LAST_USER_MM_IBPB);
There is still no comment why this only needs MM_IBPB. I'll change this
to LAST_USER_MM_INIT and put that define close to the others.
Thanks,
tglx