public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arend van Spril <arend@broadcom.com>,
	Alexander Z Lam <azl@google.com>,
	Vaibhav Nagarnaik <vnagarnaik@google.com>,
	David Sharp <dhsharp@google.com>, <stable@vger.kernel.org>
Subject: [PATCH 9/9] tracing: Remove locking trace_types_lock from tracing_reset_all_online_cpus()
Date: Fri, 26 Jul 2013 09:03:36 -0400	[thread overview]
Message-ID: <20130726130513.428993451@goodmis.org> (raw)
In-Reply-To: 20130726130327.911599518@goodmis.org

[-- Attachment #1: 0009-tracing-Remove-locking-trace_types_lock-from-tracing.patch --]
[-- Type: text/plain, Size: 1943 bytes --]

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

Commit a82274151af "tracing: Protect ftrace_trace_arrays list in trace_events.c"
added taking the trace_types_lock mutex in trace_events.c as there were
several locations that needed it for protection. Unfortunately, it also
encapsulated a call to tracing_reset_all_online_cpus() which also takes
the trace_types_lock, causing a deadlock.

This happens when a module has tracepoints and has been traced. When the
module is removed, the trace events module notifier will grab the
trace_types_lock, do a bunch of clean ups, and also clears the buffer
by calling tracing_reset_all_online_cpus. This doesn't happen often
which explains why it wasn't caught right away.

Commit a82274151af was marked for stable, which means this must be
sent to stable too.

Link: http://lkml.kernel.org/r/51EEC646.7070306@broadcom.com

Reported-by: Arend van Spril <arend@broadcom.com>
Tested-by: Arend van Spriel <arend@broadcom.com>
Cc: Alexander Z Lam <azl@google.com>
Cc: Vaibhav Nagarnaik <vnagarnaik@google.com>
Cc: David Sharp <dhsharp@google.com>
Cc: stable@vger.kernel.org # 3.10
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 69cba47..882ec1d 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1224,18 +1224,17 @@ void tracing_reset_current(int cpu)
 	tracing_reset(&global_trace.trace_buffer, cpu);
 }
 
+/* Must have trace_types_lock held */
 void tracing_reset_all_online_cpus(void)
 {
 	struct trace_array *tr;
 
-	mutex_lock(&trace_types_lock);
 	list_for_each_entry(tr, &ftrace_trace_arrays, list) {
 		tracing_reset_online_cpus(&tr->trace_buffer);
 #ifdef CONFIG_TRACER_MAX_TRACE
 		tracing_reset_online_cpus(&tr->max_buffer);
 #endif
 	}
-	mutex_unlock(&trace_types_lock);
 }
 
 #define SAVED_CMDLINES 128
-- 
1.7.10.4



  parent reply	other threads:[~2013-07-26 13:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-26 13:03 [PATCH 0/9] [GIT PULL] tracing: fixes Steven Rostedt
2013-07-26 13:03 ` [PATCH 1/9] tracing: Introduce trace_create_cpu_file() and tracing_get_cpu() Steven Rostedt
2013-07-26 13:03 ` [PATCH 2/9] tracing: Change tracing_pipe_fops() to rely on tracing_get_cpu() Steven Rostedt
2013-07-26 13:03 ` [PATCH 3/9] tracing: Change tracing_buffers_fops " Steven Rostedt
2013-07-26 13:03 ` [PATCH 4/9] tracing: Change tracing_stats_fops " Steven Rostedt
2013-07-26 13:03 ` [PATCH 5/9] tracing: Change tracing_entries_fops " Steven Rostedt
2013-07-26 13:03 ` [PATCH 6/9] tracing: Change tracing_fops/snapshot_fops " Steven Rostedt
2013-07-26 13:03 ` [PATCH 7/9] tracing: Kill trace_cpu struct/members Steven Rostedt
2013-07-26 13:03 ` [PATCH 8/9] ftrace: Add check for NULL regs if ops has SAVE_REGS set Steven Rostedt
2013-07-26 13:03 ` Steven Rostedt [this message]
2013-07-26 16:15   ` [PATCH 9/9] tracing: Remove locking trace_types_lock from tracing_reset_all_online_cpus() Arend van Spriel
2013-07-26 16:41     ` 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=20130726130513.428993451@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=arend@broadcom.com \
    --cc=azl@google.com \
    --cc=dhsharp@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=vnagarnaik@google.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