diff options
author | Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> | 2008-01-29 00:27:30 -0500 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2008-02-20 15:55:37 -0500 |
commit | b64f34cdfe5bef9dfed1304c513220b0f2862eca (patch) | |
tree | 04cb9216a9de18afcb27f9bac3fda1f3c7bacbbd /arch/ia64/kernel/fsys.S | |
parent | 5d9c4a7de64d398604a978d267a6987f1f4025b7 (diff) |
[IA64] VIRT_CPU_ACCOUNTING (accurate cpu time accounting)
This patch implements VIRT_CPU_ACCOUNTING for ia64,
which enable us to use more accurate cpu time accounting.
The VIRT_CPU_ACCOUNTING is an item of kernel config, which s390
and powerpc arch have. By turning this config on, these archs
change the mechanism of cpu time accounting from tick-sampling
based one to state-transition based one.
The state-transition based accounting is done by checking time
(cycle counter in processor) at every state-transition point,
such as entrance/exit of kernel, interrupt, softirq etc.
The difference between point to point is the actual time consumed
during in the state. There is no doubt about that this value is
more accurate than that of tick-sampling based accounting.
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/kernel/fsys.S')
-rw-r--r-- | arch/ia64/kernel/fsys.S | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S index 44841971f077..c932d86e2d81 100644 --- a/arch/ia64/kernel/fsys.S +++ b/arch/ia64/kernel/fsys.S | |||
@@ -660,7 +660,11 @@ GLOBAL_ENTRY(fsys_bubble_down) | |||
660 | nop.i 0 | 660 | nop.i 0 |
661 | ;; | 661 | ;; |
662 | mov ar.rsc=0 // M2 set enforced lazy mode, pl 0, LE, loadrs=0 | 662 | mov ar.rsc=0 // M2 set enforced lazy mode, pl 0, LE, loadrs=0 |
663 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | ||
664 | mov.m r30=ar.itc // M get cycle for accounting | ||
665 | #else | ||
663 | nop.m 0 | 666 | nop.m 0 |
667 | #endif | ||
664 | nop.i 0 | 668 | nop.i 0 |
665 | ;; | 669 | ;; |
666 | mov r23=ar.bspstore // M2 (12 cyc) save ar.bspstore | 670 | mov r23=ar.bspstore // M2 (12 cyc) save ar.bspstore |
@@ -682,6 +686,28 @@ GLOBAL_ENTRY(fsys_bubble_down) | |||
682 | cmp.ne pKStk,pUStk=r0,r0 // A set pKStk <- 0, pUStk <- 1 | 686 | cmp.ne pKStk,pUStk=r0,r0 // A set pKStk <- 0, pUStk <- 1 |
683 | br.call.sptk.many b7=ia64_syscall_setup // B | 687 | br.call.sptk.many b7=ia64_syscall_setup // B |
684 | ;; | 688 | ;; |
689 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | ||
690 | // mov.m r30=ar.itc is called in advance | ||
691 | add r16=TI_AC_STAMP+IA64_TASK_SIZE,r2 | ||
692 | add r17=TI_AC_LEAVE+IA64_TASK_SIZE,r2 | ||
693 | ;; | ||
694 | ld8 r18=[r16],TI_AC_STIME-TI_AC_STAMP // time at last check in kernel | ||
695 | ld8 r19=[r17],TI_AC_UTIME-TI_AC_LEAVE // time at leave kernel | ||
696 | ;; | ||
697 | ld8 r20=[r16],TI_AC_STAMP-TI_AC_STIME // cumulated stime | ||
698 | ld8 r21=[r17] // cumulated utime | ||
699 | sub r22=r19,r18 // stime before leave kernel | ||
700 | ;; | ||
701 | st8 [r16]=r30,TI_AC_STIME-TI_AC_STAMP // update stamp | ||
702 | sub r18=r30,r19 // elapsed time in user mode | ||
703 | ;; | ||
704 | add r20=r20,r22 // sum stime | ||
705 | add r21=r21,r18 // sum utime | ||
706 | ;; | ||
707 | st8 [r16]=r20 // update stime | ||
708 | st8 [r17]=r21 // update utime | ||
709 | ;; | ||
710 | #endif | ||
685 | mov ar.rsc=0x3 // M2 set eager mode, pl 0, LE, loadrs=0 | 711 | mov ar.rsc=0x3 // M2 set eager mode, pl 0, LE, loadrs=0 |
686 | mov rp=r14 // I0 set the real return addr | 712 | mov rp=r14 // I0 set the real return addr |
687 | and r3=_TIF_SYSCALL_TRACEAUDIT,r3 // A | 713 | and r3=_TIF_SYSCALL_TRACEAUDIT,r3 // A |