freebsd-nq/sys/i386/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
..
apic_vector.s Clear DF bit in eflags/rflags on the kernel entry. The i386 and amd64 2010-06-23 20:44:07 +00:00
atomic.c
atpic_vector.s Clear DF bit in eflags/rflags on the kernel entry. The i386 and amd64 2010-06-23 20:44:07 +00:00
autoconf.c
bios.c
bioscall.s
bpf_jit_machdep.c If a conditional jump instruction has the same jt and jf, do not perform 2010-04-22 23:47:19 +00:00
bpf_jit_machdep.h If a conditional jump instruction has the same jt and jf, do not perform 2010-04-22 23:47:19 +00:00
busdma_machdep.c Reduce the number of bounce zones (and thus the number of bounce pages 2009-04-23 20:24:19 +00:00
db_disasm.c
db_interface.c
db_trace.c
dump_machdep.c - revert pmap_kenter_temporary to taking a physical address 2009-12-10 03:09:35 +00:00
elan-mmcr.c Update d_mmap() to accept vm_ooffset_t and vm_memattr_t. 2009-12-29 21:51:28 +00:00
elf_machdep.c Reorganize syscall entry and leave handling. 2010-05-23 18:32:02 +00:00
exception.s Register an interrupt vector for DTrace return probes. There is some 2010-08-28 08:03:29 +00:00
gdb_machdep.c
genassym.c MFamd64: r210615 2010-07-29 17:00:41 +00:00
geode.c Apply a patch that has been lingering in my inbox for far too long: 2010-05-15 10:31:11 +00:00
i686_mem.c Enable MTRR on all VIA CPUs that claim support. 2010-01-31 14:35:49 +00:00
identcpu.c Remove unused i586 optimized bcopy/bzero/etc implementations that utilize 2010-06-23 10:40:28 +00:00
in_cksum.c
initcpu.c Tweak the logic to disable CLFLUSH in virtual environments to work around 2010-08-02 17:01:23 +00:00
intr_machdep.c Revert r209638. After commit, there appeared to be more people who liked 2010-07-02 17:22:15 +00:00
io.c - Extract the IODEV_PIO interface from ia64 and make it MI. 2010-04-28 15:38:01 +00:00
k6_mem.c
legacy.c bus_add_child: change type of order parameter to u_int 2010-09-10 11:19:03 +00:00
locore.s Simplify pmap_init(). Additionally, correct a harmless misbehavior on i386. 2010-01-11 16:01:20 +00:00
longrun.c
machdep.c Refactor timer management code with priority to one-shot operation mode. 2010-09-13 07:25:35 +00:00
mem.c Update d_mmap() to accept vm_ooffset_t and vm_memattr_t. 2009-12-29 21:51:28 +00:00
minidump_machdep.c for PV XEN translate page table entries from machine (real) to physical (logical) addresses so that kgdb can 2009-12-10 07:48:47 +00:00
mp_clock.c
mp_machdep.c Refactor timer management code with priority to one-shot operation mode. 2010-09-13 07:25:35 +00:00
mp_watchdog.c
mpboot.s Switch to our preferred 2-clause BSD license. 2010-04-07 18:26:13 +00:00
mptable_pci.c Change the MPTable and $PIR PCI-PCI bridge drivers to inherit from the 2010-08-05 17:48:37 +00:00
mptable.c
nexus.c bus_add_child: change type of order parameter to u_int 2010-09-10 11:19:03 +00:00
perfmon.c
pmap.c - The iMac9,1 needs the PAT workaround as well 2010-08-17 12:17:24 +00:00
ptrace_machdep.c Introduce the x86 kernel interfaces to allow kernel code to use 2010-06-05 15:59:59 +00:00
stack_machdep.c
support.s Remove unused i586 optimized bcopy/bzero/etc implementations that utilize 2010-06-23 10:40:28 +00:00
swtch.s MFamd64: r210615 2010-07-29 17:00:41 +00:00
symbols.raw
sys_machdep.c Replace AUDIT_ARG() with variable argument macros with a set more more 2009-06-27 13:58:44 +00:00
trap.c Sync DTrace bits with amd64 and fix the build. 2010-08-26 11:22:12 +00:00
tsc.c Don't pass sizeof(u_int) to an argument of SYSCLT_PROC that ends up not 2010-08-08 20:34:53 +00:00
uio_machdep.c
vm86.c
vm86bios.s
vm_machdep.c Update various places that store or manipulate CPU masks to use cpumask_t 2010-08-11 23:22:53 +00:00