forked from Minki/linux
6fd166aae7
We can use PCID to retain the TLBs across CR3 switches; including those now part of the user/kernel switch. This increases performance of kernel entry/exit at the cost of more expensive/complicated TLB flushing. Now that we have two address spaces, one for kernel and one for user space, we need two PCIDs per mm. We use the top PCID bit to indicate a user PCID (just like we use the PFN LSB for the PGD). Since we do TLB invalidation from kernel space, the existing code will only invalidate the kernel PCID, we augment that by marking the corresponding user PCID invalid, and upon switching back to userspace, use a flushing CR3 write for the switch. In order to access the user_pcid_flush_mask we use PER_CPU storage, which means the previously established SWAPGS vs CR3 ordering is now mandatory and required. Having to do this memory access does require additional registers, most sites have a functioning stack and we can spill one (RAX), sites without functional stack need to otherwise provide the second scratch register. Note: PCID is generally available on Intel Sandybridge and later CPUs. Note: Up until this point TLB flushing was broken in this series. Based-on-code-from: Dave Hansen <dave.hansen@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Andy Lutomirski <luto@kernel.org> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: David Laight <David.Laight@aculab.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Eduardo Valentin <eduval@amazon.com> Cc: Greg KH <gregkh@linuxfoundation.org> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Juergen Gross <jgross@suse.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Will Deacon <will.deacon@arm.com> Cc: aliguori@amazon.com Cc: daniel.gruss@iaik.tugraz.at Cc: hughd@google.com Cc: keescook@google.com Signed-off-by: Ingo Molnar <mingo@kernel.org> |
||
---|---|---|
.. | ||
a.out.h | ||
auxvec.h | ||
bitsperlong.h | ||
boot.h | ||
bootparam.h | ||
byteorder.h | ||
debugreg.h | ||
e820.h | ||
errno.h | ||
fcntl.h | ||
hw_breakpoint.h | ||
hwcap2.h | ||
hyperv.h | ||
ioctl.h | ||
ioctls.h | ||
ipcbuf.h | ||
ist.h | ||
Kbuild | ||
kvm_para.h | ||
kvm_perf.h | ||
kvm.h | ||
ldt.h | ||
mce.h | ||
mman.h | ||
msgbuf.h | ||
msr.h | ||
mtrr.h | ||
param.h | ||
perf_regs.h | ||
poll.h | ||
posix_types_32.h | ||
posix_types_64.h | ||
posix_types_x32.h | ||
posix_types.h | ||
prctl.h | ||
processor-flags.h | ||
ptrace-abi.h | ||
ptrace.h | ||
resource.h | ||
sembuf.h | ||
setup.h | ||
shmbuf.h | ||
sigcontext32.h | ||
sigcontext.h | ||
siginfo.h | ||
signal.h | ||
socket.h | ||
sockios.h | ||
stat.h | ||
statfs.h | ||
svm.h | ||
swab.h | ||
termbits.h | ||
termios.h | ||
types.h | ||
ucontext.h | ||
unistd.h | ||
vm86.h | ||
vmx.h | ||
vsyscall.h |