From patchwork Tue Aug 23 19:51:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 74523 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp2267961qga; Tue, 23 Aug 2016 12:51:29 -0700 (PDT) X-Received: by 10.98.10.71 with SMTP id s68mr56560236pfi.110.1471981889840; Tue, 23 Aug 2016 12:51:29 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si5301996pfy.74.2016.08.23.12.51.29; Tue, 23 Aug 2016 12:51:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755003AbcHWTvQ (ORCPT + 27 others); Tue, 23 Aug 2016 15:51:16 -0400 Received: from mail-it0-f45.google.com ([209.85.214.45]:38473 "EHLO mail-it0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754703AbcHWTvO (ORCPT ); Tue, 23 Aug 2016 15:51:14 -0400 Received: by mail-it0-f45.google.com with SMTP id n128so154926167ith.1 for ; Tue, 23 Aug 2016 12:51:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=vCm1pSJJfN+oXKD4mSFYxN6Cq8vMgO+DHrhgLTt+HSA=; b=LNOzrlUyvYbeSKz/oJIH6O6FzsZYV9GUstLP9Z+8shldWQKbWGe3lADKzXYbdqXgzW DkrmvFiZ+UbwrYeanOQXQOQaeouyOdoiF2NkEMIXGio0tKZZR5BawJjxvyk/a4ND/pVg qgmMLH3rHIVx1E225Dl6C8xbtp0IeO9cgSv9Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=vCm1pSJJfN+oXKD4mSFYxN6Cq8vMgO+DHrhgLTt+HSA=; b=LcQ0JsyS3qkCAKBBg4L+IFMBp9QCLUHSKB1d/fZzpArVGbA4duEleJ45/1geNGusGJ YrfagaXUDibjXzLhCnBhbRqMTawGivcGjVbVHP/txczZKUthP7AR+0q5M63lTBtnxYui 7HHboetgyWpwotXNUWd6ou/Mwy06C9h1mc8JEeuVfivS9r3npi/+15ei0vYrLFti/+pJ b1CF7+lPL5IsyNZhIf9wQKlrKjmyIzO0vUS86+m3uJ7zJwuXZbygJNRbDPK2kNTXWyT4 T900CzAaQvEi1ds5ZMzkGFFXm/zUNaS4QVE4r6tQFRn5VtU5An9NjD8UHeunERcY1R/3 2ccA== X-Gm-Message-State: AEkoousAKZs7/XdhanhxiJG9rWwOvgQhuNNgWzSRLKsiVWkceMDrak+KaGjnLva9vfUkU3wq X-Received: by 10.36.203.69 with SMTP id u66mr27617008itg.8.1471981873249; Tue, 23 Aug 2016 12:51:13 -0700 (PDT) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id h63sm10196445ita.12.2016.08.23.12.51.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Aug 2016 12:51:12 -0700 (PDT) From: Mathieu Poirier To: acme@kernel.org Cc: mingo@redhat.com, peterz@infradead.org, alexander.shishkin@linux.intel.com, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] perf tools: Adding support for address filters Date: Tue, 23 Aug 2016 13:51:11 -0600 Message-Id: <1471981871-2025-1-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch makes it possible to use the current filter framework with address filters. That way address filters for HW tracers such as CoreSight and IntelPT can be communicated to the kernel drivers. CC: Alexander Shishkin Signed-off-by: Mathieu Poirier --- tools/perf/util/parse-events.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 2eb8b1ed4cc8..912b43108da5 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1760,8 +1760,24 @@ foreach_evsel_in_last_glob(struct perf_evlist *evlist, static int set_filter(struct perf_evsel *evsel, const void *arg) { const char *str = arg; + bool found = false; + int nr_addr_filters = 0; + struct perf_pmu *pmu = NULL; - if (evsel == NULL || evsel->attr.type != PERF_TYPE_TRACEPOINT) { + while ((pmu = perf_pmu__scan(pmu)) != NULL) + if (pmu->type == evsel->attr.type) { + found = true; + break; + } + + if (found) + perf_pmu__scan_file(pmu, "nr_addr_filters", + "%d", &nr_addr_filters); + + if (evsel == NULL) + return -1; + + if (evsel->attr.type != PERF_TYPE_TRACEPOINT && !nr_addr_filters) { fprintf(stderr, "--filter option should follow a -e tracepoint option\n"); return -1;