From: Paul E. McKenney on
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(a)>
Cc: Frederic Weisbecker <fweisbec(a)>

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;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)
More majordomo info at
Please read the FAQ at