public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] tracing, sched: mark preempt_schedule() notrace
Date: Tue, 18 Aug 2009 16:01:57 +0800	[thread overview]
Message-ID: <4A8A5FF5.8080609@cn.fujitsu.com> (raw)


Current preempt_schedule() is not marked notrace. It may be
infinite recursion in __trace_graph_return().

preempt_schedule()
  __trace_graph_return()
    ftrace_preempt_disable() (!!return false!!)
    ftrace_preempt_enable()
      preempt_enable_notrace()
         preempt_schedule() (need_resched() may be true again)


It hardly happens, but marking preempt_schedule() notrace
makes it safer.

One interesting thing is that preempt_schedule() is in
the blacklist of kprobe subsystem. "__kprobes" implies "notrace".
But preempt_schedule() cannot be marked __kprobes for it
has been marked __sched. It is in the blacklist makes me
consider this: should it be marked "notrace" -- YES.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/kernel/sched.c b/kernel/sched.c
index 5184580..2e9e209 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5534,7 +5534,7 @@ out:
  * off of preempt_enable. Kernel preemptions off return from interrupt
  * occur there and call schedule directly.
  */
-asmlinkage void __sched preempt_schedule(void)
+asmlinkage void __sched notrace preempt_schedule(void)
 {
 	struct thread_info *ti = current_thread_info();
 






     


             reply	other threads:[~2009-08-18  8:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-18  8:01 Lai Jiangshan [this message]
2009-08-18 10:38 ` [PATCH] tracing, sched: mark preempt_schedule() notrace Frederic Weisbecker
2009-08-18 16:28   ` Steven Rostedt
2009-08-19  3:07     ` Lai Jiangshan
2009-08-19  2:33   ` Lai Jiangshan

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=4A8A5FF5.8080609@cn.fujitsu.com \
    --to=laijs@cn.fujitsu.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox