sched/clock: prevent tracing recursion in sched_clock_cpu()
PATCH 1/1 sched/clock: prevent tracing recursion in sched_clock_cpu()
From: Fernando Luis Vazquez Cao <[email protected]>
Prevent tracing of preempt_disable/enable() in sched_clock_cpu(). When CONFIG_DEBUG_PREEMPT is enabled, preempt_disable/enable() are traced and this causes trace_clock() users (and probably others) to go into an infinite recursion. Systems with a stable sched_clock() are not affected.
This problem is similar to that fixed by upstream commit 95ef1e52922 ("KVM guest: prevent tracing recursion with kvmclock").
---
kernel/sched/clock.c +2 -2
@@ -301,14 +301,14 @@ u64 sched_clock_cpu(int cpu)if (unlikely (!sched_clock_running))return 0ull ; -preempt_disable (); +preempt_disable_notrace (); scd =cpu_sdc (cpu);if (cpu !=smp_processor_id ()) clock =sched_clock_remote (scd);else clock =sched_clock_local (scd); -preempt_enable (); +preempt_enable_notrace ();return clock; }
Quoted 10 lines · On Thu, 06 Mar 2014 14:25:28 +0900 Fernando Luis Vázquez Cao…
From: Fernando Luis Vazquez Cao <[email protected]>
Prevent tracing of preempt_disable/enable() in
sched_clock_cpu(). WhenCONFIG_DEBUG_PREEMPTis enabled, preempt_disable/enable() are traced and this causestrace_clock()users (and probably others) to go into an infinite recursion. Systems with a stablesched_clock()are not affected.This problem is similar to that fixed by upstream commit
95ef1e52922("KVM guest: prevent tracing recursion with kvmclock").
Also similar to: 569d6557ab957.
-- Steve
Quoted 29 lines
Cc Linus Torvalds <[email protected]>Cc Andrew Morton <[email protected]>Cc Ingo Molnar <[email protected]>Cc Steven Rostedt <[email protected]>Signed-off-by Fernando Luis Vazquez Cao <[email protected]>---
diff -urNp
linux-3.14-rc5-orig/kernel/sched/clock.clinux-3.14-rc5/kernel/sched/clock.ckernel/sched/clock.c +2
-2@@ -301,14 +301,14 @@ u64 sched_clock_cpu(int cpu)if (unlikely (!sched_clock_running))return 0ull ; -preempt_disable (); +preempt_disable_notrace (); scd =cpu_sdc (cpu);if (cpu !=smp_processor_id ()) clock =sched_clock_remote (scd);else clock =sched_clock_local (scd); -preempt_enable (); +preempt_enable_notrace ();return clock; }
Quoted 11 lines · Steven Rostedt
Quoted 8 lines · On Thu, 06 Mar 2014 14:25:28 +0900 Fernando Luis Vázquez Cao…
From: Fernando Luis Vazquez Cao <[email protected]>
Prevent tracing of preempt_disable/enable() in
sched_clock_cpu(). WhenCONFIG_DEBUG_PREEMPTis enabled, preempt_disable/enable() are traced and this causestrace_clock()users (and probably others) to go into an infinite recursion. Systems with a stablesched_clock()are not affected.
Quoted 5 lines
Quoted 2 lines
This problem is similar to that fixed by upstream commit
95ef1e52922("KVM guest: prevent tracing recursion with kvmclock").Also similar to:
569d6557ab957.Acked-by Steven Rostedt <[email protected]>
Thank you four your review, Peter, Steven.
By the way, who is going to pick this patch? Do you want me to resend with Steven's Acked-by added?
- Fernando
Steven Rostedt
reviewerQuoted 4 lines · On Mon, 10 Mar 2014 16:17:18 +0900 Fernando Luis Vázquez Cao…
Thank you four your review, Peter, Steven.
By the way, who is going to pick this patch? Do you want me to resend with Steven's Acked-by added?
I don't think you have to. I believe Peter got it. I know there's a bunch of patches he's trying to get pushed forward.
-- Steve
Peter Zijlstra
maintainerQuoted 11 lines · Steven Rostedt
Quoted 4 lines · On Mon, 10 Mar 2014 16:17:18 +0900 Fernando Luis Vázquez Cao…
Thank you four your review, Peter, Steven.
By the way, who is going to pick this patch? Do you want me to resend with Steven's Acked-by added?
I don't think you have to. I believe Peter got it. I know there's a bunch of patches he's trying to get pushed forward.
Yeah, I do have it (and the scheduler patch you were after Steve), I just need to trick Ingo into actually looking at his computer somehow. He seems busy with real life stuff for a bit.
Peter Zijlstra
maintainerQuoted 8 lines · Fernando Luis Vázquez Cao
From: Fernando Luis Vazquez Cao <[email protected]>
Prevent tracing of preempt_disable/enable() in
sched_clock_cpu(). WhenCONFIG_DEBUG_PREEMPTis enabled, preempt_disable/enable() are traced and this causestrace_clock()users (and probably others) to go into an infinite recursion. Systems with a stablesched_clock()are not affected.
Quoted 8 lines
This problem is similar to that fixed by upstream commit
95ef1e52922("KVM guest: prevent tracing recursion with kvmclock").Cc Linus Torvalds <[email protected]>Cc Andrew Morton <[email protected]>Cc Ingo Molnar <[email protected]>Cc Steven Rostedt <[email protected]>Signed-off-by Fernando Luis Vazquez Cao <[email protected]>
Thanks!
tip-bot for Fernando Luis Vazquez Cao
merge bot[tip:sched/core] sched/clock: Prevent tracing recursion in sched_clock_cpu()
In reply to Fernando Luis Vázquez Caosched/clock: Prevent tracing recursion in sched_clock_cpu()
Commit-ID: 96b3d28bf4b00f62fc8386ff5d487d1830793a3d Gitweb: http://git.kernel.org/tip/96b3d28bf4b00f62fc8386ff5d487d1830793a3d Author: Fernando Luis Vazquez Cao <[email protected]> AuthorDate: Thu, 6 Mar 2014 14:25:28 +0900 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 11 Mar 2014 11:33:48 +0100
sched/clock: Prevent tracing recursion in sched_clock_cpu()
Prevent tracing of preempt_disable/enable() in sched_clock_cpu(). When CONFIG_DEBUG_PREEMPT is enabled, preempt_disable/enable() are traced and this causes trace_clock() users (and probably others) to go into an infinite recursion. Systems with a stable sched_clock() are not affected.
This problem is similar to that fixed by upstream commit 95ef1e52922 ("KVM guest: prevent tracing recursion with kvmclock").
--- kernel/sched/clock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/clock.c +2 -2
@@ -301,14 +301,14 @@ u64 sched_clock_cpu(int cpu)if (unlikely (!sched_clock_running))return 0ull ; -preempt_disable (); +preempt_disable_notrace (); scd =cpu_sdc (cpu);if (cpu !=smp_processor_id ()) clock =sched_clock_remote (scd);else clock =sched_clock_local (scd); -preempt_enable (); +preempt_enable_notrace ();return clock; }