[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1901231335570.1628@nanos.tec.linutronix.de>
Date: Wed, 23 Jan 2019 13:45:46 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: Zhenzhong Duan <zhenzhong.duan@...cle.com>
cc: linux-kernel@...r.kernel.org, mingo@...hat.com,
konrad.wilk@...cle.com, x86@...nel.org, srinivas.eeda@...cle.com,
bp@...e.de, tim.c.chen@...ux.intel.com, peterz@...radead.org,
hpa@...or.com
Subject: Re: [PATCH] x86/speculation: Update TIF_SPEC_IB before ibpb
barrier
On Fri, 18 Jan 2019, Zhenzhong Duan wrote:
> When a task is set for updating TIF_SPEC_IB throuth SECCOMP by others
> and it's scheduled in the first time, a stale TIF_SPEC_IB value is
> picked in cond_ibpb(). This is due to TIF_SPEC_IB is updated later at
> __switch_to_xtra().
>
> Add an extra call to speculation_ctrl_update_tif() to update it before
> IBPB barrier.
Errm. No. It adds that call to speculation_ctrl_update_tif() for every
mm switch, most of the time for nothing.
If at all, and we discussed that before and decided not to worry about it
(because it gets fixed up on the next context switch), then you want to
handle ibpb() from there:
if (likely(!((tifp | tifn) & _TIF_SPEC_FORCE_UPDATE))) {
__speculation_ctrl_update(tifp, tifn);
} else {
speculation_ctrl_update_tif(prev_p);
tifn = speculation_ctrl_update_tif(next_p);
/* Enforce MSR update to ensure consistent state */
__speculation_ctrl_update(~tifn, tifn);
------> Force update IBPB
}
Thanks,
tglx
Powered by blists - more mailing lists