linux/include/asm-powerpc
Paul Mackerras c6622f63db powerpc: Implement accurate task and CPU time accounting
This implements accurate task and cpu time accounting for 64-bit
powerpc kernels.  Instead of accounting a whole jiffy of time to a
task on a timer interrupt because that task happened to be running at
the time, we now account time in units of timebase ticks according to
the actual time spent by the task in user mode and kernel mode.  We
also count the time spent processing hardware and software interrupts
accurately.  This is conditional on CONFIG_VIRT_CPU_ACCOUNTING.  If
that is not set, we do tick-based approximate accounting as before.

To get this accurate information, we read either the PURR (processor
utilization of resources register) on POWER5 machines, or the timebase
on other machines on

* each entry to the kernel from usermode
* each exit to usermode
* transitions between process context, hard irq context and soft irq
  context in kernel mode
* context switches.

On POWER5 systems with shared-processor logical partitioning we also
read both the PURR and the timebase at each timer interrupt and
context switch in order to determine how much time has been taken by
the hypervisor to run other partitions ("steal" time).  Unfortunately,
since we need values of the PURR on both threads at the same time to
accurately calculate the steal time, and since we can only calculate
steal time on a per-core basis, the apportioning of the steal time
between idle time (time which we ceded to the hypervisor in the idle
loop) and actual stolen time is somewhat approximate at the moment.

This is all based quite heavily on what s390 does, and it uses the
generic interfaces that were added by the s390 developers,
i.e. account_system_time(), account_user_time(), etc.

This patch doesn't add any new interfaces between the kernel and
userspace, and doesn't change the units in which time is reported to
userspace by things such as /proc/stat, /proc/<pid>/stat, getrusage(),
times(), etc.  Internally the various task and cpu times are stored in
timebase units, but they are converted to USER_HZ units (1/100th of a
second) when reported to userspace.  Some precision is therefore lost
but there should not be any accumulating error, since the internal
accumulation is at full precision.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-02-24 14:05:56 +11:00
..
iseries [PATCH] powerpc: iSeries fixes for build with no PCI 2006-01-12 20:09:30 +11:00
8253pit.h
a.out.h
abs_addr.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
agp.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
asm-compat.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
atomic.h [PATCH] powerpc: reformat atomic_add_unless 2006-01-13 21:18:54 +11:00
auxvec.h
backlight.h
bitops.h [PATCH] powerpc: use lwsync in atomics, bitops, lock functions 2006-01-13 21:18:50 +11:00
bootx.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
btext.h [PATCH] powerpc: Unify udbg (#2) 2006-01-09 14:49:54 +11:00
bug.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
bugs.h
byteorder.h
cache.h [PATCH] Kill L1_CACHE_SHIFT_MAX 2006-01-08 20:13:39 -08:00
cacheflush.h
checksum.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
compat.h [PATCH] powerpc signal __user annotations 2006-02-08 01:03:46 -05:00
cputable.h powerpc: Implement accurate task and CPU time accounting 2006-02-24 14:05:56 +11:00
cputime.h powerpc: Implement accurate task and CPU time accounting 2006-02-24 14:05:56 +11:00
current.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
dbdma.h
delay.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
div64.h
dma-mapping.h [PATCH] remove bogus asm/bug.h includes. 2006-02-07 20:56:35 -05:00
dma.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
eeh.h [PATCH] powerpc: PCI Error Recovery: PPC64 core recovery routines 2006-01-10 15:28:32 +11:00
eeh_event.h [PATCH] powerpc: PCI Error Recovery: PPC64 core recovery routines 2006-01-10 15:28:32 +11:00
elf.h powerpc: Provide a suitable AT_PLATFORM value 2006-01-14 10:11:39 +11:00
emergency-restart.h
errno.h
fcntl.h
firmware.h [PATCH] powerpc: Move pSeries firmware feature setup into platforms/pseries 2006-02-10 16:52:03 +11:00
floppy.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
futex.h [PATCH] powerpc: use lwsync in atomics, bitops, lock functions 2006-01-13 21:18:50 +11:00
grackle.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
hardirq.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
heathrow.h powerpc: Fix some #ifndef __KERNEL__ that should be #ifdef 2006-01-09 15:14:05 +11:00
hvcall.h [PATCH] powerpc: Add some more pSeries hypervisor call constants 2006-01-13 20:56:38 +11:00
hvconsole.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
hvcserver.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
hw_irq.h
i8259.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
ibmebus.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
ide.h
io.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
ioctl.h
ioctls.h
iommu.h [PATCH] powerpc: clean up iommu.h a bit 2006-01-12 20:09:30 +11:00
ipc.h
ipcbuf.h
ipic.h [PATCH] powerpc: moved ipic code to arch/powerpc 2006-01-09 14:48:57 +11:00
irq.h powerpc: Implement accurate task and CPU time accounting 2006-02-24 14:05:56 +11:00
kdebug.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
kdump.h [PATCH] powerpc: Reroute interrupts from 0 + offset to PHYSICAL_START + offset 2006-01-09 14:52:21 +11:00
kexec.h [PATCH] powerpc: fix for kexec ppc32 2006-02-01 08:53:19 -08:00
keylargo.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
kmap_types.h
kprobes.h [PATCH] kprobes: fix build breakage 2006-01-10 08:01:40 -08:00
linkage.h
lmb.h [PATCH] powerpc: Put parameter names in lmb.h prototypes 2006-02-07 22:38:37 +11:00
local.h
lppaca.h [PATCH] Fix sparse parse error in lppaca.h 2006-01-17 17:18:25 -08:00
machdep.h [PATCH] cell: enable pause(0) in cpu_idle 2006-01-09 15:44:32 +11:00
macio.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
mc146818rtc.h
mediabay.h
mman.h [PATCH] add asm-generic/mman.h 2006-02-15 15:32:22 -08:00
mmu.h [PATCH] powerpc: Only calculate htab_size in one place for kexec 2006-02-24 11:36:18 +11:00
mmu_context.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
mmzone.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
module.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
mpic.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
msgbuf.h
mutex.h [PATCH] mutex subsystem, add default include/asm-*/mutex.h files 2006-01-09 15:59:19 -08:00
namei.h
numnodes.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
nvram.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
of_device.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
ohare.h powerpc: Fix some #ifndef __KERNEL__ that should be #ifdef 2006-01-09 15:14:05 +11:00
oprofile_impl.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
pSeries_reconfig.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
paca.h powerpc: Implement accurate task and CPU time accounting 2006-02-24 14:05:56 +11:00
page.h powerpc/32: Fix compile error caused by pud_t/pgt_t confusion 2006-01-11 16:27:21 +11:00
page_32.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
page_64.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
param.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
parport.h [PATCH] powerpc: parallel port init fix 2006-01-11 14:49:24 +11:00
pci-bridge.h [PATCH] powerpc: small pci cleanups 2006-01-12 20:09:30 +11:00
pci.h [PATCH] powerpc: make pcibios_claim_one_bus available to other code 2006-01-09 14:51:08 +11:00
percpu.h [PATCH] powerpc/64: per cpu data optimisations 2006-01-11 14:49:45 +11:00
pgalloc.h [PATCH] powerpc: Fix accidentally-working typo in __pud_free_tlb 2006-02-17 13:59:27 -08:00
pgtable-4k.h
pgtable-64k.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
pgtable.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
pmac_feature.h [PATCH] 3/5 powerpc: Add platform functions interpreter 2006-01-09 15:47:18 +11:00
pmac_low_i2c.h [PATCH] 3/5 powerpc: Add platform functions interpreter 2006-01-09 15:47:18 +11:00
pmac_pfunc.h [PATCH] powerpc: enable irq's for platform functions. 2006-02-01 08:53:10 -08:00
pmc.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
poll.h
posix_types.h
ppc-pci.h [PATCH] powerpc: Save device BARs much earlier in the boot sequence 2006-01-10 15:30:39 +11:00
ppc_asm.h powerpc: Implement accurate task and CPU time accounting 2006-02-24 14:05:56 +11:00
processor.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
prom.h [PATCH] powerpc: Don't overwrite flat device tree with kdump kernel 2006-02-07 21:32:44 +11:00
ptrace.h [PATCH] syscall entry/exit revamp 2006-01-09 14:49:01 +11:00
reg.h [PATCH] powerpc: Fix runlatch performance issues 2006-02-24 11:36:31 +11:00
reg_8xx.h
resource.h
rtas.h [PATCH] powerpc: Make early debugging configurable via Kconfig 2006-01-11 14:48:26 +11:00
rtc.h
rwsem.h [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
scatterlist.h
seccomp.h powerpc: Fix some #ifndef __KERNEL__ that should be #ifdef 2006-01-09 15:14:05 +11:00
sections.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
semaphore.h
sembuf.h
serial.h powerpc: Introduce a new config symbol to control 16550 early debug code 2006-01-10 16:19:05 +11:00
setup.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
smp.h
smu.h [PATCH] powerpc: Thermal control for dual core G5s 2006-02-07 22:05:14 -08:00
socket.h
sockios.h
sparsemem.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
spinlock.h [PATCH] powerpc: use lwsync in atomics, bitops, lock functions 2006-01-13 21:18:50 +11:00
spinlock_types.h
spu.h [PATCH] spufs: set irq affinity for running threads 2006-01-09 15:44:57 +11:00
spu_csa.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
sstep.h
stat.h
statfs.h
string.h
synch.h [PATCH] powerpc: use lwsync in atomics, bitops, lock functions 2006-01-13 21:18:50 +11:00
system.h powerpc: Implement accurate task and CPU time accounting 2006-02-24 14:05:56 +11:00
tce.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
termbits.h
termios.h
thread_info.h [PATCH] powerpc: Fix runlatch performance issues 2006-02-24 11:36:31 +11:00
time.h powerpc: Implement accurate task and CPU time accounting 2006-02-24 14:05:56 +11:00
timex.h
tlb.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
tlbflush.h
topology.h [PATCH] scheduler cache-hot-autodetect 2006-01-12 09:08:50 -08:00
types.h
uaccess.h
ucontext.h
udbg.h [PATCH] powerpc: Make early debugging configurable via Kconfig 2006-01-11 14:48:26 +11:00
unaligned.h
uninorth.h
unistd.h [PATCH] powerpc: unshare system call registration 2006-02-10 16:34:54 +11:00
user.h
vdso.h
vdso_datapage.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
vga.h
vio.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
xmon.h
xor.h