From: Nadav Amit <namit@vmware.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Andy Lutomirski <luto@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
the arch/x86 maintainers <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>
Subject: Re: [RFC PATCH v2 2/3] x86/mm/tlb: Defer PTI flushes
Date: Tue, 27 Aug 2019 19:46:52 +0000 [thread overview]
Message-ID: <3B6DF400-FF8B-4B9B-8F3D-8B8CB21A9CF4@vmware.com> (raw)
In-Reply-To: <d68bef6d-d71c-7881-87e8-133f657e495a@intel.com>
> On Aug 27, 2019, at 11:28 AM, Dave Hansen <dave.hansen@intel.com> wrote:
>
> On 8/23/19 3:52 PM, Nadav Amit wrote:
>> INVPCID is considerably slower than INVLPG of a single PTE. Using it to
>> flush the user page-tables when PTI is enabled therefore introduces
>> significant overhead.
>
> I'm not sure this is worth all the churn, especially in the entry code.
> For large flushes (> tlb_single_page_flush_ceiling), we don't do
> INVPCIDs in the first place.
It is possible to jump from flush_tlb_func() into the trampoline page,
instead of flushing the TLB in the entry code. However, it induces higher
overhead (switching CR3s), so it will only be useful if multiple TLB entries
are flushed at once. It also prevents exploiting opportunities of promoting
individual entry flushes into a full-TLB flush when multiple flushes are
issued or when context switch takes place before returning-to-user-space.
There are cases/workloads that flush multiple (but not too many) TLB entries
on every syscall, for instance issuing msync() or running Apache webserver.
So I am not sure that tlb_single_page_flush_ceiling saves the day. Besides,
you may want to recalibrate (lower) tlb_single_page_flush_ceiling when PTI
is used.
> I'd really want to understand what the heck is going on that makes
> INVPCID so slow, first.
INVPCID-single is slow (even more than 133 cycles slower than INVLPG that
you mentioned; I don’t have the numbers if front of me). I thought that this
is a known fact, although, obviously, it does not make much sense.
next prev parent reply other threads:[~2019-08-27 19:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-23 22:52 [RFC PATCH v2 0/3] x86/mm/tlb: Defer TLB flushes with PTI Nadav Amit
2019-08-23 22:52 ` [RFC PATCH v2 1/3] x86/mm/tlb: Change __flush_tlb_one_user interface Nadav Amit
2019-08-26 7:51 ` Juergen Gross
2019-08-26 16:38 ` Nadav Amit
2019-08-27 5:53 ` Juergen Gross
2019-08-23 22:52 ` [RFC PATCH v2 2/3] x86/mm/tlb: Defer PTI flushes Nadav Amit
2019-08-27 18:28 ` Dave Hansen
2019-08-27 19:46 ` Nadav Amit [this message]
2019-08-27 23:13 ` Andy Lutomirski
2019-08-27 23:55 ` Nadav Amit
2019-08-28 0:30 ` Andy Lutomirski
2019-08-23 22:52 ` [RFC PATCH v2 3/3] x86/mm/tlb: Avoid deferring PTI flushes on shootdown Nadav Amit
2019-08-27 23:07 ` Andy Lutomirski
2019-08-27 23:57 ` Nadav Amit
2019-08-28 0:30 ` Andy Lutomirski
2019-08-27 18:17 ` [RFC PATCH v2 0/3] x86/mm/tlb: Defer TLB flushes with PTI Dave Hansen
2019-09-03 15:17 ` Dave Hansen
2019-09-03 16:13 ` Nadav Amit
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=3B6DF400-FF8B-4B9B-8F3D-8B8CB21A9CF4@vmware.com \
--to=namit@vmware.com \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--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®