Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1317162 > unrolled thread
| Started by | Andy Lutomirski <luto@kernel.org> |
|---|---|
| First post | 2016-01-25 19:40 +0100 |
| Last post | 2016-01-27 11:20 +0100 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH v2 0/3] x86/mm: INVPCID support Andy Lutomirski <luto@kernel.org> - 2016-01-25 19:40 +0100
[PATCH v2 3/3] x86/mm: If INVPCID is available, use it to flush global mappings Andy Lutomirski <luto@kernel.org> - 2016-01-25 19:40 +0100
Re: [PATCH v2 0/3] x86/mm: INVPCID support Ingo Molnar <mingo@kernel.org> - 2016-01-25 20:00 +0100
Re: several messages Thomas Gleixner <tglx@linutronix.de> - 2016-01-27 11:20 +0100
| From | Andy Lutomirski <luto@kernel.org> |
|---|---|
| Date | 2016-01-25 19:40 +0100 |
| Subject | [PATCH v2 0/3] x86/mm: INVPCID support |
| Message-ID | <qUUdr-88K-5@gated-at.bofh.it> |
Ingo, before applying this, please apply these two KASAN fixes: http://lkml.kernel.org/g/1452516679-32040-2-git-send-email-aryabinin@virtuozzo.com http://lkml.kernel.org/g/1452516679-32040-3-git-send-email-aryabinin@virtuozzo.com Without those fixes, this series will trigger a KASAN bug. This is a straightforward speedup on Ivy Bridge and newer, IIRC. (I tested on Skylake. INVPCID is not available on Sandy Bridge. I don't have Ivy Bridge, Haswell or Broadwell to test on, so I could be wrong as to when the feature was introduced.) I think we should consider these patches separately from the rest of the PCID stuff -- they barely interact, and this part is much simpler and is useful on its own. This is exactly identical to patches 2-4 of the PCID RFC series. Andy Lutomirski (3): x86/mm: Add INVPCID helpers x86/mm: Add a noinvpcid option to turn off INVPCID x86/mm: If INVPCID is available, use it to flush global mappings Documentation/kernel-parameters.txt | 2 ++ arch/x86/include/asm/tlbflush.h | 50 +++++++++++++++++++++++++++++++++++++ arch/x86/kernel/cpu/common.c | 16 ++++++++++++ 3 files changed, 68 insertions(+) -- 2.5.0
[toc] | [next] | [standalone]
| From | Andy Lutomirski <luto@kernel.org> |
|---|---|
| Date | 2016-01-25 19:40 +0100 |
| Subject | [PATCH v2 3/3] x86/mm: If INVPCID is available, use it to flush global mappings |
| Message-ID | <qUUdt-88K-51@gated-at.bofh.it> |
| In reply to | #1317162 |
On my Skylake laptop, INVPCID function 2 (flush absolutely
everything) takes about 376ns, whereas saving flags, twiddling
CR4.PGE to flush global mappings, and restoring flags takes about
539ns.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
arch/x86/include/asm/tlbflush.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
index 20fc38d8478a..4eba5164430d 100644
--- a/arch/x86/include/asm/tlbflush.h
+++ b/arch/x86/include/asm/tlbflush.h
@@ -145,6 +145,15 @@ static inline void __native_flush_tlb_global(void)
{
unsigned long flags;
+ if (static_cpu_has_safe(X86_FEATURE_INVPCID)) {
+ /*
+ * Using INVPCID is considerably faster than a pair of writes
+ * to CR4 sandwiched inside an IRQ flag save/restore.
+ */
+ invpcid_flush_everything();
+ return;
+ }
+
/*
* Read-modify-write to CR4 - protect it from preemption and
* from interrupts. (Use the raw variant because this code can
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2016-01-25 20:00 +0100 |
| Message-ID | <qUUwP-8gR-33@gated-at.bofh.it> |
| In reply to | #1317162 |
* Andy Lutomirski <luto@kernel.org> wrote: > Ingo, before applying this, please apply these two KASAN fixes: > > http://lkml.kernel.org/g/1452516679-32040-2-git-send-email-aryabinin@virtuozzo.com > http://lkml.kernel.org/g/1452516679-32040-3-git-send-email-aryabinin@virtuozzo.com > > Without those fixes, this series will trigger a KASAN bug. > > This is a straightforward speedup on Ivy Bridge and newer, IIRC. > (I tested on Skylake. INVPCID is not available on Sandy Bridge. > I don't have Ivy Bridge, Haswell or Broadwell to test on, so I > could be wrong as to when the feature was introduced.) > > I think we should consider these patches separately from the rest > of the PCID stuff -- they barely interact, and this part is much > simpler and is useful on its own. > > This is exactly identical to patches 2-4 of the PCID RFC series. > > Andy Lutomirski (3): > x86/mm: Add INVPCID helpers > x86/mm: Add a noinvpcid option to turn off INVPCID > x86/mm: If INVPCID is available, use it to flush global mappings > > Documentation/kernel-parameters.txt | 2 ++ > arch/x86/include/asm/tlbflush.h | 50 +++++++++++++++++++++++++++++++++++++ > arch/x86/kernel/cpu/common.c | 16 ++++++++++++ > 3 files changed, 68 insertions(+) Ok, I'll pick these up tomorrow unless there are objections. Thanks, Ingo
[toc] | [prev] | [next] | [standalone]
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2016-01-27 11:20 +0100 |
| Subject | Re: several messages |
| Message-ID | <qVvmF-1Z6-7@gated-at.bofh.it> |
| In reply to | #1317206 |
On Mon, 25 Jan 2016, Andy Lutomirski wrote: > This is a straightforward speedup on Ivy Bridge and newer, IIRC. > (I tested on Skylake. INVPCID is not available on Sandy Bridge. > I don't have Ivy Bridge, Haswell or Broadwell to test on, so I > could be wrong as to when the feature was introduced.) Haswell and Broadwell have it. No idea about ivy bridge. Thanks, tglx
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web