freebsd-dev/sys/amd64/include
Konstantin Belousov a546448b8d Rewrite amd64 PCID implementation to follow an algorithm described in
the Vahalia' "Unix Internals" section 15.12 "Other TLB Consistency
Algorithms".  The same algorithm is already utilized by the MIPS pmap
to handle ASIDs.

The PCID for the address space is now allocated per-cpu during context
switch to the thread using pmap, when no PCID on the cpu was ever
allocated, or the current PCID is invalidated.  If the PCID is reused,
bit 63 of %cr3 can be set to avoid TLB flush.

Each cpu has PCID' algorithm generation count, which is saved in the
pmap pcpu block when pcpu PCID is allocated.  On invalidation, the
pmap generation count is zeroed, which signals the context switch code
that already allocated PCID is no longer valid.  The implication is
the TLB shootdown for the given cpu/address space, due to the
allocation of new PCID.

The pm_save mask is no longer has to be tracked, which (significantly)
reduces the targets of the TLB shootdown IPIs.  Previously, pm_save
was reset only on pmap_invalidate_all(), which made it accumulate the
cpuids of all processors on which the thread was scheduled between
full TLB shootdowns.

Besides reducing the amount of TLB shootdowns and removing atomics to
update pm_saves in the context switch code, the algorithm is much
simpler than the maintanence of pm_save and selection of the right
address space in the shootdown IPI handler.

Reviewed by:	alc
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-05-09 19:11:01 +00:00
..
pc - Add a new structure type for the ACPI 3.0 SMAP entry that includes the 2014-08-29 21:25:47 +00:00
xen Remove support for Xen PV domU kernels. Support for HVM domU kernels 2015-04-30 15:48:48 +00:00
_align.h
_bus.h
_inttypes.h
_limits.h Copy amd64 _limits.h to x86 and merge with i386 _limits.h. Replace 2012-02-28 18:24:28 +00:00
_stdint.h Copy amd64 _stdint.h to x86 and merge with i386 _stdint.h. Replace 2012-02-28 18:38:33 +00:00
_types.h Copy amd64 _types.h to x86 and merge with i386 _types.h. Replace existing 2012-02-28 18:15:28 +00:00
acpica_machdep.h Merge acpica_machdep.h for amd64 and i386 and move to x86. In fact, these 2013-08-13 22:05:10 +00:00
apm_bios.h
asm.h Revert r274772: it is not valid on MIPS 2014-11-25 03:50:31 +00:00
asmacros.h Extend earlier addition of stack frames to most of support.S. This makes 2014-11-13 22:11:44 +00:00
atomic.h Remove empty lines before return statements for style consistency. 2013-08-21 22:05:58 +00:00
bus_dma.h
bus.h
clock.h xen: implement an early timer for Xen PVH 2014-03-11 10:20:42 +00:00
counter.h Fix issues with zeroing and fetching the counters, on x86 and ppc64. 2013-07-01 02:48:27 +00:00
cpu.h amd64/i386: introduce APIC hooks for different APIC implementations. 2014-06-16 08:43:03 +00:00
cpufunc.h Rewrite amd64 PCID implementation to follow an algorithm described in 2015-05-09 19:11:01 +00:00
cputypes.h
db_machdep.h
dump.h Factor out duplicated code from dumpsys() on each architecture into generic 2015-01-07 01:01:39 +00:00
elf.h Convert machine/elf.h, machine/frame.h, machine/sigframe.h, 2013-02-20 17:39:52 +00:00
endian.h Copy amd64 endian.h to x86 and merge with i386 endian.h. Replace 2012-02-28 19:39:54 +00:00
exec.h
fdt.h Add basic support for FDT to i386 & amd64. This change includes: 2013-05-21 03:05:49 +00:00
float.h Copy amd64 float.h to x86 and merge with i386 float.h. Replace 2012-03-04 14:00:32 +00:00
floatingpoint.h
fpu.h Create a separate structure for per-CPU state saved across suspend and 2014-09-06 15:23:28 +00:00
frame.h Convert machine/elf.h, machine/frame.h, machine/sigframe.h, 2013-02-20 17:39:52 +00:00
gdb_machdep.h
ieeefp.h
in_cksum.h MFp4 bz_ipv6_fast: 2012-05-24 22:00:48 +00:00
intr_machdep.h Use VT-d interrupt remapping block (IR) to perform FSB messages 2015-03-19 13:57:47 +00:00
iodev.h
kdb.h
limits.h
md_var.h If x86 CPU implementation of the MWAIT instruction reasonably 2015-05-09 12:28:48 +00:00
memdev.h
metadata.h Use explicitly sized types in EFI module metadata 2015-04-10 19:26:45 +00:00
minidump.h
mp_watchdog.h
nexusvar.h
npx.h Move userland bits of i386 npx.h and amd64 fpu.h to x86 fpu.h. 2012-03-16 20:24:30 +00:00
ofw_machdep.h Add basic support for FDT to i386 & amd64. This change includes: 2013-05-21 03:05:49 +00:00
param.h Bump MAXCPU on amd64 from 64 to 256. In practice APIC only permits 255 2014-08-20 16:06:24 +00:00
pcb.h Create a separate structure for per-CPU state saved across suspend and 2014-09-06 15:23:28 +00:00
pci_cfgreg.h
pcpu.h Rewrite amd64 PCID implementation to follow an algorithm described in 2015-05-09 19:11:01 +00:00
pmap.h Rewrite amd64 PCID implementation to follow an algorithm described in 2015-05-09 19:11:01 +00:00
pmc_mdep.h Add software PMC support. 2012-03-28 20:58:30 +00:00
ppireg.h
proc.h Handle spurious page faults that may occur in no-fault sections of the 2012-03-22 04:52:51 +00:00
profile.h
psl.h Copy i386 psl.h to x86 and replace amd64/i386/pc98 psl.h with stubs. 2012-03-19 21:29:57 +00:00
ptrace.h Copy amd64 ptrace.h to x86 and merge with i386 ptrace.h. Replace 2012-03-04 20:24:28 +00:00
pvclock.h Generalized parts of the XEN timer code into a generic pvclock 2015-02-04 08:26:43 +00:00
reg.h Copy i386 reg.h to x86 and merge with amd64 reg.h. Replace i386/amd64/pc98 2012-03-18 19:06:38 +00:00
reloc.h
resource.h Add support for managing PCI bus numbers. As with BARs and PCI-PCI bridge 2014-02-12 04:30:37 +00:00
runq.h
segments.h Hide struct pcb definition by #ifdef __amd64__ braces. If cc -m32 2013-11-26 19:38:42 +00:00
setjmp.h Copy amd64 setjmp.h to x86 and replace amd64/i386/pc98 setjmp.h with stubs. 2012-02-28 22:17:52 +00:00
sf_buf.h Merge all MD sf_buf allocators into one MI, residing in kern/subr_sfbuf.c 2014-08-05 09:44:10 +00:00
sigframe.h Convert machine/elf.h, machine/frame.h, machine/sigframe.h, 2013-02-20 17:39:52 +00:00
signal.h Convert machine/elf.h, machine/frame.h, machine/sigframe.h, 2013-02-20 17:39:52 +00:00
smp.h Rewrite amd64 PCID implementation to follow an algorithm described in 2015-05-09 19:11:01 +00:00
specialreg.h Copy i386 specialreg.h to x86 and merge with amd64 specialreg.h. Replace 2012-03-19 21:34:11 +00:00
stack.h
stdarg.h Copy amd64 stdarg.h to x86 and replace amd64/i386/pc98 stdarg.h with stubs. 2012-02-28 22:30:58 +00:00
sysarch.h Copy amd64 sysarch.h to x86 and merge with i386 sysarch.h. Replace 2012-03-19 21:57:31 +00:00
timerreg.h
trap.h Copy amd64 trap.h to x86 and replace amd64/i386/pc98 trap.h with stubs. 2012-03-04 14:12:57 +00:00
tss.h
ucontext.h Convert machine/elf.h, machine/frame.h, machine/sigframe.h, 2013-02-20 17:39:52 +00:00
varargs.h
vdso.h Implement mechanism to export some kernel timekeeping data to 2012-06-22 07:06:40 +00:00
vm.h Reassign copyright statements on several files from Advanced 2015-04-23 14:22:20 +00:00
vmm_dev.h Simplify instruction restart logic in bhyve. 2015-01-18 03:08:30 +00:00
vmm_instruction_emul.h Deprecate the 3-way return values from vm_gla2gpa() and vm_copy_setup(). 2015-05-06 16:25:20 +00:00
vmm.h Check 'td_owepreempt' and yield the vcpu thread if it is set. 2015-05-06 23:40:24 +00:00
vmparam.h Revert r276600: PHYS_TO_DMAP_RAW() and DMAP_TO_PHYS_RAW() are no 2015-01-12 07:50:55 +00:00