From: Steven Rostedt <rostedt@goodmis.org>
To: "Fernando Luis Vázquez Cao" <fernando_b1@lab.ntt.co.jp>
Cc: Peter Zijlstra <peterz@infradead.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/clock: prevent tracing recursion in sched_clock_cpu()
Date: Thu, 6 Mar 2014 05:51:13 -0500 [thread overview]
Message-ID: <20140306055113.2306397d@gandalf.local.home> (raw)
In-Reply-To: <1394083528.4524.3.camel@nexus>
On Thu, 06 Mar 2014 14:25:28 +0900
Fernando Luis Vázquez Cao <fernando_b1@lab.ntt.co.jp> wrote:
> From: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
>
> 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").
Also similar to: 569d6557ab957.
Acked-by: Steven Rostedt <rostedt@goodmis.org>
-- Steve
>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
> ---
>
> diff -urNp linux-3.14-rc5-orig/kernel/sched/clock.c linux-3.14-rc5/kernel/sched/clock.c
> --- linux-3.14-rc5-orig/kernel/sched/clock.c 2014-03-06 13:37:43.567720550 +0900
> +++ linux-3.14-rc5/kernel/sched/clock.c 2014-03-06 13:41:56.937100949 +0900
> @@ -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;
> }
>
next prev parent reply other threads:[~2014-03-06 10:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-06 5:25 [PATCH] sched/clock: prevent tracing recursion in sched_clock_cpu() Fernando Luis Vázquez Cao
2014-03-06 10:51 ` Steven Rostedt [this message]
2014-03-10 7:17 ` Fernando Luis Vázquez Cao
2014-03-11 3:47 ` Steven Rostedt
2014-03-11 8:15 ` Peter Zijlstra
2014-03-06 10:51 ` Peter Zijlstra
2014-03-11 12:36 ` [tip:sched/core] sched/clock: Prevent " tip-bot for Fernando Luis Vazquez Cao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140306055113.2306397d@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=fernando_b1@lab.ntt.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.