freebsd-skq/sys/amd64/include
Alexander Motin a157e42516 Refactor timer management code with priority to one-shot operation mode.
The main goal of this is to generate timer interrupts only when there is
some work to do. When CPU is busy interrupts are generating at full rate
of hz + stathz to fullfill scheduler and timekeeping requirements. But
when CPU is idle, only minimum set of interrupts (down to 8 interrupts per
second per CPU now), needed to handle scheduled callouts is executed.
This allows significantly increase idle CPU sleep time, increasing effect
of static power-saving technologies. Also it should reduce host CPU load
on virtualized systems, when guest system is idle.

There is set of tunables, also available as writable sysctls, allowing to
control wanted event timer subsystem behavior:
  kern.eventtimer.timer - allows to choose event timer hardware to use.
On x86 there is up to 4 different kinds of timers. Depending on whether
chosen timer is per-CPU, behavior of other options slightly differs.
  kern.eventtimer.periodic - allows to choose periodic and one-shot
operation mode. In periodic mode, current timer hardware taken as the only
source of time for time events. This mode is quite alike to previous kernel
behavior. One-shot mode instead uses currently selected time counter
hardware to schedule all needed events one by one and program timer to
generate interrupt exactly in specified time. Default value depends of
chosen timer capabilities, but one-shot mode is preferred, until other is
forced by user or hardware.
  kern.eventtimer.singlemul - in periodic mode specifies how much times
higher timer frequency should be, to not strictly alias hardclock() and
statclock() events. Default values are 2 and 4, but could be reduced to 1
if extra interrupts are unwanted.
  kern.eventtimer.idletick - makes each CPU to receive every timer interrupt
independently of whether they busy or not. By default this options is
disabled. If chosen timer is per-CPU and runs in periodic mode, this option
has no effect - all interrupts are generating.

As soon as this patch modifies cpu_idle() on some platforms, I have also
refactored one on x86. Now it makes use of MONITOR/MWAIT instrunctions
(if supported) under high sleep/wakeup rate, as fast alternative to other
methods. It allows SMP scheduler to wake up sleeping CPUs much faster
without using IPI, significantly increasing performance on some highly
task-switching loads.

Tested by:	many (on i386, amd64, sparc64 and powerc)
H/W donated by:	Gheorghe Ardelean
Sponsored by:	iXsystems, Inc.
2010-09-13 07:25:35 +00:00
..
pc A simple rewrite of biossmap.c: 2009-04-15 17:31:22 +00:00
xen Switch to our preferred 2-clause BSD license. 2010-05-05 20:39:02 +00:00
_align.h Get rid of the _NO_NAMESPACE_POLLUTION kludge by creating an 2009-09-08 20:45:40 +00:00
_bus.h
_inttypes.h The NetBSD Foundation has granted permission to remove clause 3 and 4 from 2010-03-03 17:55:51 +00:00
_limits.h
_stdint.h
_types.h Translate from the i386. All FP constants and operations are evaluated 2008-01-17 13:12:46 +00:00
acpica_machdep.h Extract the code to find and map the MADT ACPI table during early kernel 2009-09-23 15:42:35 +00:00
apicreg.h Add support for corrected machine check interrupts. CMCI is a new local 2010-05-24 15:45:05 +00:00
apicvar.h Refactor timer management code with priority to one-shot operation mode. 2010-09-13 07:25:35 +00:00
apm_bios.h Copy apm(4) emulation from sys/i386/acpica/acpi_machdep.c and 2009-09-27 14:00:16 +00:00
asm.h Define an END() macro for use in i386 and amd64 assembly code, akin 2007-08-22 04:26:07 +00:00
asmacros.h Clear DF bit in eflags/rflags on the kernel entry. The i386 and amd64 2010-06-23 20:44:07 +00:00
atomic.h Rename an argument from "exp" to "expect" since the former makes FlexeLint 2010-05-20 06:18:03 +00:00
bus_dma.h
bus.h
clock.h Move functions declaration to MI code, following implementation. 2010-07-15 17:49:35 +00:00
cpu.h Remove obsolete undef of COPY_SIGCODE. It appears to have not been 2010-07-13 15:06:13 +00:00
cpufunc.h Change the parameter passed to the inline assembly to u_short 2010-09-03 14:25:17 +00:00
cputypes.h Add Centaur/IDT/VIA vendor ID for Nano family, which has long mode support. 2009-01-05 21:51:49 +00:00
db_machdep.h
elf.h Supply some useful information to the started image using ELF aux vectors. 2010-08-17 08:55:45 +00:00
endian.h Also remove the unused __word_swap_int*() macros. 2009-04-08 19:10:20 +00:00
exec.h
float.h Translate from the i386. All FP constants and operations are evaluated 2008-01-17 13:12:46 +00:00
floatingpoint.h
fpu.h Introduce the x86 kernel interfaces to allow kernel code to use 2010-06-05 15:59:59 +00:00
frame.h Save and restore segment registers on amd64 when entering and leaving 2009-04-01 13:09:26 +00:00
gdb_machdep.h
ieeefp.h Fix fpset*() to not trap if there is a currently unmasked exception. 2008-01-11 17:11:32 +00:00
in_cksum.h
intr_machdep.h Add a facility for associating optional descriptions with active interrupt 2009-10-15 14:54:35 +00:00
iodev.h - Extract the IODEV_PIO interface from ia64 and make it MI. 2010-04-28 15:38:01 +00:00
kdb.h Add kdb_cpu_sync_icache(), intended to synchronize instruction 2007-06-09 21:55:17 +00:00
legacyvar.h Companion for r188301: fix the prototypes. 2009-02-08 07:03:34 +00:00
limits.h
mca.h Restore the machine check register banks on resume. For banks being 2010-06-15 18:51:41 +00:00
md_var.h Handle a case when non-canonical address is loaded into the fsbase or 2010-04-10 18:38:11 +00:00
memdev.h Remove the unused major/minor numbers from iodev and memdev. 2008-06-25 07:45:31 +00:00
metadata.h A simple rewrite of biossmap.c: 2009-04-15 17:31:22 +00:00
minidump.h
mp_watchdog.h
mptable.h
mutex.h
nexusvar.h Rework how the nexus(4) device works on x86 to better handle the idea of 2008-03-13 20:39:04 +00:00
param.h When compat32 binary asks for the value of hw.machine_arch, report the 2010-07-22 09:13:49 +00:00
pcb.h Rearrange struct pcb. r177532 (CVS r1.64 of pcb.h) moved pcb_flags to make 2010-08-02 18:12:30 +00:00
pci_cfgreg.h Extend the support for PCI-e memory mapped configuration space access: 2008-08-22 02:14:23 +00:00
pcpu.h Mark the __curthread() functions as __pure2 and remove the volatile keyword 2010-07-29 18:44:10 +00:00
pmap.h For both i386 and amd64 pmap, 2010-07-09 20:05:56 +00:00
pmc_mdep.h - Support for uncore counting events: one fixed PMC with the uncore 2010-04-02 13:23:49 +00:00
ppireg.h
proc.h Reorganize syscall entry and leave handling. 2010-05-23 18:32:02 +00:00
profile.h
psl.h
ptrace.h
reg.h Cosmetic tweak to use a type suffix instead of a cast to force a constant 2010-03-29 18:47:04 +00:00
reloc.h
resource.h
runq.h
segments.h Register an interrupt vector for DTrace return probes. There is some 2010-08-28 08:03:29 +00:00
setjmp.h
sf_buf.h
sigframe.h
signal.h Sync definitions for struct sigcontext for i386 and amd64 architectures 2009-04-01 13:44:28 +00:00
smp.h Add a new ipi_cpu() function to the MI IPI API that can be used to send an 2010-08-06 15:36:59 +00:00
specialreg.h Improve cputemp(4) driver wrt newer Intel processors, especially 2010-07-29 19:08:22 +00:00
stack.h Make preparations for increasing the size of the kernel virtual 2008-06-20 05:22:09 +00:00
stdarg.h
sysarch.h Remove redundant inclusion of <sys/cdefs.h>. 2010-02-20 14:13:47 +00:00
timerreg.h The "free-lance" timer in the i8254 is only used for the speaker 2008-03-26 20:09:21 +00:00
trap.h Add two DTrace trap type values. Used by fasttrap. 2010-08-24 13:13:24 +00:00
tss.h
ucontext.h Add all segment registers for the amd64 CPU to struct reg and mcontext. 2009-04-01 12:44:17 +00:00
varargs.h
vm.h Add support to the virtual memory system for configuring machine- 2009-07-12 23:31:20 +00:00
vmparam.h Very rough first cut at NUMA support for the physical page allocator. For 2010-07-27 20:33:50 +00:00