kernel-ark/arch/powerpc/kernel
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
..
vdso32 [PATCH] powerpc: Add some missing .gitignore's 2006-01-11 15:35:35 +11:00
vdso64 [PATCH] powerpc: Add some missing .gitignore's 2006-01-11 15:35:35 +11:00
align.c
asm-offsets.c powerpc: Implement accurate task and CPU time accounting 2006-02-24 14:05:56 +11:00
binfmt_elf32.c
btext.c [PATCH] powerpc: Remove device_node addrs/n_addr 2006-01-09 14:53:55 +11:00
cpu_setup_power4.S [PATCH] powerpc: Cleanup LOADADDR etc. asm macros 2006-01-13 21:16:23 +11:00
cputable.c [PATCH] powerpc: Add Virtex-4 FX to cpu table 2006-02-07 22:36:00 +11:00
crash_dump.c powerpc: Fix compile error when CONFIG_PROC_VMCORE is not defined 2006-01-11 15:30:07 +11:00
crash.c [PATCH] powerpc: Trivial fix to set the proper timeout value for kdump 2006-02-24 11:36:21 +11:00
dma_64.c [PATCH] powerpc: IBMEBUS bus support 2006-01-09 14:49:06 +11:00
entry_32.S [PATCH] TIF_RESTORE_SIGMASK support for arch/powerpc 2006-01-18 19:20:30 -08:00
entry_64.S powerpc: Implement accurate task and CPU time accounting 2006-02-24 14:05:56 +11:00
firmware.c [PATCH] powerpc: Move pSeries firmware feature setup into platforms/pseries 2006-02-10 16:52:03 +11:00
fpu.S powerpc/64: Fix bug in setting floating-point exception mode 2006-02-07 13:55:30 +11:00
head_4xx.S
head_8xx.S [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
head_32.S [PATCH] powerpc: fix altivec_unavailable_exception Oopses 2006-02-24 11:36:23 +11:00
head_44x.S [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
head_64.S powerpc: Implement accurate task and CPU time accounting 2006-02-24 14:05:56 +11:00
head_booke.h [PATCH] powerpc: Fix Kernel FP unavail exception for BookE 2006-02-10 16:51:50 +11:00
head_fsl_booke.S [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
ibmebus.c [PATCH] powerpc: IBMEBUS bus support 2006-01-09 14:49:06 +11:00
idle_6xx.S
idle_64.c
idle_power4.S [PATCH] powerpc: Cleanup LOADADDR etc. asm macros 2006-01-13 21:16:23 +11:00
init_task.c
iomap.c [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
iommu.c [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
irq.c powerpc: Implement accurate task and CPU time accounting 2006-02-24 14:05:56 +11:00
kprobes.c [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
legacy_serial.c [PATCH] CONFIG_ISA does not make sense for CONFIG_PPC_PSERIES 2006-02-01 08:53:08 -08:00
lparcfg.c [PATCH] powerpc: Fix OOPS in lparcfg on G5 2006-02-20 10:44:34 +11:00
lparmap.c [PATCH] powerpc: Fix iSeries bug in VMALLOCBASE/VMALLOC_START consolidation 2006-01-09 15:06:06 +11:00
machine_kexec_32.c [PATCH] powerpc: Merge kexec 2006-01-09 14:48:52 +11:00
machine_kexec_64.c [PATCH] powerpc: Only calculate htab_size in one place for kexec 2006-02-24 11:36:18 +11:00
machine_kexec.c [PATCH] powerpc: remove remaining crash_notes variable from machine_kexec.c 2006-01-11 14:48:02 +11:00
Makefile ppc: Use the system call table from arch/powerpc/kernel/systbl.S 2006-02-10 16:02:20 +11:00
misc_32.S [PATCH] powerpc: Cleanup LOADADDR etc. asm macros 2006-01-13 21:16:23 +11:00
misc_64.S [PATCH] powerpc: Cleanup LOADADDR etc. asm macros 2006-01-13 21:16:23 +11:00
module_64.c
nvram_64.c [PATCH] powerpc: fix large nvram access 2006-01-09 14:53:31 +11:00
of_device.c [PATCH] Add of_platform_bus_type probe and remove methods 2006-01-13 11:26:06 -08:00
paca.c [PATCH] powerpc: Remove lppaca structure from the PACA 2006-01-13 21:17:39 +11:00
pci_32.c powerpc/32: Restore previous version of 32-bit PCI code 2006-01-15 22:05:47 +11:00
pci_64.c [PATCH] powerpc: small pci cleanups 2006-01-12 20:09:30 +11:00
pci_direct_iommu.c
pci_dn.c
pci_iommu.c [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
pmc.c [PATCH] powerpc: G4+ oprofile support 2006-01-09 15:06:03 +11:00
ppc32.h
ppc_ksyms.c Merge ../powerpc-merge 2006-02-24 14:05:47 +11:00
proc_ppc64.c
process.c powerpc: Implement accurate task and CPU time accounting 2006-02-24 14:05:56 +11:00
prom_init.c [PATCH] powerpc64: remove broken/bitrotted HMT support 2006-02-24 11:36:33 +11:00
prom_parse.c [PATCH] powerpc: add refcounting to setup_peg2 and of_get_pci_address 2006-02-07 21:32:45 +11:00
prom.c [PATCH] powerpc: Always panic if lmb_alloc() fails 2006-02-07 22:38:34 +11:00
ptrace32.c [PATCH] use ptrace_get_task_struct in various places 2006-01-08 20:13:51 -08:00
ptrace-common.h [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
ptrace.c
rtas_flash.c [PATCH] Don't check pointer for NULL before passing it to kfree [arch/powerpc/kernel/rtas_flash.c] 2006-02-07 21:51:53 +11:00
rtas_pci.c [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
rtas-proc.c [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
rtas-rtc.c
rtas.c [PATCH] powerpc: remove useless call to touch_softlockup_watchdog 2006-02-07 21:32:44 +11:00
semaphore.c
setup_32.c powerpc: Introduce a new config symbol to control 16550 early debug code 2006-01-10 16:19:05 +11:00
setup_64.c [PATCH] powerpc: Don't start secondary CPUs in a UP && KEXEC kernel 2006-02-20 12:03:34 +11:00
setup-common.c [PATCH] powerpc: Allow for ppc_md restart, power_off, and halt to be NULL 2006-01-14 11:12:23 +11:00
setup.h
signal_32.c [PATCH] powerpc signal __user annotations 2006-02-08 01:03:46 -05:00
signal_64.c [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
smp-tbsync.c
smp.c powerpc: Implement accurate task and CPU time accounting 2006-02-24 14:05:56 +11:00
sys_ppc32.c powerpc: Keep xtime and gettimeofday in sync 2006-02-20 10:38:56 +11:00
syscalls.c [PATCH] ppc64: fix time syscall 2006-01-09 15:47:13 +11:00
sysfs.c
systbl.S [PATCH] powerpc: unshare system call registration 2006-02-10 16:34:54 +11:00
time.c powerpc: Implement accurate task and CPU time accounting 2006-02-24 14:05:56 +11:00
traps.c [PATCH] cell: enable pause(0) in cpu_idle 2006-01-09 15:44:32 +11:00
udbg_16550.c [PATCH] powerpc: fix compile warning in udbg_init_maple_realmode 2006-02-07 21:51:52 +11:00
udbg.c [PATCH] powerpc: Make early debugging configurable via Kconfig 2006-01-11 14:48:26 +11:00
vdso.c [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
vecemu.c
vector.S
vio.c [PATCH] Add vio_bus_type probe and remove methods 2006-01-13 11:26:07 -08:00
vmlinux.lds.S