public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Eric Dumazet <dada1@cosmosbay.com>,
	Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: 2.6.33 GP fault only when built with tracing
Date: Tue, 23 Mar 2010 21:20:53 -0400	[thread overview]
Message-ID: <20100324012053.GA17187@Krystal> (raw)
In-Reply-To: <20100323082643.dbf77c46.randy.dunlap@oracle.com>

* Randy Dunlap (randy.dunlap@oracle.com) wrote:
> On Fri, 19 Mar 2010 14:46:10 -0400 Mathieu Desnoyers wrote:
> 
> > * Randy Dunlap (randy.dunlap@oracle.com) wrote:
> > > On 03/18/10 17:59, Mathieu Desnoyers wrote:
> > > > * Steven Rostedt (rostedt@goodmis.org) wrote:
> > > >> On Thu, 2010-03-18 at 16:26 -0700, Randy Dunlap wrote:
> > > >>> I can build/boot 2.6.33 with CONFIG_TRACE/TRACING disabled successfully,
> > > >>> but when I enable lots of tracing config options and then boot with
> > > >>> ftrace=nop on the kernel command line, I see a GP fault when the parport &
> > > >>> parport_pc modules are loading/initializing.
> > > >>
> > > >> Do you see it without adding the "ftrace=nop"? The only thing that
> > > >> should do is expand the ring buffer on boot up.
> > > >>
> > > >>>
> > > >>> It happens in drivers/parport/share.c::parport_register_device(), when that
> > > >>> function calls try_module_get().
> > > >>>
> > > >>> If I comment out the trace_module_get() calls in include/linux/module.h,
> > > >>> the kernel boots with no problems.
> > > >>
> > > >>
> > > >> Interesting. Well, trace_module_get() is a TRACE_EVENT tracepoint. But
> > > >> should be disabled here. It may be something to do with DEFINE_TRACE. 
> > > >>
> > > >> (added Mathieu to Cc since he wrote that code)
> > > > 
> > > > can you try replacing the "local_read(__module_ref_addr(module, cpu))" argument
> > > > with "0" ?
> > > 
> > > Yes, that boots with no problems.
> > 
> > clickety-clicketa... git blame include/linux/module.h :
> > 
> > commit 7ead8b8313d92b3a69a1a61b0dcbc4cd66c960dc
> > Author: Li Zefan <lizf@cn.fujitsu.com>
> > Date:   Mon Aug 17 16:56:28 2009 +0800
> > 
> >     tracing/events: Add module tracepoints
> > 
> > (Adding Li Zefan in CC)
> > 
> > Two things:
> > 
> > 1) In this commit, most of the tracepoints contain argument with side-effects.
> >    These do not belong there; they should be moved into TRACE_EVENT macros.
> > 
> > 2) There seem to be a null-pointer bug with
> >    local_read(__module_ref_addr(module, cpu)) in try_module_get(). This should
> >    be investigated even if we move the argument to TRACE_EVENT.
> 
> Hi Li,
> 
> Fix this, please?
> 

While we wait for the sun to move to other time zones, can you check if the
following patch fixes your problem ?


module: fix __module_ref_addr()

__module_ref_addr() should use per_cpu_ptr() to obfuscate the pointer
(RELOC_HIDE is needed for per cpu pointers).

This non-standard per-cpu pointer use has been introduced by commit
720eba31f47aeade8ec130ca7f4353223c49170f

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Eric Dumazet <dada1@cosmosbay.com>
CC: Rusty Russell <rusty@rustcorp.com.au>
---
 include/linux/module.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6-lttng/include/linux/module.h
===================================================================
--- linux-2.6-lttng.orig/include/linux/module.h	2010-03-23 18:11:14.000000000 -0400
+++ linux-2.6-lttng/include/linux/module.h	2010-03-23 18:14:07.000000000 -0400
@@ -467,7 +467,7 @@ void symbol_put_addr(void *addr);
 static inline local_t *__module_ref_addr(struct module *mod, int cpu)
 {
 #ifdef CONFIG_SMP
-	return (local_t *) (mod->refptr + per_cpu_offset(cpu));
+	return (local_t *) per_cpu_ptr(mod->refptr, cpu);
 #else
 	return &mod->ref;
 #endif


> 
> > Thanks,
> > 
> > Mathieu
> > 
> > > 
> > > > Arguments with side-effects are not skipped by the jump over disabled
> > > > instrumentation. This is why we should do that part within the probe declaration
> > > > in the TRACE_EVENT macros.
> > > > 
> > > > But if we find out that the problem really is this argument, then it should be
> > > > fixed, because something would be wrong with it (just moving it to TRACE_EVENT
> > > > is not a proper solution).
> > > > 
> > > > Thanks,
> > > > 
> > > > Mathieu
> 
> 
> ---
> ~Randy

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

  reply	other threads:[~2010-03-24  1:20 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 [this message]
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:tracing/core] " tip-bot for Li Zefan

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=20100324012053.GA17187@Krystal \
    --to=mathieu.desnoyers@efficios.com \
    --cc=dada1@cosmosbay.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=randy.dunlap@oracle.com \
    --cc=rostedt@goodmis.org \
    --cc=rusty@rustcorp.com.au \
    /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