Commit 1b2852b1 authored by Frederic Weisbecker's avatar Frederic Weisbecker
Browse files

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: default avatarSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarFrederic 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>
parent 1017769b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -119,6 +119,8 @@ static cputime_t vtime_delta(struct task_struct *tsk)
	cputime_t delta_stime;
	__u64 now;

	WARN_ON_ONCE(!irqs_disabled());

	now = ia64_get_itc();

	delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp));
+2 −0
Original line number Diff line number Diff line
@@ -297,6 +297,8 @@ static u64 vtime_delta(struct task_struct *tsk,
	u64 now, nowscaled, deltascaled;
	u64 udelta, delta, user_scaled;

	WARN_ON_ONCE(!irqs_disabled());

	now = mftb();
	nowscaled = read_spurr(now);
	get_paca()->system_time += now - get_paca()->starttime;
+2 −0
Original line number Diff line number Diff line
@@ -132,6 +132,8 @@ void vtime_account(struct task_struct *tsk)
	struct thread_info *ti = task_thread_info(tsk);
	u64 timer, system;

	WARN_ON_ONCE(!irqs_disabled());

	timer = S390_lowcore.last_update_timer;
	S390_lowcore.last_update_timer = get_vtimer();
	S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer;