~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/powerpc/include/asm/cputime.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  * Definitions for measuring cputime on powerpc machines.
  4  *
  5  * Copyright (C) 2006 Paul Mackerras, IBM Corp.
  6  *
  7  * If we have CONFIG_VIRT_CPU_ACCOUNTING_NATIVE, we measure cpu time in
  8  * the same units as the timebase.  Otherwise we measure cpu time
  9  * in jiffies using the generic definitions.
 10  */
 11 
 12 #ifndef __POWERPC_CPUTIME_H
 13 #define __POWERPC_CPUTIME_H
 14 
 15 #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
 16 
 17 #include <linux/types.h>
 18 #include <linux/time.h>
 19 #include <asm/div64.h>
 20 #include <asm/time.h>
 21 #include <asm/param.h>
 22 #include <asm/firmware.h>
 23 
 24 #ifdef __KERNEL__
 25 #define cputime_to_nsecs(cputime) tb_to_ns(cputime)
 26 
 27 /*
 28  * PPC64 uses PACA which is task independent for storing accounting data while
 29  * PPC32 uses struct thread_info, therefore at task switch the accounting data
 30  * has to be populated in the new task
 31  */
 32 #ifdef CONFIG_PPC64
 33 #define get_accounting(tsk)     (&get_paca()->accounting)
 34 #define raw_get_accounting(tsk) (&local_paca->accounting)
 35 
 36 #else
 37 #define get_accounting(tsk)     (&task_thread_info(tsk)->accounting)
 38 #define raw_get_accounting(tsk) get_accounting(tsk)
 39 #endif
 40 
 41 /*
 42  * account_cpu_user_entry/exit runs "unreconciled", so can't trace,
 43  * can't use get_paca()
 44  */
 45 static notrace inline void account_cpu_user_entry(void)
 46 {
 47         unsigned long tb = mftb();
 48         struct cpu_accounting_data *acct = raw_get_accounting(current);
 49 
 50         acct->utime += (tb - acct->starttime_user);
 51         acct->starttime = tb;
 52 }
 53 
 54 static notrace inline void account_cpu_user_exit(void)
 55 {
 56         unsigned long tb = mftb();
 57         struct cpu_accounting_data *acct = raw_get_accounting(current);
 58 
 59         acct->stime += (tb - acct->starttime);
 60         acct->starttime_user = tb;
 61 }
 62 
 63 static notrace inline void account_stolen_time(void)
 64 {
 65 #ifdef CONFIG_PPC_SPLPAR
 66         if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
 67                 struct lppaca *lp = local_paca->lppaca_ptr;
 68 
 69                 if (unlikely(local_paca->dtl_ridx != be64_to_cpu(lp->dtl_idx)))
 70                         pseries_accumulate_stolen_time();
 71         }
 72 #endif
 73 }
 74 
 75 #endif /* __KERNEL__ */
 76 #else /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
 77 static inline void account_cpu_user_entry(void)
 78 {
 79 }
 80 static inline void account_cpu_user_exit(void)
 81 {
 82 }
 83 static notrace inline void account_stolen_time(void)
 84 {
 85 }
 86 #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
 87 #endif /* __POWERPC_CPUTIME_H */
 88 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php