All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [BUG] stack tracing causes: kernel/module.c:271 module_assert_mutex_or_preempt
Date: Wed, 5 Apr 2017 12:08:10 -0700	[thread overview]
Message-ID: <20170405190810.GJ1600@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170405145425.357937b8@gandalf.local.home>

On Wed, Apr 05, 2017 at 02:54:25PM -0400, Steven Rostedt wrote:
> On Wed, 5 Apr 2017 10:59:25 -0700
> "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> wrote:
> 
> > > Note, this has nothing to do with trace_rcu_dyntick(). It's the
> > > function tracer tracing inside RCU, calling the stack tracer to record
> > > a new stack if it sees its larger than any stack before. All I need is
> > > a way to tell the stack tracer to not record a stack if it is in this
> > > RCU critical section.
> > > 
> > > If you can add a "in_rcu_critical_section()" function, that the stack
> > > tracer can test, and simply exit out like it does if in_nmi() is set,
> > > that would work too. Below is my current work around.  
> > 
> > Except that the rcu_irq_enter() would already have triggered the bug
> > that was (allegedly) fixed by my earlier patch.  So, yes, the check for
> > rcu_is_watching() would work around this bug, but the hope is that
> > with my earlier fix, this workaround would not be needed.
> 
> Note, if I had a "in_rcu_critical_section()" I wouldn't need to call
> rcu_irq_enter(). I could fall out before that. My current workaround
> does the check, even though it breaks things, it would hopefully fix
> things as it calls rcu_irq_exit() immediately.

OK, color me confused.  What would "in_rcu_critical_section()" do?

The rcu_is_watching() function tells you that RCU is not in an extended
quiescent state, though its return value can be iffy in the middle of
rcu_eqs_enter_common() -- which is why interrupts are disabled there.
In preemptible RCU, you can (but shouldn't) use rcu_preempt_depth()
to determine whether you are within an RCU read-side critical section,
which is what in_rcu_critical_section() sounds like to me, but I don't
see how this information would help in this situation.

What am I missing here?

> Would I would have is:
> 
> 	if (in_rcu_critical_section())
> 		goto out;
> 
> 	rcu_irq_enter();
> 
> which would probably be the easiest fix.
> 
> 
> > 
> > So could you please test my earlier patch?
> 
> I could, but it wouldn't tell me anything immediately. It's a hard race
> to hit. Which I never could hit it when I tried, but it would appear to
> hit immediately when testing other things :-p
> 
> Remember, it only triggers when a new max stack size is hit. The bug
> happens when that new max stack size is in the rcu critical section.
> 
> I guess I could force it to trigger by inserting a call in your code
> that clears the max stack size.

I know it is a bit of a hassle, but I would really appreciate the
testing.

							Thanx, Paul

> -- Steve
> 
> > 
> > This patch does not conflict with anything on -rcu, so you could
> > carry it if that helps.
> > 
> 

  reply	other threads:[~2017-04-05 19:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05 13:32 [BUG] stack tracing causes: kernel/module.c:271 module_assert_mutex_or_preempt Steven Rostedt
2017-04-05 16:25 ` Paul E. McKenney
2017-04-05 16:45   ` Steven Rostedt
2017-04-05 17:59     ` Paul E. McKenney
2017-04-05 18:54       ` Steven Rostedt
2017-04-05 19:08         ` Paul E. McKenney [this message]
2017-04-05 19:21           ` Steven Rostedt
2017-04-05 19:39             ` Paul E. McKenney
2017-04-05 19:52               ` Steven Rostedt
2017-04-05 20:42                 ` Paul E. McKenney
2017-04-06  1:31                   ` Steven Rostedt
2017-04-06  4:07                     ` Paul E. McKenney
2017-04-06  2:12       ` Steven Rostedt
2017-04-06  4:15         ` Paul E. McKenney
2017-04-06 14:14           ` Steven Rostedt
2017-04-06 14:59             ` Paul E. McKenney

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=20170405190810.GJ1600@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 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.