freebsd-dev/sys/i386
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
..
acpica For every instance of '.if ${CC} == "foo"' or '.if ${CC} != "foo"' in 2010-08-17 20:39:28 +00:00
bios Introduce the new kernel sub-tree x86 which should contain all the code 2010-02-25 14:13:39 +00:00
compile
conf Fix whitespace nits. 2010-08-06 18:46:27 +00:00
i386 Refactor timer management code with priority to one-shot operation mode. 2010-09-13 07:25:35 +00:00
ibcs2 Regenerate 2010-06-28 18:17:21 +00:00
include Refactor timer management code with priority to one-shot operation mode. 2010-09-13 07:25:35 +00:00
isa Simplify fldcw() macro. There is no reason to use pointer here. No object 2010-07-26 23:20:55 +00:00
linux The interpreter name should no longer be treated as a buffer that can be 2010-07-28 04:47:40 +00:00
pci Change the MPTable and $PIR PCI-PCI bridge drivers to inherit from the 2010-08-05 17:48:37 +00:00
svr4 Change some movl's to mov's. Newer GAS no longer accept 'movl' instructions 2009-01-31 11:37:21 +00:00
xbox Update d_mmap() to accept vm_ooffset_t and vm_memattr_t. 2009-12-29 21:51:28 +00:00
xen Update various places that store or manipulate CPU masks to use cpumask_t 2010-08-11 23:22:53 +00:00
Makefile Update entries for building tags. 2007-05-13 18:21:54 +00:00