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/entry.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/entry.S')
-rw-r--r-- | arch/ia64/kernel/entry.S | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index 3c331c464b40..b0be4a280174 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S | |||
@@ -710,6 +710,16 @@ ENTRY(ia64_leave_syscall) | |||
710 | (pUStk) cmp.eq.unc p6,p0=r0,r0 // p6 <- pUStk | 710 | (pUStk) cmp.eq.unc p6,p0=r0,r0 // p6 <- pUStk |
711 | #endif | 711 | #endif |
712 | .work_processed_syscall: | 712 | .work_processed_syscall: |
713 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | ||
714 | adds r2=PT(LOADRS)+16,r12 | ||
715 | (pUStk) mov.m r22=ar.itc // fetch time at leave | ||
716 | adds r18=TI_FLAGS+IA64_TASK_SIZE,r13 | ||
717 | ;; | ||
718 | (p6) ld4 r31=[r18] // load current_thread_info()->flags | ||
719 | ld8 r19=[r2],PT(B6)-PT(LOADRS) // load ar.rsc value for "loadrs" | ||
720 | adds r3=PT(AR_BSPSTORE)+16,r12 // deferred | ||
721 | ;; | ||
722 | #else | ||
713 | adds r2=PT(LOADRS)+16,r12 | 723 | adds r2=PT(LOADRS)+16,r12 |
714 | adds r3=PT(AR_BSPSTORE)+16,r12 | 724 | adds r3=PT(AR_BSPSTORE)+16,r12 |
715 | adds r18=TI_FLAGS+IA64_TASK_SIZE,r13 | 725 | adds r18=TI_FLAGS+IA64_TASK_SIZE,r13 |
@@ -718,6 +728,7 @@ ENTRY(ia64_leave_syscall) | |||
718 | ld8 r19=[r2],PT(B6)-PT(LOADRS) // load ar.rsc value for "loadrs" | 728 | ld8 r19=[r2],PT(B6)-PT(LOADRS) // load ar.rsc value for "loadrs" |
719 | nop.i 0 | 729 | nop.i 0 |
720 | ;; | 730 | ;; |
731 | #endif | ||
721 | mov r16=ar.bsp // M2 get existing backing store pointer | 732 | mov r16=ar.bsp // M2 get existing backing store pointer |
722 | ld8 r18=[r2],PT(R9)-PT(B6) // load b6 | 733 | ld8 r18=[r2],PT(R9)-PT(B6) // load b6 |
723 | (p6) and r15=TIF_WORK_MASK,r31 // any work other than TIF_SYSCALL_TRACE? | 734 | (p6) and r15=TIF_WORK_MASK,r31 // any work other than TIF_SYSCALL_TRACE? |
@@ -737,12 +748,21 @@ ENTRY(ia64_leave_syscall) | |||
737 | 748 | ||
738 | ld8 r29=[r2],16 // M0|1 load cr.ipsr | 749 | ld8 r29=[r2],16 // M0|1 load cr.ipsr |
739 | ld8 r28=[r3],16 // M0|1 load cr.iip | 750 | ld8 r28=[r3],16 // M0|1 load cr.iip |
751 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | ||
752 | (pUStk) add r14=TI_AC_LEAVE+IA64_TASK_SIZE,r13 | ||
753 | ;; | ||
754 | ld8 r30=[r2],16 // M0|1 load cr.ifs | ||
755 | ld8 r25=[r3],16 // M0|1 load ar.unat | ||
756 | (pUStk) add r15=IA64_TASK_THREAD_ON_USTACK_OFFSET,r13 | ||
757 | ;; | ||
758 | #else | ||
740 | mov r22=r0 // A clear r22 | 759 | mov r22=r0 // A clear r22 |
741 | ;; | 760 | ;; |
742 | ld8 r30=[r2],16 // M0|1 load cr.ifs | 761 | ld8 r30=[r2],16 // M0|1 load cr.ifs |
743 | ld8 r25=[r3],16 // M0|1 load ar.unat | 762 | ld8 r25=[r3],16 // M0|1 load ar.unat |
744 | (pUStk) add r14=IA64_TASK_THREAD_ON_USTACK_OFFSET,r13 | 763 | (pUStk) add r14=IA64_TASK_THREAD_ON_USTACK_OFFSET,r13 |
745 | ;; | 764 | ;; |
765 | #endif | ||
746 | ld8 r26=[r2],PT(B0)-PT(AR_PFS) // M0|1 load ar.pfs | 766 | ld8 r26=[r2],PT(B0)-PT(AR_PFS) // M0|1 load ar.pfs |
747 | (pKStk) mov r22=psr // M2 read PSR now that interrupts are disabled | 767 | (pKStk) mov r22=psr // M2 read PSR now that interrupts are disabled |
748 | nop 0 | 768 | nop 0 |
@@ -759,7 +779,11 @@ ENTRY(ia64_leave_syscall) | |||
759 | ld8.fill r1=[r3],16 // M0|1 load r1 | 779 | ld8.fill r1=[r3],16 // M0|1 load r1 |
760 | (pUStk) mov r17=1 // A | 780 | (pUStk) mov r17=1 // A |
761 | ;; | 781 | ;; |
782 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | ||
783 | (pUStk) st1 [r15]=r17 // M2|3 | ||
784 | #else | ||
762 | (pUStk) st1 [r14]=r17 // M2|3 | 785 | (pUStk) st1 [r14]=r17 // M2|3 |
786 | #endif | ||
763 | ld8.fill r13=[r3],16 // M0|1 | 787 | ld8.fill r13=[r3],16 // M0|1 |
764 | mov f8=f0 // F clear f8 | 788 | mov f8=f0 // F clear f8 |
765 | ;; | 789 | ;; |
@@ -775,12 +799,22 @@ ENTRY(ia64_leave_syscall) | |||
775 | shr.u r18=r19,16 // I0|1 get byte size of existing "dirty" partition | 799 | shr.u r18=r19,16 // I0|1 get byte size of existing "dirty" partition |
776 | cover // B add current frame into dirty partition & set cr.ifs | 800 | cover // B add current frame into dirty partition & set cr.ifs |
777 | ;; | 801 | ;; |
802 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | ||
803 | mov r19=ar.bsp // M2 get new backing store pointer | ||
804 | st8 [r14]=r22 // M save time at leave | ||
805 | mov f10=f0 // F clear f10 | ||
806 | |||
807 | mov r22=r0 // A clear r22 | ||
808 | movl r14=__kernel_syscall_via_epc // X | ||
809 | ;; | ||
810 | #else | ||
778 | mov r19=ar.bsp // M2 get new backing store pointer | 811 | mov r19=ar.bsp // M2 get new backing store pointer |
779 | mov f10=f0 // F clear f10 | 812 | mov f10=f0 // F clear f10 |
780 | 813 | ||
781 | nop.m 0 | 814 | nop.m 0 |
782 | movl r14=__kernel_syscall_via_epc // X | 815 | movl r14=__kernel_syscall_via_epc // X |
783 | ;; | 816 | ;; |
817 | #endif | ||
784 | mov.m ar.csd=r0 // M2 clear ar.csd | 818 | mov.m ar.csd=r0 // M2 clear ar.csd |
785 | mov.m ar.ccv=r0 // M2 clear ar.ccv | 819 | mov.m ar.ccv=r0 // M2 clear ar.ccv |
786 | mov b7=r14 // I0 clear b7 (hint with __kernel_syscall_via_epc) | 820 | mov b7=r14 // I0 clear b7 (hint with __kernel_syscall_via_epc) |
@@ -913,10 +947,18 @@ GLOBAL_ENTRY(ia64_leave_kernel) | |||
913 | adds r16=PT(CR_IPSR)+16,r12 | 947 | adds r16=PT(CR_IPSR)+16,r12 |
914 | adds r17=PT(CR_IIP)+16,r12 | 948 | adds r17=PT(CR_IIP)+16,r12 |
915 | 949 | ||
950 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | ||
951 | .pred.rel.mutex pUStk,pKStk | ||
952 | (pKStk) mov r22=psr // M2 read PSR now that interrupts are disabled | ||
953 | (pUStk) mov.m r22=ar.itc // M fetch time at leave | ||
954 | nop.i 0 | ||
955 | ;; | ||
956 | #else | ||
916 | (pKStk) mov r22=psr // M2 read PSR now that interrupts are disabled | 957 | (pKStk) mov r22=psr // M2 read PSR now that interrupts are disabled |
917 | nop.i 0 | 958 | nop.i 0 |
918 | nop.i 0 | 959 | nop.i 0 |
919 | ;; | 960 | ;; |
961 | #endif | ||
920 | ld8 r29=[r16],16 // load cr.ipsr | 962 | ld8 r29=[r16],16 // load cr.ipsr |
921 | ld8 r28=[r17],16 // load cr.iip | 963 | ld8 r28=[r17],16 // load cr.iip |
922 | ;; | 964 | ;; |
@@ -938,15 +980,37 @@ GLOBAL_ENTRY(ia64_leave_kernel) | |||
938 | ;; | 980 | ;; |
939 | ld8.fill r12=[r16],16 | 981 | ld8.fill r12=[r16],16 |
940 | ld8.fill r13=[r17],16 | 982 | ld8.fill r13=[r17],16 |
983 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | ||
984 | (pUStk) adds r3=TI_AC_LEAVE+IA64_TASK_SIZE,r18 | ||
985 | #else | ||
941 | (pUStk) adds r18=IA64_TASK_THREAD_ON_USTACK_OFFSET,r18 | 986 | (pUStk) adds r18=IA64_TASK_THREAD_ON_USTACK_OFFSET,r18 |
987 | #endif | ||
942 | ;; | 988 | ;; |
943 | ld8 r20=[r16],16 // ar.fpsr | 989 | ld8 r20=[r16],16 // ar.fpsr |
944 | ld8.fill r15=[r17],16 | 990 | ld8.fill r15=[r17],16 |
991 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | ||
992 | (pUStk) adds r18=IA64_TASK_THREAD_ON_USTACK_OFFSET,r18 // deferred | ||
993 | #endif | ||
945 | ;; | 994 | ;; |
946 | ld8.fill r14=[r16],16 | 995 | ld8.fill r14=[r16],16 |
947 | ld8.fill r2=[r17] | 996 | ld8.fill r2=[r17] |
948 | (pUStk) mov r17=1 | 997 | (pUStk) mov r17=1 |
949 | ;; | 998 | ;; |
999 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | ||
1000 | // mmi_ : ld8 st1 shr;; mmi_ : st8 st1 shr;; | ||
1001 | // mib : mov add br -> mib : ld8 add br | ||
1002 | // bbb_ : br nop cover;; mbb_ : mov br cover;; | ||
1003 | // | ||
1004 | // no one require bsp in r16 if (pKStk) branch is selected. | ||
1005 | (pUStk) st8 [r3]=r22 // save time at leave | ||
1006 | (pUStk) st1 [r18]=r17 // restore current->thread.on_ustack | ||
1007 | shr.u r18=r19,16 // get byte size of existing "dirty" partition | ||
1008 | ;; | ||
1009 | ld8.fill r3=[r16] // deferred | ||
1010 | LOAD_PHYS_STACK_REG_SIZE(r17) | ||
1011 | (pKStk) br.cond.dpnt skip_rbs_switch | ||
1012 | mov r16=ar.bsp // get existing backing store pointer | ||
1013 | #else | ||
950 | ld8.fill r3=[r16] | 1014 | ld8.fill r3=[r16] |
951 | (pUStk) st1 [r18]=r17 // restore current->thread.on_ustack | 1015 | (pUStk) st1 [r18]=r17 // restore current->thread.on_ustack |
952 | shr.u r18=r19,16 // get byte size of existing "dirty" partition | 1016 | shr.u r18=r19,16 // get byte size of existing "dirty" partition |
@@ -954,6 +1018,7 @@ GLOBAL_ENTRY(ia64_leave_kernel) | |||
954 | mov r16=ar.bsp // get existing backing store pointer | 1018 | mov r16=ar.bsp // get existing backing store pointer |
955 | LOAD_PHYS_STACK_REG_SIZE(r17) | 1019 | LOAD_PHYS_STACK_REG_SIZE(r17) |
956 | (pKStk) br.cond.dpnt skip_rbs_switch | 1020 | (pKStk) br.cond.dpnt skip_rbs_switch |
1021 | #endif | ||
957 | 1022 | ||
958 | /* | 1023 | /* |
959 | * Restore user backing store. | 1024 | * Restore user backing store. |