public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Li Yi <yi.li@analog.com>,
	linux-kernel@vger.kernel.org,
	uclinux-dist-devel@blackfin.uclinux.org
Subject: Re: [PATCH] Ftrace: irqsoff tracer may cause stack overflow
Date: Fri, 8 Jan 2010 19:27:48 +0100	[thread overview]
Message-ID: <20100108182746.GA5606@nowhere> (raw)
In-Reply-To: <1262964163.28171.3781.camel@gandalf.stny.rr.com>

On Fri, Jan 08, 2010 at 10:22:43AM -0500, Steven Rostedt wrote:
> On Fri, 2010-01-08 at 06:18 +0100, Frederic Weisbecker wrote:
> Comment needed here:
> 
> /*
>  * The irqsoff tracer uses atomic_inc_return to prevent recursion.
>  * Unfortunately, in this file, atomic_inc_return disables interrupts
>  * which causes the recursion the irqsoff trace was trying to prevent.
>  *
>  * The irqsoff tracer will define __ATOMIC_NEED_RAW_IRQ_SAVE before
>  * including this file, which will make the atomic_inc_return use
>  * the raw versions of interrupts disabling. This will allow other
>  * users of the atomic_inc_return to still have the interrupt
>  * disabling be traced, but will prevent the recursion by the
>  * irqsoff tracer itself.
>  */
> 



Yep, that was a first catch, just to ping opinions, it was even
not tested :)


> I wonder if we could just use a per_cpu variable and increment that
> instead. Since the irqsoff tracer only gets called with interrupts
> disabled (and the preemptoff with preemption disabled), a per_cpu
> variable should be protected well.



Doh! I thought about that but feared about preempt_disable recursion.
I didn't realize this code was under such context already.

True, that's indeed a much better idea!


      reply	other threads:[~2010-01-08 18:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-08  4:45 [PATCH] Ftrace: irqsoff tracer may cause stack overflow Li Yi
2010-01-08  4:54 ` Mike Frysinger
2010-01-08  6:26   ` Li Yi
2010-01-08  6:26     ` Mike Frysinger
2010-01-08  5:18 ` Frederic Weisbecker
2010-01-08  9:13   ` Li Yi
2010-01-08 15:22   ` Steven Rostedt
2010-01-08 18:27     ` Frederic Weisbecker [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=20100108182746.GA5606@nowhere \
    --to=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=uclinux-dist-devel@blackfin.uclinux.org \
    --cc=yi.li@analog.com \
    /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