c8f9c1f3d9
Use PCID to avoid complete TLB shootdown when switching between user and kernel mode with PTI enabled. I use the model close to what I read about KAISER, user-mode PCID has 1:1 correspondence to the kernel-mode PCID, by setting bit 11 in PCID. Full kernel-mode TLB shootdown is performed on context switches, since KVA TLB invalidation only works in the current pmap. User-mode part of TLB is flushed on the pmap activations as well. Similarly, IPI TLB shootdowns must handle both kernel and user address spaces for each address. Note that machines which implement PCID but do not have INVPCID instructions, cause the usual complications in the IPI handlers, due to the need to switch to the target PCID temporary. This is racy, but because for PCID/no-INVPCID we disable the interrupts in pmap_activate_sw(), IPI handler cannot see inconsistent state of CPU PCID vs PCPU pmap/kcr3/ucr3 pointers. On the other hand, on kernel/user switches, CR3_PCID_SAVE bit is set and we do not clear TLB. I can imagine alternative use of PCID, where there is only one PCID allocated for the kernel pmap. Then, there is no need to shootdown kernel TLB entries on context switch. But copyout(3) would need to either use method similar to proc_rwmem() to access the userspace data, or (in reverse) provide a temporal mapping for the kernel buffer into user mode PCID and use trampoline for copy. Reviewed by: markj (previous version) Tested by: pho Discussed with: alc (some aspects) Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Differential revision: https://reviews.freebsd.org/D13985 |
||
---|---|---|
.. | ||
xen | ||
_align.h | ||
_inttypes.h | ||
_limits.h | ||
_stdint.h | ||
_types.h | ||
acpica_machdep.h | ||
apicreg.h | ||
apicvar.h | ||
apm_bios.h | ||
bus_dma.h | ||
bus.h | ||
busdma_impl.h | ||
cputypes.h | ||
dump.h | ||
elf.h | ||
endian.h | ||
fdt.h | ||
float.h | ||
fpu.h | ||
frame.h | ||
init.h | ||
legacyvar.h | ||
mca.h | ||
metadata.h | ||
mptable.h | ||
ofw_machdep.h | ||
pci_cfgreg.h | ||
psl.h | ||
ptrace.h | ||
pvclock.h | ||
reg.h | ||
segments.h | ||
setjmp.h | ||
sigframe.h | ||
signal.h | ||
specialreg.h | ||
stack.h | ||
stdarg.h | ||
sysarch.h | ||
trap.h | ||
ucontext.h | ||
vdso.h | ||
vmware.h | ||
x86_smp.h | ||
x86_var.h |