From 83c675cd261a7dcac64e485264245e1a6007ea31 Mon Sep 17 00:00:00 2001 From: Martin Schwidefsky Date: Sat, 14 Jan 2006 13:21:03 -0800 Subject: [PATCH] --- yaml --- r: 18507 b: refs/heads/master c: 1f1c12afe5c3e0ef901eec12dee09df4947462ee h: refs/heads/master i: 18505: 069856c76a96dbb375b6d0964a29ed97e98520af 18503: 423b326a10ba92050df22056b5859ccd1a1907fe v: v3 --- [refs] | 2 +- trunk/arch/s390/kernel/time.c | 2 +- trunk/arch/s390/kernel/vtime.c | 27 ++++++++++++++++++++++++++- trunk/include/asm-s390/system.h | 5 +++-- trunk/include/linux/hardirq.h | 4 ---- 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 29913814f0c8..1d3fab5d4aee 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: bcc132651d384ad115a275868effb49c64b348ce +refs/heads/master: 1f1c12afe5c3e0ef901eec12dee09df4947462ee diff --git a/trunk/arch/s390/kernel/time.c b/trunk/arch/s390/kernel/time.c index b0d8ca8e5eeb..7c0fe152a111 100644 --- a/trunk/arch/s390/kernel/time.c +++ b/trunk/arch/s390/kernel/time.c @@ -214,7 +214,7 @@ void account_ticks(struct pt_regs *regs) #endif #ifdef CONFIG_VIRT_CPU_ACCOUNTING - account_user_vtime(current); + account_tick_vtime(current); #else while (ticks--) update_process_times(user_mode(regs)); diff --git a/trunk/arch/s390/kernel/vtime.c b/trunk/arch/s390/kernel/vtime.c index 22a895ecb7a4..dfe6f0856617 100644 --- a/trunk/arch/s390/kernel/vtime.c +++ b/trunk/arch/s390/kernel/vtime.c @@ -32,7 +32,7 @@ DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer); * Update process times based on virtual cpu times stored by entry.S * to the lowcore fields user_timer, system_timer & steal_clock. */ -void account_user_vtime(struct task_struct *tsk) +void account_tick_vtime(struct task_struct *tsk) { cputime_t cputime; __u64 timer, clock; @@ -72,6 +72,31 @@ void account_user_vtime(struct task_struct *tsk) run_posix_cpu_timers(tsk); } +/* + * Update process times based on virtual cpu times stored by entry.S + * to the lowcore fields user_timer, system_timer & steal_clock. + */ +void account_vtime(struct task_struct *tsk) +{ + cputime_t cputime; + __u64 timer; + + timer = S390_lowcore.last_update_timer; + asm volatile (" STPT %0" /* Store current cpu timer value */ + : "=m" (S390_lowcore.last_update_timer) ); + S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; + + cputime = S390_lowcore.user_timer >> 12; + S390_lowcore.user_timer -= cputime << 12; + S390_lowcore.steal_clock -= cputime << 12; + account_user_time(tsk, cputime); + + cputime = S390_lowcore.system_timer >> 12; + S390_lowcore.system_timer -= cputime << 12; + S390_lowcore.steal_clock -= cputime << 12; + account_system_time(tsk, 0, cputime); +} + /* * Update process times based on virtual cpu times stored by entry.S * to the lowcore fields user_timer, system_timer & steal_clock. diff --git a/trunk/include/asm-s390/system.h b/trunk/include/asm-s390/system.h index c7c3a9ad593f..b2e65e8bf812 100644 --- a/trunk/include/asm-s390/system.h +++ b/trunk/include/asm-s390/system.h @@ -115,13 +115,14 @@ static inline void sched_cacheflush(void) } #ifdef CONFIG_VIRT_CPU_ACCOUNTING -extern void account_user_vtime(struct task_struct *); +extern void account_vtime(struct task_struct *); +extern void account_tick_vtime(struct task_struct *); extern void account_system_vtime(struct task_struct *); #endif #define finish_arch_switch(prev) do { \ set_fs(current->thread.mm_segment); \ - account_system_vtime(prev); \ + account_vtime(prev); \ } while (0) #define nop() __asm__ __volatile__ ("nop") diff --git a/trunk/include/linux/hardirq.h b/trunk/include/linux/hardirq.h index 71d2b8a723b9..eab537091f2a 100644 --- a/trunk/include/linux/hardirq.h +++ b/trunk/include/linux/hardirq.h @@ -93,10 +93,6 @@ extern void synchronize_irq(unsigned int irq); struct task_struct; #ifndef CONFIG_VIRT_CPU_ACCOUNTING -static inline void account_user_vtime(struct task_struct *tsk) -{ -} - static inline void account_system_vtime(struct task_struct *tsk) { }