Messages in this thread | | | Date | Wed, 21 Jun 2017 11:40:15 +0200 | From | Borislav Petkov <> | 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@redhat.com> > Signed-off-by: Andy Lutomirski <luto@kernel.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@suse.de>
-- Regards/Gruss, Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
| |