Re: [PATCHv2] x86/mm/cpa: avoid wbinvd() for PREEMPT
From: Peter Zijlstra
Date: Mon Jan 30 2017 - 07:32:14 EST
On Mon, Jan 30, 2017 at 09:41:21AM +0100, John Ogness wrote:
> Although wbinvd() is faster than flushing many individual pages, it
> blocks the memory bus for "long" periods of time (>100us), thus
> directly causing unusually large latencies on all CPUs, regardless
> of any CPU isolation features that may be active.
> For 1024 pages, flushing those pages individually can take up to
> 2200us, but the task remains fully preemptible during that time.
> Signed-off-by: John Ogness <john.ogness@xxxxxxxxxxxxx>
Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
I think we need an additional patch to deal with CAT, but we can easily
do that later.
I've thought about that situation a bit and wbinvd cannot and must not
respect the CAT mask because while all the new lines brought in by the
current context are constrained, lines shared with another context, or
if the current context changed might well be outside the current mask.
In any case, this is a unprivileged interface, and therefore I feel we
need to remove the wbinvd usage entirely, esp. if CAT is enabled.
But like said, we can do that in a follow up patch.