From: Ingo Molnar <mingo@kernel.org>
To: Tim Chen <tim.c.chen@linux.intel.com>
Cc: linux-kernel@vger.kernel.org,
KarimAllah Ahmed <karahmed@amazon.de>,
Andi Kleen <ak@linux.intel.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Andy Lutomirski <luto@kernel.org>,
Arjan van de Ven <arjan@linux.intel.com>,
Ashok Raj <ashok.raj@intel.com>,
Asit Mallick <asit.k.mallick@intel.com>,
Borislav Petkov <bp@suse.de>,
Dan Williams <dan.j.williams@intel.com>,
Dave Hansen <dave.hansen@intel.com>,
David Woodhouse <dwmw@amazon.co.uk>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"H . Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>,
Joerg Roedel <joro@8bytes.org>,
Jun Nakajima <jun.nakajima@intel.com>,
Laura Abbott <labbott@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
rkrcmar@redhat.com, Thomas Gleixner <tglx@linutronix.de>,
Tom Lendacky <thomas.lendacky@amd.com>,
x86@kernel.org
Subject: Re: [PATCH v2] x86/ibpb: Skip IBPB when we switch back to same user process
Date: Sun, 28 Jan 2018 10:56:09 +0100 [thread overview]
Message-ID: <20180128095609.rfcnv3itu3clrkru@gmail.com> (raw)
In-Reply-To: <a001fc041197f04ecf080ba606d8e8cef730ec3e.1516923053.git.tim.c.chen@linux.intel.com>
* Tim Chen <tim.c.chen@linux.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@linux.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
next prev parent reply other threads:[~2018-01-28 9:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-25 23:37 Tim Chen
2018-01-28 9:56 ` Ingo Molnar [this message]
2018-01-28 10:38 ` Woodhouse, David
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180128095609.rfcnv3itu3clrkru@gmail.com \
--to=mingo@kernel.org \
--cc=Janakarajan.Natarajan@amd.com \
--cc=aarcange@redhat.com \
--cc=ak@linux.intel.com \
--cc=arjan@linux.intel.com \
--cc=ashok.raj@intel.com \
--cc=asit.k.mallick@intel.com \
--cc=bp@suse.de \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@intel.com \
--cc=dwmw@amazon.co.uk \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=joro@8bytes.org \
--cc=jun.nakajima@intel.com \
--cc=karahmed@amazon.de \
--cc=labbott@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=rkrcmar@redhat.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=tim.c.chen@linux.intel.com \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®