freebsd-dev/sys/x86/include
Konstantin Belousov 1680854946 Implement userspace gettimeofday(2) with HPET timecounter.
Right now, userspace (fast) gettimeofday(2) on x86 only works for
RDTSC.  For older machines, like Core2, where RDTSC is not C2/C3
invariant, and which fall to HPET hardware, this means that the call
has both the penalty of the syscall and of the uncached hw behind the
QPI or PCIe connection to the sought bridge.  Nothing can me done
against the access latency, but the syscall overhead can be removed.
System already provides mappable /dev/hpetX devices, which gives
straight access to the HPET registers page.

Add yet another algorithm to the x86 'vdso' timehands. Libc is updated
to handle both RDTSC and HPET.  For HPET, the index of the hpet device
to mmap is passed from kernel to userspace, index might be changed and
libc invalidates its mapping as needed.

Remove cpu_fill_vdso_timehands() KPI, instead require that
timecounters which can be used from userspace, to provide
tc_fill_vdso_timehands{,32}() methods.  Merge i386 and amd64
libc/<arch>/sys/__vdso_gettc.c into one source file in the new
libc/x86/sys location.  __vdso_gettc() internal interface is changed
to move timecounter algorithm detection into the MD code.

Measurements show that RDTSC even with the syscall overhead is faster
than userspace HPET access.  But still, userspace HPET is three-four
times faster than syscall HPET on several Core2 and SandyBridge
machines.

Tested by:	Howard Su <howard0su@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D7473
2016-08-17 09:52:09 +00:00
..
xen xen: Code cleanup and small bug fixes 2015-10-21 10:44:07 +00:00
_align.h Implement _ALIGN() using internal integer types. 2016-05-31 13:31:19 +00:00
_inttypes.h
_limits.h
_stdint.h Add missing dependency on <machine/_limits.h>. 2016-05-31 08:38:24 +00:00
_types.h Add missing dependency on <machine/_limits.h>. 2016-05-31 08:36:39 +00:00
acpica_machdep.h If x86 CPU implementation of the MWAIT instruction reasonably 2015-05-09 12:28:48 +00:00
apicreg.h Add defines for the LAPIC TSC deadline timer mode. The LVT timer mode 2016-03-28 09:43:40 +00:00
apicvar.h hyperv/vmbus: Rename ISR functions 2016-05-31 04:47:53 +00:00
apm_bios.h
bus.h Better support memory mapped console devices, such as VGA and EFI 2015-08-12 15:26:32 +00:00
busdma_impl.h
cputypes.h Move shared variables from {amd64,i386}/initcpu.c to x86/identcpu.c. 2015-12-23 21:41:42 +00:00
dump.h
elf.h
endian.h
fdt.h
float.h Rationalize BSD license on sys/*/include/float.h 2015-08-05 17:05:35 +00:00
fpu.h
frame.h
init.h
legacyvar.h Convert rman to use rman_res_t instead of u_long 2016-01-27 02:23:54 +00:00
mca.h Reassign copyright statements on several files from Advanced 2015-04-23 14:22:20 +00:00
metadata.h Move amd64 metadata.h to x86 and share with i386 2016-01-07 19:47:26 +00:00
mptable.h
ofw_machdep.h Add missing ofw_machdep.h. Make x86 ofw_machdep.h work pc98 too. 2015-08-28 15:41:09 +00:00
pci_cfgreg.h Convert rman to use rman_res_t instead of u_long 2016-01-27 02:23:54 +00:00
psl.h
ptrace.h Add x86 PT_GETFSBASE, PT_GETGSBASE machine-depended ptrace requests to 2015-06-29 07:07:24 +00:00
pvclock.h
reg.h
segments.h Remove support for Xen PV domU kernels. Support for HVM domU kernels 2015-04-30 15:48:48 +00:00
setjmp.h
sigframe.h
signal.h
specialreg.h Add x86 CPU features definitions published in the Intel SDM rev. 58. 2016-04-16 06:07:13 +00:00
stack.h Add stack_save_td_running(), a function to trace the kernel stack of a 2015-09-11 03:54:37 +00:00
stdarg.h
sysarch.h
trap.h
ucontext.h POSIX states that #include <signal.h> shall make both mcontext_t and 2016-02-12 07:38:19 +00:00
vdso.h Implement userspace gettimeofday(2) with HPET timecounter. 2016-08-17 09:52:09 +00:00
vmware.h
x86_smp.h Merge common parts of i386 and amd64 md_var.h and smp.h into 2015-12-07 17:41:20 +00:00
x86_var.h re-enable AMD Topology extension on certain models if disabled by BIOS 2016-04-12 13:30:39 +00:00