linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Heiko Carstens <hca@linux.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org, Sven Schnelle <svens@linux.ibm.com>
Subject: Re: __local_bh_enable_ip() vs lockdep
Date: Wed, 16 Dec 2020 18:52:59 +0100	[thread overview]
Message-ID: <20201216175259.GP3040@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20201215144724.40ab7612@gandalf.local.home>

On Tue, Dec 15, 2020 at 02:47:24PM -0500, Steven Rostedt wrote:
> On Tue, 15 Dec 2020 20:01:52 +0100
> Heiko Carstens <hca@linux.ibm.com> wrote:
> 
> > Hello,
> > 
> > the ftrace stack tracer kernel selftest is able to trigger the warning
> > below from time to time. This looks like there is an ordering problem
> > in __local_bh_enable_ip():
> > first there is a call to lockdep_softirqs_on() and afterwards
> > preempt_count_sub() is ftraced before it was able to modify
> > preempt_count:
> 
> Don't run ftrace stack tracer when debugging lockdep. ;-)
> 
>   /me runs!

Ha!, seriously though; that seems like something we've encountered
before, but my google-fu is failing me.

Do you remember what, if anything, was the problem with this?

---
diff --git a/kernel/softirq.c b/kernel/softirq.c
index d5bfd5e661fc..9d71046ea247 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -186,7 +186,7 @@ void __local_bh_enable_ip(unsigned long ip, unsigned int cnt)
 	 * Keep preemption disabled until we are done with
 	 * softirq processing:
 	 */
-	preempt_count_sub(cnt - 1);
+	__preempt_count_sub(cnt - 1);
 
 	if (unlikely(!in_interrupt() && local_softirq_pending())) {
 		/*


  reply	other threads:[~2020-12-16 17:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 19:01 __local_bh_enable_ip() vs lockdep Heiko Carstens
2020-12-15 19:47 ` Steven Rostedt
2020-12-16 17:52   ` Peter Zijlstra [this message]
2020-12-16 18:35     ` Heiko Carstens
2020-12-18 15:33     ` Heiko Carstens
2020-12-18 15:37       ` Peter Zijlstra
2020-12-18 15:45         ` Peter Zijlstra
2020-12-18 16:02           ` [tip: locking/urgent] softirq: Avoid bad tracing / lockdep interaction tip-bot2 for Peter Zijlstra

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=20201216175259.GP3040@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=hca@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=svens@linux.ibm.com \
    --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;
as well as URLs for NNTP newsgroup(s).