[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170621094015.nknwc5iec7zn56xl@pd.tnic>
Date: Wed, 21 Jun 2017 11:40:15 +0200
From: Borislav Petkov <bp@...en8.de>
To: Andy Lutomirski <luto@...nel.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Mel Gorman <mgorman@...e.de>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
Nadav Amit <nadav.amit@...il.com>,
Rik van Riel <riel@...hat.com>,
Dave Hansen <dave.hansen@...el.com>,
Arjan van de Ven <arjan@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v3 02/11] x86/ldt: Simplify LDT switching logic
On Tue, Jun 20, 2017 at 10:22:08PM -0700, Andy Lutomirski wrote:
> Originally, Linux reloaded the LDT whenever the prev mm or the next
> mm had an LDT. It was changed in 0bbed3beb4f2 ("[PATCH]
> Thread-Local Storage (TLS) support") (from the historical tree) like
> this:
>
> - /* load_LDT, if either the previous or next thread
> - * has a non-default LDT.
> + /*
> + * load the LDT, if the LDT is different:
> */
> - if (next->context.size+prev->context.size)
> + if (unlikely(prev->context.ldt != next->context.ldt))
> load_LDT(&next->context);
>
> The current code is unlikely to avoid any LDT reloads, since different
> mms won't share an LDT.
>
> When we redo lazy mode to stop flush IPIs without switching to
> init_mm, though, the current logic would become incorrect: it will
> be possible to have real_prev == next but nonetheless have a stale
> LDT descriptor.
>
> Simplify the code to update LDTR if either the previous or the next
> mm has an LDT, i.e. effectively restore the historical logic..
> While we're at it, clean up the code by moving all the ifdeffery to
> a header where it belongs.
>
> Acked-by: Rik van Riel <riel@...hat.com>
> Signed-off-by: Andy Lutomirski <luto@...nel.org>
> ---
> arch/x86/include/asm/mmu_context.h | 26 ++++++++++++++++++++++++++
> arch/x86/mm/tlb.c | 20 ++------------------
> 2 files changed, 28 insertions(+), 18 deletions(-)
Reviewed-by: Borislav Petkov <bp@...e.de>
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
Powered by blists - more mailing lists