freebsd-nq/sys/x86/xen
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
..
hvm.c xen: implement the privcmd user-space device 2014-10-22 17:07:20 +00:00
pv.c loader: fix the size of MODINFOMD_MODULEP 2015-01-20 12:28:24 +00:00
pvcpu_enum.c xen/intr: improve handling of legacy IRQs 2015-02-16 16:37:59 +00:00
xen_apic.c Rewrite amd64 PCID implementation to follow an algorithm described in 2015-05-09 19:11:01 +00:00
xen_intr.c Remove support for Xen PV domU kernels. Support for HVM domU kernels 2015-04-30 15:48:48 +00:00
xen_msi.c msi: add Xen MSI implementation 2014-09-30 16:46:45 +00:00
xen_nexus.c Remove support for Xen PV domU kernels. Support for HVM domU kernels 2015-04-30 15:48:48 +00:00
xen_pci_bus.c xen: create a new PCI bus override 2014-12-09 18:03:25 +00:00
xenpv.c xen: introduce a newbus function to allocate unused memory 2015-05-08 14:48:40 +00:00