linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@elte.hu, fweisbec@gmail.com, a.p.zijlstra@chello.nl,
	paulus@samba.org, acme@redhat.com
Subject: [PATCH RFC] perf: fix find_swevent_head() RCU lockdep splat
Date: Thu, 13 May 2010 11:25:56 -0700	[thread overview]
Message-ID: <20100513182556.GA14326@linux.vnet.ibm.com> (raw)

This commit guesses at the perf_cpu_context locking design and deploys
an rcu_dereference_check() accordingly.  The design appears to require
that a given CPU be accessing its own per_cpu_context or that it be
traversing under RCU protection.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>

 perf_event.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index a4fa381..002791c 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4074,7 +4074,9 @@ find_swevent_head(struct perf_cpu_context *ctx, u64 type, u32 event_id)
 
 	hash = swevent_hash(type, event_id);
 
-	hlist = rcu_dereference(ctx->swevent_hlist);
+	hlist = rcu_dereference_check(ctx->swevent_hlist,
+				      rcu_read_lock_held() ||
+				      ctx == &__get_cpu_var(perf_cpu_context));
 	if (!hlist)
 		return NULL;
 

             reply	other threads:[~2010-05-13 18:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-13 18:25 Paul E. McKenney [this message]
2010-05-13 19:03 ` [PATCH RFC] perf: fix find_swevent_head() RCU lockdep splat Frederic Weisbecker
2010-05-13 19:46   ` Paul E. McKenney
2010-05-13 20:26     ` Frederic Weisbecker
2010-05-13 20:48     ` Frederic Weisbecker
2010-05-13 20:59       ` Frederic Weisbecker
2010-05-13 23:43         ` Paul E. McKenney
2010-05-20  7:01           ` Frederic Weisbecker
2010-05-14  7:47       ` Peter Zijlstra
2010-05-20  7:04         ` Frederic Weisbecker
2010-05-14  7:44   ` Peter Zijlstra
2010-05-20  7:04     ` Frederic 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=20100513182556.GA14326@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.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;
as well as URLs for NNTP newsgroup(s).