diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2012-11-19 11:00:24 -0500 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2012-11-20 09:42:51 -0500 |
commit | 1b2852b152be5150fbef7b585388ec43cf6f4415 (patch) | |
tree | 8c07b611d7fe2051f4fb5c4fe75cf30f902d2f6c /arch | |
parent | 1017769bd0073f0a73e066377cd79a10cf0a33ab (diff) |
vtime: Warn if irqs aren't disabled on system time accounting APIs
System time accounting APIs such as vtime_account_system() and
vtime_account_idle() need to be irqsafe. Current callers include
irq entry, exit and kvm, all of which have been checked against that
requirement. Now it's better to grow that with an automatic check
in case we have further callers or we missed something.
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ia64/kernel/time.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/time.c | 2 | ||||
-rw-r--r-- | arch/s390/kernel/vtime.c | 2 |
3 files changed, 6 insertions, 0 deletions
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index c9a7d2ebe089..b1995efbfd21 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c | |||
@@ -119,6 +119,8 @@ static cputime_t vtime_delta(struct task_struct *tsk) | |||
119 | cputime_t delta_stime; | 119 | cputime_t delta_stime; |
120 | __u64 now; | 120 | __u64 now; |
121 | 121 | ||
122 | WARN_ON_ONCE(!irqs_disabled()); | ||
123 | |||
122 | now = ia64_get_itc(); | 124 | now = ia64_get_itc(); |
123 | 125 | ||
124 | delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp)); | 126 | delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp)); |
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 3486cfad4a63..b3b14352b05e 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -297,6 +297,8 @@ static u64 vtime_delta(struct task_struct *tsk, | |||
297 | u64 now, nowscaled, deltascaled; | 297 | u64 now, nowscaled, deltascaled; |
298 | u64 udelta, delta, user_scaled; | 298 | u64 udelta, delta, user_scaled; |
299 | 299 | ||
300 | WARN_ON_ONCE(!irqs_disabled()); | ||
301 | |||
300 | now = mftb(); | 302 | now = mftb(); |
301 | nowscaled = read_spurr(now); | 303 | nowscaled = read_spurr(now); |
302 | get_paca()->system_time += now - get_paca()->starttime; | 304 | get_paca()->system_time += now - get_paca()->starttime; |
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c index 7c6d861a1a40..e84b8b68444a 100644 --- a/arch/s390/kernel/vtime.c +++ b/arch/s390/kernel/vtime.c | |||
@@ -132,6 +132,8 @@ void vtime_account(struct task_struct *tsk) | |||
132 | struct thread_info *ti = task_thread_info(tsk); | 132 | struct thread_info *ti = task_thread_info(tsk); |
133 | u64 timer, system; | 133 | u64 timer, system; |
134 | 134 | ||
135 | WARN_ON_ONCE(!irqs_disabled()); | ||
136 | |||
135 | timer = S390_lowcore.last_update_timer; | 137 | timer = S390_lowcore.last_update_timer; |
136 | S390_lowcore.last_update_timer = get_vtimer(); | 138 | S390_lowcore.last_update_timer = get_vtimer(); |
137 | S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; | 139 | S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; |