Skip to content

RFC x86/mm: PCID and INVPCID

Andy Lutomirski linux-mm lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest13 patches 23 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13x86/paravirt: Turn KASAN off for parvirt.oarch/x86/kernel/Makefile+1 -07 replies
2/13x86/mm: Add INVPCID helpersarch/x86/include/asm/tlbflush.h+41 -00 replies
3/13x86/mm: Add a noinvpcid option to turn off INVPCIDDocumentation/kernel-parameters.txt arch/x86/kernel/cpu/common.c+18 -00 replies
4/13x86/mm: If INVPCID is available, use it to flush global mappingsarch/x86/include/asm/tlbflush.h+9 -00 replies
5/13x86/mm: Add barriers and document switch_mm-vs-flush synchronizationarch/x86/include/asm/mmu_context.h arch/x86/mm/tlb.c+58 -44 replies
6/13x86/mm: Disable PCID on 32-bit kernelsarch/x86/include/asm/disabled-features.h arch/x86/kernel/cpu/bugs.c+9 -10 replies
7/13x86/mm: Add nopcid to turn off PCIDDocumentation/kernel-parameters.txt arch/x86/kernel/cpu/common.c+20 -00 replies
8/13x86/mm: Teach CR3 readers about PCIDarch/x86/include/asm/tlbflush.h arch/x86/kernel/head64.c arch/x86/mm/fault.c+14 -50 replies
9/13x86/mm: Disable interrupts when flushing the TLB using CR3arch/x86/include/asm/tlbflush.h+10 -010 replies
10/13x86/mm: Factor out remote TLB flushingarch/x86/mm/tlb.c+11 -60 replies
11/13x86/mm: Build arch/x86/mm/tlb.c even on !SMParch/x86/mm/Makefile arch/x86/mm/tlb.c+5 -21 reply
12/13x86/mm: Uninline switch_mmarch/x86/include/asm/mmu_context.h arch/x86/mm/tlb.c+99 -910 replies
13/13x86/mm: Try to preserve old TLB entries using PCIDarch/x86/include/asm/mmu.h arch/x86/include/asm/tlbflush.h arch/x86/kernel/cpu/common.c +3 more+213 -152 replies

Reviews trailers per patch

None of the 13 patches has a Reviewed-by or Acked-by.

PatchAndy Lutomirski
1/13T-b
2/13
3/13
4/13
5/13
6/13
7/13
8/13
9/13
10/13
11/13
12/13
13/13

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC 00/13] x86/mm: PCID and INVPCID

Here's my PCID and INVPCID work-in-progress. It seems to work well enough to play with it. (That is, I'm not aware of anything wrong with it, although it may eat your data.)

PCID and INVPCID use are orthogonal here. INVPCID is a straightforward speedup for global TLB flushes. Other than that, I don't use INVPCID at all, since it seems slower than just manipulating CR3 carefully, at least on my Skylake laptop.

Please play around and suggest (and run?) good benchmarks. It seems to save around 100ns on cross-process context switches for me. Unfortunately, we suck at context switches in general, so this is, at best, a little over a 10% speedup. Most of the time is spent in the scheduler, not in arch code.

Andy Lutomirski (13):
x86/paravirt: Turn KASAN off for parvirt.o
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 x86/mm: Add barriers and document switch_mm-vs-flush synchronization x86/mm: Disable PCID on 32-bit kernels
x86/mm: Add nopcid to turn off PCID
x86/mm: Teach CR3 readers about PCID
x86/mm: Disable interrupts when flushing the TLB using CR3 x86/mm: Factor out remote TLB flushing
x86/mm: Build arch/x86/mm/tlb.c even on !SMP
x86/mm: Uninline switch_mm
x86/mm: Try to preserve old TLB entries using PCID

 Documentation/kernel-parameters.txt      |   4 +
 arch/x86/include/asm/disabled-features.h |   4 +-
 arch/x86/include/asm/mmu.h               |   7 +-
 arch/x86/include/asm/mmu_context.h       |  62 +-----
 arch/x86/include/asm/tlbflush.h          |  86 ++++++++
 arch/x86/kernel/Makefile                 |   1 +
 arch/x86/kernel/cpu/bugs.c               |   6 +
 arch/x86/kernel/cpu/common.c             |  38 ++++
 arch/x86/kernel/head64.c                 |   3 +-
 arch/x86/kernel/ldt.c                    |   2 +
 arch/x86/kernel/process_64.c             |   2 +
 arch/x86/mm/Makefile                     |   3 +-
 arch/x86/mm/fault.c                      |   8 +-
 arch/x86/mm/tlb.c                        | 324 +++++++++++++++++++++++++++++--
 14 files changed, 467 insertions(+), 83 deletions(-)
Signature · 7 lines
2.5.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>