[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180128095609.rfcnv3itu3clrkru@gmail.com>
Date: Sun, 28 Jan 2018 10:56:09 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Tim Chen <tim.c.chen@...ux.intel.com>
Cc: linux-kernel@...r.kernel.org,
KarimAllah Ahmed <karahmed@...zon.de>,
Andi Kleen <ak@...ux.intel.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Andy Lutomirski <luto@...nel.org>,
Arjan van de Ven <arjan@...ux.intel.com>,
Ashok Raj <ashok.raj@...el.com>,
Asit Mallick <asit.k.mallick@...el.com>,
Borislav Petkov <bp@...e.de>,
Dan Williams <dan.j.williams@...el.com>,
Dave Hansen <dave.hansen@...el.com>,
David Woodhouse <dwmw@...zon.co.uk>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"H . Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Janakarajan Natarajan <Janakarajan.Natarajan@....com>,
Joerg Roedel <joro@...tes.org>,
Jun Nakajima <jun.nakajima@...el.com>,
Laura Abbott <labbott@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Peter Zijlstra <peterz@...radead.org>, rkrcmar@...hat.com,
Thomas Gleixner <tglx@...utronix.de>,
Tom Lendacky <thomas.lendacky@....com>, x86@...nel.org
Subject: Re: [PATCH v2] x86/ibpb: Skip IBPB when we switch back to same user
process
* Tim Chen <tim.c.chen@...ux.intel.com> wrote:
> Thanks to the reviewers and Andy Lutomirski for the suggestion of
> using ctx_id which got rid of the problem of mm pointer recycling.
> Here's an update of this patch based on Andy's suggestion.
>
> We could switch to a kernel idle thread and then back to the original
> process such as:
> process A -> idle -> process A
>
> In such scenario, we do not have to do IBPB here even though the process is
> non-dumpable, as we are switching back to the same process after
> an hiatus.
>
> We track the last mm user context id before we switch to init_mm by calling
> leave_mm when tlb_defer_switch_to_init_mm returns false (pcid available).
>
> The cost is to have an extra u64 mm context id to track the last mm we were using before
> switching to the init_mm used by idle. Avoiding the extra IBPB
> is probably worth the extra memory for this common scenario.
>
> For those cases where tlb_defer_switch_to_init_mm returns true (non pcid),
> lazy tlb will defer switch to init_mm, so we will not be changing
> the mm for the process A -> idle -> process A switch. So
> IBPB will be skipped for this case.
>
> v2:
> 1. Save last user context id instead of last user mm to avoid the problem of recycled mm
>
> Signed-off-by: Tim Chen <tim.c.chen@...ux.intel.com>
> ---
> arch/x86/include/asm/tlbflush.h | 2 ++
> arch/x86/mm/tlb.c | 23 ++++++++++++++++-------
> 2 files changed, 18 insertions(+), 7 deletions(-)
What tree is this patch against? It doesn't apply to linus's latest, nor to
tip:master.
Thanks,
Ingo
Powered by blists - more mailing lists