[3.13.y.z extended stable] Patch "perf: Do not allow optimized switch for non-cloned events" has been added to staging queue

Kamal Mostafa kamal at canonical.com
Wed Aug 6 20:54:36 UTC 2014


This is a note to let you know that I have just added a patch titled

    perf: Do not allow optimized switch for non-cloned events

to the linux-3.13.y-queue branch of the 3.13.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.13.y-queue

This patch is scheduled to be released in version 3.13.11.6.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.13.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

>From a72a30a54883bae31c1144247c6c9d67397fb5a8 Mon Sep 17 00:00:00 2001
From: Jiri Olsa <jolsa at redhat.com>
Date: Tue, 24 Jun 2014 10:20:25 +0200
Subject: perf: Do not allow optimized switch for non-cloned events

commit 1f9a7268c67f0290837aada443d28fd953ddca90 upstream.

The context check in perf_event_context_sched_out allows
non-cloned context to be part of the optimized schedule
out switch.

This could move non-cloned context into another workload
child. Once this child exits, the context is closed and
leaves all original (parent) events in closed state.

Any other new cloned event will have closed state and not
measure anything. And probably causing other odd bugs.

Signed-off-by: Jiri Olsa <jolsa at kernel.org>
Signed-off-by: Peter Zijlstra <peterz at infradead.org>
Cc: Arnaldo Carvalho de Melo <acme at kernel.org>
Cc: Paul Mackerras <paulus at samba.org>
Cc: Frederic Weisbecker <fweisbec at gmail.com>
Cc: Namhyung Kim <namhyung at kernel.org>
Cc: Paul Mackerras <paulus at samba.org>
Cc: Corey Ashford <cjashfor at linux.vnet.ibm.com>
Cc: David Ahern <dsahern at gmail.com>
Cc: Jiri Olsa <jolsa at redhat.com>
Cc: Linus Torvalds <torvalds at linux-foundation.org>
Link: http://lkml.kernel.org/r/1403598026-2310-2-git-send-email-jolsa@kernel.org
Signed-off-by: Ingo Molnar <mingo at kernel.org>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
 kernel/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index f0a8ac7..f8519d6 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2296,7 +2296,7 @@ static void perf_event_context_sched_out(struct task_struct *task, int ctxn,
 	next_parent = rcu_dereference(next_ctx->parent_ctx);

 	/* If neither context have a parent context; they cannot be clones. */
-	if (!parent && !next_parent)
+	if (!parent || !next_parent)
 		goto unlock;

 	if (next_parent == ctx || next_ctx == parent || next_parent == parent) {
--
1.9.1





More information about the kernel-team mailing list