public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	stable <stable@vger.kernel.org>, Christoph Lameter <cl@linux.com>,
	Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Subject: Re: [GIT PULL] ring-buffer: Replace this_cpu_*() with __this_cpu_*()
Date: Thu, 19 Mar 2015 18:42:13 -0400	[thread overview]
Message-ID: <20150319184213.54e8bb16@grimm.local.home> (raw)
In-Reply-To: <20150319183444.3d26f078@grimm.local.home>

On Thu, 19 Mar 2015 18:34:44 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Thu, 19 Mar 2015 15:16:25 -0700
> Linus Torvalds <torvalds@linux-foundation.org> wrote:
> 
> > So I don't think the ring-buffer change is necessarily _wrong_, but if
> > this is a performance issue, why don't we just fix it up for the
> > generic case rather than for just one user?
> 
> I totally agree with your analysis, but it's up to Christoph to come up
> with an answer to your questions.
> 

I will add that the ring buffer issue is not just a performance
problem. It is a correctness problem. The generic
preempt_disable/enable() functions can be traced by the function
tracer, where as the preempt_disable/enable_notrace() versions are not.

As tracing is very invasive, and can cause unnecessary recursions,
there are protection mechanisms to prevent something like that
happening. The issue that this patch addresses is that the recursion
protection is the code that happens to be causing the recursion!

 some_function()
   function_tracer()
     ring_buffer_reserve()
       trace_recursive_lock()
         this_cpu_read()
           preempt_disable()
             function_tracer()
               ring_buffer_reserve()
                 trace_recursion_lock()
                    (etc)

The reason this did not happen is that the function_tracer() also has
its own recursion protection that uses current->trace_recursion to
prevent that from happening. But if there was some function tracing
that did not check recursion and calls into the ring buffer, that could
crash the system.

-- Steve

  reply	other threads:[~2015-03-19 22:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 22:02 [GIT PULL] ring-buffer: Replace this_cpu_*() with __this_cpu_*() Steven Rostedt
2015-03-19 22:16 ` Linus Torvalds
2015-03-19 22:34   ` Steven Rostedt
2015-03-19 22:42     ` Steven Rostedt [this message]
2015-05-19 15:35     ` Christoph Lameter
2015-05-19 15:42       ` Steven Rostedt
2015-05-19 16:20         ` Christoph Lameter
2015-03-23 17:48   ` Steven Rostedt
2015-03-24 18:47     ` Christoph Lameter
2015-03-24 19:37       ` Christoph Lameter
2015-05-18 19:50   ` Linus Torvalds
2015-05-18 20:40     ` Steven Rostedt
2015-03-20  7:26 ` Uwe Kleine-König
2015-03-20 11:55   ` Steven Rostedt

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=20150319184213.54e8bb16@grimm.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=u.kleine-koenig@pengutronix.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