From patchwork Tue Feb 27 22:34:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Agustin Vega-Frias X-Patchwork-Id: 10246293 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F1F9C60362 for ; Tue, 27 Feb 2018 22:52:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE1702854A for ; Tue, 27 Feb 2018 22:52:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1281285F3; Tue, 27 Feb 2018 22:52:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 547BA2854A for ; Tue, 27 Feb 2018 22:52:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Q3SZ+Kn1W6njFUE2fX+xtkepQryr88dkQplllrsyfjM=; b=XAXa6soD6BRlXXmkEFw8jSrDxh xMoGmQnKiRY5O+4rF2YN1B/QBkXGGUXjL4/fv8Az1AZRacBwRpCMAZwh7WqAr4kTs49AlsCn22H/s Tl0qknTcfSC74pzHgd++dPecE21r3p8fAWpULDzRM27b8yoZp5NFrYNRgNiMzrhZpvpyTC3IFHTR7 cbuofqiDJmDxVoPqnCxx3HdegI7k2TXGURzHkao5uU/vj/lcn0pRT7RoTegaVvqg4lfP3PO1SNQld MNA/MArvxFcYKhRl3ibDctxgxkRMGQarkpxEnxQ2d4KEUh4bIpmo3CURMMITK3ZgtzjH4ICaxbkOz 9B73eCdg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eqo6i-0002SQ-Jh; Tue, 27 Feb 2018 22:52:24 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eqnqG-0001Vn-Ac for linux-arm-kernel@lists.infradead.org; Tue, 27 Feb 2018 22:37:25 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1EA2F6084A; Tue, 27 Feb 2018 22:35:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519770913; bh=srrYprknw2TLfU+ghIu3VCBx90fRfov187eWihMRx0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nTp0gWQL9HxylUpf2zAVFTkfVvNmujhhbj0NsDtVMXpJeNyOO2Eo4QxQfmqPjIB3q FYfGyNmLt2Gw57ukpkehKRWI9h9zK6Atv8trQ9JnzqdmBmWm7q3v5ETuXlomDHwYrH GojHNx6dXQ9W+RBx14+ABCOasMpWXAels2A+JXB8= Received: from azshara.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: agustinv@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id E3D51601CF; Tue, 27 Feb 2018 22:35:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519770912; bh=srrYprknw2TLfU+ghIu3VCBx90fRfov187eWihMRx0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ULT3BspgsUIZWoZe+I46zzcNsHqTYiCPhByXGnQKx2mfEN1VBjbDmqw+t3KjZBlYh kr0k+qtGapWzljCUFjSq2gK1x3SBK654JlEeGYoKogh0LpPylOmDrZVKeioBRkqQdG 6m14bKM7sd1He1SFmMJ8mYZ+AHYhLtfnemfx6Bjw= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E3D51601CF Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=agustinv@codeaurora.org From: Agustin Vega-Frias To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Andi Kleen , Alexander Shishkin , Jiri Olsa , Namhyung Kim Subject: [RFC 1/3] perf, tools: Support wildcards on pmu name in dynamic pmu events Date: Tue, 27 Feb 2018 17:34:06 -0500 Message-Id: <1519770848-26738-2-git-send-email-agustinv@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1519770848-26738-1-git-send-email-agustinv@codeaurora.org> References: <1519770848-26738-1-git-send-email-agustinv@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180227_143525_245405_2E74DCE1 X-CRM114-Status: GOOD ( 12.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: timur@codeaurora.org, agustinv@codeaurora.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Starting on v4.12 event parsing code for dynamic pmu events already supports prefix-based matching of multiple pmus when creating dynamic events. E.g., in a system with the following dynamic pmus: mypmu_0 mypmu_1 mypmu_2 mypmu_4 passing mypmu// as an event spec will result in the creation of the event in all of the pmus. This change expands this matching through the use of fnmatch so glob-like expressions can be used to create events in multiple pmus. E.g., in the system described above if a user only wants to create the event in mypmu_0 and mypmu_1, mypmu_[01]// can be passed. Signed-off-by: Agustin Vega-Frias Reviewed-by: Andi Kleen --- tools/perf/util/parse-events.l | 2 +- tools/perf/util/parse-events.y | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 655ecff..a1a01b1 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l @@ -175,7 +175,7 @@ bpf_source [^,{}]+\.c[a-zA-Z0-9._]* num_dec [0-9]+ num_hex 0x[a-fA-F0-9]+ num_raw_hex [a-fA-F0-9]+ -name [a-zA-Z_*?][a-zA-Z0-9_*?.]* +name [a-zA-Z_*?\[\]][a-zA-Z0-9_*?.\[\]]* name_minus [a-zA-Z_*?][a-zA-Z0-9\-_*?.:]* drv_cfg_term [a-zA-Z0-9_\.]+(=[a-zA-Z0-9_*?\.:]+)? /* If you add a modifier you need to update check_modifier() */ diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index e81a20e..c528469 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -8,6 +8,7 @@ #define YYDEBUG 1 +#include #include #include #include @@ -241,7 +242,7 @@ PE_NAME opt_event_config if (!strncmp(name, "uncore_", 7) && strncmp($1, "uncore_", 7)) name += 7; - if (!strncmp($1, name, strlen($1))) { + if (!strncmp($1, name, strlen($1)) || !fnmatch($1, name, 0)) { if (parse_events_copy_term_list(orig_terms, &terms)) YYABORT; if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms))