Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932974AbcJLMt6 (ORCPT ); Wed, 12 Oct 2016 08:49:58 -0400 Received: from mail.kernel.org ([198.145.29.136]:49414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755072AbcJLMqm (ORCPT ); Wed, 12 Oct 2016 08:46:42 -0400 From: lizf@kernel.org To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Adrian Hunter , Arnaldo Carvalho de Melo , David Ahern , =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Weisbecker?= , Jiri Olsa , Jiri Olsa , Linus Torvalds , Steven Rostedt , Thomas Gleixner , Wang Nan , Ingo Molnar , Zefan Li Subject: [PATCH 3.4 030/125] perf: Fix inherited events vs. tracepoint filters Date: Wed, 12 Oct 2016 20:32:26 +0800 Message-Id: <1476275641-4697-30-git-send-email-lizf@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1476275600-4626-1-git-send-email-lizf@kernel.org> References: <1476275600-4626-1-git-send-email-lizf@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1831 Lines: 54 From: Peter Zijlstra 3.4.113-rc1 review patch. If anyone has any objections, please let me know. ------------------ 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.GN17308@twins.programming.kicks-ass.net Signed-off-by: Ingo Molnar Signed-off-by: Zefan Li --- kernel/events/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/events/core.c b/kernel/events/core.c index 2e6c2484..4713480 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -5366,6 +5366,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