public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Li Zefan <lizf@cn.fujitsu.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	mathieu.desnoyers@efficios.com, lizf@cn.fujitsu.com,
	randy.dunlap@oracle.com, rostedt@goodmis.org, tglx@linutronix.de
Subject: [tip:tracing/core] tracing: Remove side effect from module tracepoints that caused a GPF
Date: Fri, 2 Apr 2010 19:04:22 GMT	[thread overview]
Message-ID: <tip-ae832d1e03ac9bf09fb8a07fb37908ab40c7cd0e@git.kernel.org> (raw)
In-Reply-To: <4BA97FA7.6040406@cn.fujitsu.com>

Commit-ID:  ae832d1e03ac9bf09fb8a07fb37908ab40c7cd0e
Gitweb:     http://git.kernel.org/tip/ae832d1e03ac9bf09fb8a07fb37908ab40c7cd0e
Author:     Li Zefan <lizf@cn.fujitsu.com>
AuthorDate: Wed, 24 Mar 2010 10:57:43 +0800
Committer:  Steven Rostedt <rostedt@goodmis.org>
CommitDate: Wed, 31 Mar 2010 22:56:58 -0400

tracing: Remove side effect from module tracepoints that caused a GPF

Remove the @refcnt argument, because it has side-effects, and arguments with
side-effects are not skipped by the jump over disabled instrumentation and are
executed even when the tracepoint is disabled.

This was also causing a GPF as found by Randy Dunlap:

Subject: 2.6.33 GP fault only when built with tracing
LKML-Reference: <4BA2B69D.3000309@oracle.com>

Note, the current 2.6.34-rc has a fix for the actual cause of the GPF,
but this fixes one of its triggers.

Tested-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4BA97FA7.6040406@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/linux/module.h        |    6 ++----
 include/trace/events/module.h |   14 +++++++-------
 kernel/module.c               |    3 +--
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index 5e869ff..393ec39 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -460,8 +460,7 @@ static inline void __module_get(struct module *module)
 	if (module) {
 		preempt_disable();
 		__this_cpu_inc(module->refptr->count);
-		trace_module_get(module, _THIS_IP_,
-				 __this_cpu_read(module->refptr->count));
+		trace_module_get(module, _THIS_IP_);
 		preempt_enable();
 	}
 }
@@ -475,8 +474,7 @@ static inline int try_module_get(struct module *module)
 
 		if (likely(module_is_live(module))) {
 			__this_cpu_inc(module->refptr->count);
-			trace_module_get(module, _THIS_IP_,
-				__this_cpu_read(module->refptr->count));
+			trace_module_get(module, _THIS_IP_);
 		}
 		else
 			ret = 0;
diff --git a/include/trace/events/module.h b/include/trace/events/module.h
index 4b0f48b..a585f81 100644
--- a/include/trace/events/module.h
+++ b/include/trace/events/module.h
@@ -53,9 +53,9 @@ TRACE_EVENT(module_free,
 
 DECLARE_EVENT_CLASS(module_refcnt,
 
-	TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
+	TP_PROTO(struct module *mod, unsigned long ip),
 
-	TP_ARGS(mod, ip, refcnt),
+	TP_ARGS(mod, ip),
 
 	TP_STRUCT__entry(
 		__field(	unsigned long,	ip		)
@@ -65,7 +65,7 @@ DECLARE_EVENT_CLASS(module_refcnt,
 
 	TP_fast_assign(
 		__entry->ip	= ip;
-		__entry->refcnt	= refcnt;
+		__entry->refcnt	= __this_cpu_read(mod->refptr->count);
 		__assign_str(name, mod->name);
 	),
 
@@ -75,16 +75,16 @@ DECLARE_EVENT_CLASS(module_refcnt,
 
 DEFINE_EVENT(module_refcnt, module_get,
 
-	TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
+	TP_PROTO(struct module *mod, unsigned long ip),
 
-	TP_ARGS(mod, ip, refcnt)
+	TP_ARGS(mod, ip)
 );
 
 DEFINE_EVENT(module_refcnt, module_put,
 
-	TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
+	TP_PROTO(struct module *mod, unsigned long ip),
 
-	TP_ARGS(mod, ip, refcnt)
+	TP_ARGS(mod, ip)
 );
 
 TRACE_EVENT(module_request,
diff --git a/kernel/module.c b/kernel/module.c
index c968d36..21591ad 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -800,8 +800,7 @@ void module_put(struct module *module)
 		preempt_disable();
 		__this_cpu_dec(module->refptr->count);
 
-		trace_module_put(module, _RET_IP_,
-				 __this_cpu_read(module->refptr->count));
+		trace_module_put(module, _RET_IP_);
 		/* Maybe they're waiting for us to drop reference? */
 		if (unlikely(!module_is_live(module)))
 			wake_up_process(module->waiter);

      parent reply	other threads:[~2010-04-02 19:04 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18 23:26 2.6.33 GP fault only when built with tracing Randy Dunlap
2010-03-18 23:55 ` Steven Rostedt
2010-03-19  0:08   ` Randy Dunlap
2010-03-19  0:59   ` Mathieu Desnoyers
2010-03-19 18:22     ` Randy Dunlap
2010-03-19 18:46       ` Mathieu Desnoyers
2010-03-23 15:26         ` Randy Dunlap
2010-03-24  1:20           ` Mathieu Desnoyers
2010-03-24  1:42             ` Li Zefan
2010-03-24 20:21             ` Randy Dunlap
2010-03-24 20:31               ` Steven Rostedt
2010-03-20  0:12   ` Randy Dunlap
2010-03-19  0:01 ` Frederic Weisbecker
2010-03-19  2:15 ` Steven Rostedt
2010-03-19 16:10   ` Randy Dunlap
2010-03-24  2:57 ` [PATCH 1/3] tracing: Reduce overhead of module tracepoints Li Zefan
2010-03-24  2:58   ` [PATCH 2/3] tracing: Convert some signal events to DEFINE_TRACE Li Zefan
2010-03-24  3:07     ` Steven Rostedt
2010-03-24  3:17       ` Masami Hiramatsu
2010-04-02 19:03     ` [tip:tracing/core] " tip-bot for Li Zefan
2010-03-24  2:58   ` [PATCH 3/3] tracing: Update comments Li Zefan
2010-03-24  3:07     ` Steven Rostedt
2010-04-02 19:04     ` [tip:tracing/core] " tip-bot for Li Zefan
2010-03-24  3:05   ` [PATCH 1/3] tracing: Reduce overhead of module tracepoints Steven Rostedt
2010-03-24 10:24   ` Mathieu Desnoyers
2010-03-24 23:41   ` Randy Dunlap
2010-03-27  2:03   ` [tip:tracing/urgent] tracing: Remove side effect from module tracepoints that caused a GPF tip-bot for Li Zefan
2010-03-27  4:10     ` Mathieu Desnoyers
2010-03-27  4:23       ` Steven Rostedt
2010-04-02 19:04   ` tip-bot for Li Zefan [this message]

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=tip-ae832d1e03ac9bf09fb8a07fb37908ab40c7cd0e@git.kernel.org \
    --to=lizf@cn.fujitsu.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@redhat.com \
    --cc=randy.dunlap@oracle.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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