aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/cputable.h
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-02-23 18:06:59 -0500
committerPaul Mackerras <paulus@samba.org>2006-02-23 22:05:56 -0500
commitc6622f63db86fcbd41bf6fe05ddf2e00c1e51ced (patch)
tree102f3ea0a891212603a3722fece337d6a74d450c /include/asm-powerpc/cputable.h
parenta00428f5b149e36b8225b2a0812742a6dfb07b8c (diff)
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>
Diffstat (limited to 'include/asm-powerpc/cputable.h')
-rw-r--r--include/asm-powerpc/cputable.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 90d005bb4d1c..99d12ff6346c 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -117,6 +117,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
117#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000) 117#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000)
118#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000) 118#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000)
119#define CPU_FTR_PAUSE_ZERO ASM_CONST(0x0000200000000000) 119#define CPU_FTR_PAUSE_ZERO ASM_CONST(0x0000200000000000)
120#define CPU_FTR_PURR ASM_CONST(0x0000400000000000)
120#else 121#else
121/* ensure on 32b processors the flags are available for compiling but 122/* ensure on 32b processors the flags are available for compiling but
122 * don't do anything */ 123 * don't do anything */
@@ -132,6 +133,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
132#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0) 133#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0)
133#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0) 134#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0)
134#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0) 135#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0)
136#define CPU_FTR_PURR ASM_CONST(0x0)
135#endif 137#endif
136 138
137#ifndef __ASSEMBLY__ 139#ifndef __ASSEMBLY__
@@ -316,7 +318,7 @@ enum {
316 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | 318 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 |
317 CPU_FTR_MMCRA | CPU_FTR_SMT | 319 CPU_FTR_MMCRA | CPU_FTR_SMT |
318 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | 320 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE |
319 CPU_FTR_MMCRA_SIHV, 321 CPU_FTR_MMCRA_SIHV | CPU_FTR_PURR,
320 CPU_FTRS_CELL = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | 322 CPU_FTRS_CELL = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
321 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | 323 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 |
322 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | 324 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT |