[PATCH 3.13.y-ckt 61/86] perf: Fix inherited events vs. tracepoint filters

2015-12-02 Thread Kamal Mostafa
3.13.11-ckt31 -stable review patch.  If anyone has any objections, please let 
me know.

--

From: Peter Zijlstra 

commit b71b437eedaed985062492565d9d421d975ae845 upstream.

Arnaldo reported that tracepoint filters seem to misbehave (ie. not
apply) on inherited events.

The fix is obvious; filters are only set on the actual (parent)
event, use the normal pattern of using this parent event for filters.
This is safe because each child event has a reference to it.

Reported-by: Arnaldo Carvalho de Melo 
Tested-by: Arnaldo Carvalho de Melo 
Signed-off-by: Peter Zijlstra (Intel) 
Cc: Adrian Hunter 
Cc: Arnaldo Carvalho de Melo 
Cc: David Ahern 
Cc: Frédéric Weisbecker 
Cc: Jiri Olsa 
Cc: Jiri Olsa 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Steven Rostedt 
Cc: Thomas Gleixner 
Cc: Wang Nan 
Link: 
http://lkml.kernel.org/r/20151102095051.gn17...@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar 
Signed-off-by: Kamal Mostafa 
---
 kernel/events/core.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index f1aec1c..5a90a64 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5863,6 +5863,10 @@ static int perf_tp_filter_match(struct perf_event *event,
 {
void *record = data->raw->data;
 
+   /* only top level events have filters set */
+   if (event->parent)
+   event = event->parent;
+
if (likely(!event->filter) || filter_match_preds(event->filter, record))
return 1;
return 0;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.13.y-ckt 61/86] perf: Fix inherited events vs. tracepoint filters

2015-12-02 Thread Kamal Mostafa
3.13.11-ckt31 -stable review patch.  If anyone has any objections, please let 
me know.

--

From: Peter Zijlstra 

commit b71b437eedaed985062492565d9d421d975ae845 upstream.

Arnaldo reported that tracepoint filters seem to misbehave (ie. not
apply) on inherited events.

The fix is obvious; filters are only set on the actual (parent)
event, use the normal pattern of using this parent event for filters.
This is safe because each child event has a reference to it.

Reported-by: Arnaldo Carvalho de Melo 
Tested-by: Arnaldo Carvalho de Melo 
Signed-off-by: Peter Zijlstra (Intel) 
Cc: Adrian Hunter 
Cc: Arnaldo Carvalho de Melo 
Cc: David Ahern 
Cc: Frédéric Weisbecker 
Cc: Jiri Olsa 
Cc: Jiri Olsa 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Steven Rostedt 
Cc: Thomas Gleixner 
Cc: Wang Nan 
Link: 
http://lkml.kernel.org/r/20151102095051.gn17...@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar 
Signed-off-by: Kamal Mostafa 
---
 kernel/events/core.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index f1aec1c..5a90a64 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5863,6 +5863,10 @@ static int perf_tp_filter_match(struct perf_event *event,
 {
void *record = data->raw->data;
 
+   /* only top level events have filters set */
+   if (event->parent)
+   event = event->parent;
+
if (likely(!event->filter) || filter_match_preds(event->filter, record))
return 1;
return 0;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/