From: Andy Lutomirski <luto@kernel.org>
To: Nadav Amit <namit@vmware.com>
Cc: Andy Lutomirski <luto@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
X86 ML <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 17:30:55 -0700 [thread overview]
Message-ID: <CALCETrVTErOur1vkSp-5KDmHRXAdSCRjRmbsvQ44TFpqcx36GA@mail.gmail.com> (raw)
In-Reply-To: <154B90AD-7EC3-4B86-8061-D737A948A77C@vmware.com>
On Tue, Aug 27, 2019 at 4:55 PM Nadav Amit <namit@vmware.com> wrote:
>
> > On Aug 27, 2019, at 4:13 PM, Andy Lutomirski <luto@kernel.org> wrote:
> >
> > On Fri, Aug 23, 2019 at 11:13 PM Nadav Amit <namit@vmware.com> 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.
> >>
> >> Instead, unless page-tables are released, it is possible to defer the
> >> flushing of the user page-tables until the time the code returns to
> >> userspace. These page tables are not in use, so deferring them is not a
> >> security hazard.
> >
> > I agree and, in fact, I argued against ever using INVPCID in the
> > original PTI code.
> >
> > However, I don't see what freeing page tables has to do with this. If
> > the CPU can actually do speculative page walks based on the contents
> > of non-current-PCID TLB entries, then we have major problems, since we
> > don't actively flush the TLB for non-running mms at all.
>
> That was not my concern.
>
> >
> > I suppose that, if we free a page table, then we can't activate the
> > PCID by writing to CR3 before flushing things. But we can still defer
> > the flush and just set the flush bit when we write to CR3.
>
> This was my concern. I can change the behavior so the code would flush the
> whole TLB instead. I just tried not to change the existing behavior too
> much.
>
We do this anyway if we don't have INVPCID_SINGLE, so it doesn't seem
so bad to also do it if there's a freed page table.
next prev parent reply other threads:[~2019-08-28 0:31 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
2019-08-27 23:13 ` Andy Lutomirski
2019-08-27 23:55 ` Nadav Amit
2019-08-28 0:30 ` Andy Lutomirski [this message]
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=CALCETrVTErOur1vkSp-5KDmHRXAdSCRjRmbsvQ44TFpqcx36GA@mail.gmail.com \
--to=luto@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namit@vmware.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;
as well as URLs for NNTP newsgroup(s).