lkml.org 
[lkml]   [2018]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 1/2] x86/ibpb: Skip IBPB when we switch back to same user process
On Thu, Jan 25, 2018 at 11:32:46AM -0800, Tim Chen wrote:
>
> This patch is not ideal as it comes with the caveats that
> patch 2 tries to close. I put it out here to see if it can prompt
> people to come up with a better solution. Keeping active_mm around would
> have been cleaner but it looks like there are issues that Andy mentioned.
>
> The "A -> idle -> A" case would not trigger IBPB if tlb_defer_switch_to_init_mm()
> is true (non pcid) as we does not change the mm.
>
> This patch tries to address the case when we do switch to init_mm and back.
> Do you still have objections to the approach in this patch
> to save the last active mm before switching to init_mm?

I still think the existing active_mm is sufficient. Something like:

switch_mm()
{
...
if (prev && next != prev)
ibpb();
...
}

should work. Because while the idle crud does leave_mm() and PCID does
enter_lazy_tlb() and both end up doing: switch_mm(NULL, &init_mm, NULL),
nothing there affects tsk->active_mm.

So over the "A -> idle -> A" transition, active_mm should actually track
what you want.


\
 
 \ /
  Last update: 2018-01-25 21:47    [W:0.093 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site