mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tracing: use raw spinlocks instead of spinlocks
Date: Mon, 3 Nov 2008 07:46:47 +0100	[thread overview]
Message-ID: <20081103064647.GA4826@elte.hu> (raw)
In-Reply-To: <alpine.DEB.1.10.0811021940030.32371@gandalf.stny.rr.com>


* Steven Rostedt <rostedt@goodmis.org> wrote:

> On Mon, 3 Nov 2008, Frederic Weisbecker wrote:
> 
> > When I tried to figure out why my experimental function's return 
> > tracer was hanging, I discovered that it was partially caused by 
> > the fact that the ring buffer might use the usual spinlocks during 
> > entry insertion.
> > 
> > ring_buffer_lock_reserve() -> rb_reserve_next_event() -> 
> > __rb_reserve_next() -> spin_lock_irqsave()
> > 
> > Since this last function is traced, the result is a recursion 
> > during the trace. I guess it happens too with the function tracer.
> > 
> > We should use the raw_spin_locks which are not traced.
> > 
> > Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> 
> Frederic,
> 
> Ingo has been very adamant about not using raw_spin_locks in the 
> ring buffers. My original code did this, and he nacked it. The 
> reason being (and he eventually convinced me) was that by using raw, 
> we not only do not trace the locking, we also remove the lock 
> checking. This code can easily produce deadlocks, so we do not want 
> the lock checking removed.
> 
> The real fix is to find a way in your tracer to detect the 
> recursion, and be able to prevent it. Like the atomic disables I use 
> in ftrace. It does the same thing. It leaves the lockdep checking on 
> its own locks, but can also detect if the lock checking caused it to 
> recurse. When the recusion is detected, the tracer itself will not 
> trace.

i'm wondering, does the changing to raw-spinlocks fix the deadlock? 
It's generally just the lack of recursion checking that is causing 
lockdep troubles - and recursion checking we want for all the more 
intrusive ftrace plugins anyway.

Frederic, do you have trouble finding the source of the deadlock? In 
theory the NMI watchdog should be able to punch through it. (if not 
then we need to improve things so that it can)

	Ingo

  parent reply	other threads:[~2008-11-03  6:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-03  0:01 Frederic Weisbecker
2008-11-03  0:45 ` Steven Rostedt
2008-11-03  1:17   ` Frédéric Weisbecker
2008-11-03  6:46   ` Ingo Molnar [this message]
2008-11-03 13:24     ` Frédéric Weisbecker
2008-11-04  2:03     ` Frédéric Weisbecker
2008-11-04  9:43       ` Ingo Molnar
2008-11-04 11:14         ` Frédéric Weisbecker
2008-11-04 12:03           ` Ingo Molnar
2008-11-05 10:50             ` Frédéric Weisbecker
2008-11-05 10:55               ` Ingo Molnar
2008-11-06  0:41                 ` Frédéric Weisbecker

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=20081103064647.GA4826@elte.hu \
    --to=mingo@elte.hu \
    --cc=fweisbec@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®