Index: linux-2.6.21-rc5/include/asm-powerpc/thread_info.h =================================================================== --- linux-2.6.21-rc5.orig/include/asm-powerpc/thread_info.h +++ linux-2.6.21-rc5/include/asm-powerpc/thread_info.h @@ -35,6 +35,9 @@ struct thread_info { int cpu; /* cpu we're on */ int preempt_count; /* 0 => preemptable, <0 => BUG */ +#ifdef CONFIG_THREAD_PERF_STAT_SYSC + unsigned long sysc_cnt; /* Syscall counter */ +#endif /* CONFIG_THREAD_PERF_STAT_SYSC */ struct restart_block restart_block; unsigned long local_flags; /* private flags for thread */ Index: linux-2.6.21-rc5/arch/powerpc/kernel/asm-offsets.c =================================================================== --- linux-2.6.21-rc5.orig/arch/powerpc/kernel/asm-offsets.c +++ linux-2.6.21-rc5/arch/powerpc/kernel/asm-offsets.c @@ -94,6 +94,10 @@ int main(void) DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, local_flags)); DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); DEFINE(TI_TASK, offsetof(struct thread_info, task)); +#ifdef CONFIG_THREAD_PERF_STAT_SYSC + DEFINE(TI_SYSC_CNT, offsetof(struct thread_info, sysc_cnt)); +#endif /* CONFIG_THREAD_PERF_STAT_SYSC */ + #ifdef CONFIG_PPC32 DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); Index: linux-2.6.21-rc5/arch/powerpc/kernel/entry_32.S =================================================================== --- linux-2.6.21-rc5.orig/arch/powerpc/kernel/entry_32.S +++ linux-2.6.21-rc5/arch/powerpc/kernel/entry_32.S @@ -223,6 +223,11 @@ ret_from_syscall: #endif mr r6,r3 rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */ +#ifdef CONFIG_THREAD_PERF_STAT_SYSC + lwz r9,TI_SYSC_CNT(r12) + addi r9,r9,1 + stw r9,TI_SYSC_CNT(r12) +#endif /* CONFIG_THREAD_PERF_STAT_SYSC */ /* disable interrupts so current_thread_info()->flags can't change */ LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */ SYNC Index: linux-2.6.21-rc5/lib/Kconfig.debug =================================================================== --- linux-2.6.21-rc5.orig/lib/Kconfig.debug +++ linux-2.6.21-rc5/lib/Kconfig.debug @@ -458,6 +458,6 @@ config THREAD_PERF_STAT config THREAD_PERF_STAT_SYSC bool "Enable syscall counter" - depends on THREAD_PERF_STAT && X86 + depends on THREAD_PERF_STAT && (X86 || PPC32) help This option adds a syscall counter to /proc/PID/status.