Received: by 10.192.165.148 with SMTP id m20csp1097978imm; Sat, 21 Apr 2018 00:54:25 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+KViQl8sdM6HVr75t6mgCRAAGl4q8+Cq2NSPadrTwneW6qfVyH12IbwLSHy73XaJzHZEGu X-Received: by 10.99.123.85 with SMTP id k21mr10969131pgn.364.1524297265428; Sat, 21 Apr 2018 00:54:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524297265; cv=none; d=google.com; s=arc-20160816; b=QKLFsfsjw15Q5/B4IciC0ZP3rd0+czs2l75d/gMkPnDRpAiA2zyTrKvfiYT4sCoVWr vlMWnXdPT3Sbl2p4El4m74JsCuCrt5H8eljzJFU65zpWE3ABNAlE82jd4j3KoTNjmmuO KA6tvn/fSTENkspxwdxdMuzDtTGVfpaDwfNCVS1+m6+aO6tOArIuPxTBKmF1v2nRsG/5 Kul4aIqaAZYDZmsMVGycj7xZPoYH9/w9mlE4zharwOVeazo4esYwMj77XfZf7QAmK+ZG GlnOcj18Xg6oaHWRXyOqlhon0Ygdnx3Z2LPCz9U4RO0frmhRj2mAlb7XyybI6SPjjTFo JVIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=aCdBBxjzq9YVNFeoYQ1XVlTowHf8eoWi2dYSTKq221M=; b=tBHtgkc5XtRzOE461Ts1Mo9Hu9HVcpxxTEsW8DDaHuexdjBuMZH/kyh0VdvuaklRaw deqMU6LvCDCo6YHH5U3MiOaScvWOY0tY/wfwQS/iib5aQphYBGaCLlxMfsm1u524CrBK Xbto+Cnx9wPCgAXYIGf8VFxdX1r2Qs3nMTagB7MnQl6kvZffdqIpIGQ2lTj28T7oMbWs 8iCPmF53S8NFPzVByxvAmtxGGsi6xatJEuP6VeZp5mwOm4jNigcoVVpAHqExkYWj3l2+ 2ng3wZFv7PAhawmpAd+j0czWLwqaXwZ9ZySVz7kCIlCpOo1MnPADVEVfmRoom+G6O3K/ 4tqQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d128si6109116pgc.445.2018.04.21.00.53.47; Sat, 21 Apr 2018 00:54:25 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752868AbeDUHsl (ORCPT + 99 others); Sat, 21 Apr 2018 03:48:41 -0400 Received: from terminus.zytor.com ([198.137.202.136]:49253 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751223AbeDUHsk (ORCPT ); Sat, 21 Apr 2018 03:48:40 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w3L7mSau2474151; Sat, 21 Apr 2018 00:48:28 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w3L7mS6I2474148; Sat, 21 Apr 2018 00:48:28 -0700 Date: Sat, 21 Apr 2018 00:48:28 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Thomas Richter Message-ID: Cc: linux-kernel@vger.kernel.org, mark.rutland@arm.com, heiko.carstens@de.ibm.com, hpa@zytor.com, brueckner@linux.vnet.ibm.com, tmricht@linux.vnet.ibm.com, mingo@kernel.org, tglx@linutronix.de, acme@redhat.com, schwidefsky@de.ibm.com Reply-To: acme@redhat.com, schwidefsky@de.ibm.com, mingo@kernel.org, tmricht@linux.vnet.ibm.com, brueckner@linux.vnet.ibm.com, tglx@linutronix.de, hpa@zytor.com, heiko.carstens@de.ibm.com, linux-kernel@vger.kernel.org, mark.rutland@arm.com In-Reply-To: <20180416132314.33249-1-tmricht@linux.ibm.com> References: <20180416132314.33249-1-tmricht@linux.ibm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf list: Add s390 support for detailed/verbose PMU event description Git-Commit-ID: 038586c34301578e538f6c5aa79ca82bce1b9152 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 038586c34301578e538f6c5aa79ca82bce1b9152 Gitweb: https://git.kernel.org/tip/038586c34301578e538f6c5aa79ca82bce1b9152 Author: Thomas Richter AuthorDate: Mon, 16 Apr 2018 15:23:14 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 17 Apr 2018 09:47:39 -0300 perf list: Add s390 support for detailed/verbose PMU event description 'perf list' with flags -d and -v print a description (-d) or a very verbose explanation (-v) of CPU specific counter events. These descriptions are provided with the json files in directory pmu-events/arch/s390/*.json. Display of these descriptions on s390 requires the corresponding json files. On s390 this does not work because function is_pmu_core() does not detect the s390 directory name where the CPU specific events are listed. On x86 it is: /sys/bus/event_source/devices/cpu whereas on s390 it is: /sys/bus/event_source/devices/cpum_cf /sys/bus/event_source/devices/cpum_sf Fix this by adding s390 directory name testing to function is_pmu_core(). This is the same approach as taken for the ARM platform. Output before: [root@s35lp76 perf]# ./perf list -d pmu List of pre-defined events (to be used in -e): cpum_cf/AES_BLOCKED_CYCLES/ [Kernel PMU event] cpum_cf/AES_BLOCKED_FUNCTIONS/ [Kernel PMU event] cpum_cf/AES_CYCLES/ [Kernel PMU event] cpum_cf/AES_FUNCTIONS/ [Kernel PMU event] .... cpum_cf/TX_NC_TEND/ [Kernel PMU event] cpum_cf/VX_BCD_EXECUTION_SLOTS/ [Kernel PMU event] cpum_sf/SF_CYCLES_BASIC/ [Kernel PMU event] Output after: [root@s35lp76 perf]# ./perf list -d pmu List of pre-defined events (to be used in -e): cpum_cf/AES_BLOCKED_CYCLES/ [Kernel PMU event] cpum_cf/AES_BLOCKED_FUNCTIONS/ [Kernel PMU event] cpum_cf/AES_CYCLES/ [Kernel PMU event] cpum_cf/AES_FUNCTIONS/ [Kernel PMU event] .... cpum_cf/TX_NC_TEND/ [Kernel PMU event] cpum_cf/VX_BCD_EXECUTION_SLOTS/ [Kernel PMU event] cpum_sf/SF_CYCLES_BASIC/ [Kernel PMU event] 3906: bcd_dfp_execution_slots [BCD DFP Execution Slots] decimal_instructions [Decimal Instructions] dtlb2_gpage_writes [DTLB2 GPAGE Writes] dtlb2_hpage_writes [DTLB2 HPAGE Writes] dtlb2_misses [DTLB2 Misses] dtlb2_writes [DTLB2 Writes] itlb2_misses [ITLB2 Misses] itlb2_writes [ITLB2 Writes] l1c_tlb2_misses [L1C TLB2 Misses] ..... cfvn 3: cpu_cycles [CPU Cycles] instructions [Instructions] l1d_dir_writes [L1D Directory Writes] l1d_penalty_cycles [L1D Penalty Cycles] l1i_dir_writes [L1I Directory Writes] l1i_penalty_cycles [L1I Penalty Cycles] problem_state_cpu_cycles [Problem State CPU Cycles] problem_state_instructions [Problem State Instructions] .... csvn generic: aes_blocked_cycles [AES Blocked Cycles] aes_blocked_functions [AES Blocked Functions] aes_cycles [AES Cycles] aes_functions [AES Functions] dea_blocked_cycles [DEA Blocked Cycles] dea_blocked_functions [DEA Blocked Functions] .... Signed-off-by: Thomas Richter Reviewed-by: Hendrik Brueckner Acked-by: Mark Rutland Cc: Heiko Carstens Cc: Martin Schwidefsky Link: http://lkml.kernel.org/r/20180416132314.33249-1-tmricht@linux.ibm.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/pmu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 064bdcb7bd78..61a5e5027338 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -562,6 +562,12 @@ static int is_pmu_core(const char *name) if (stat(path, &st) == 0) return 1; + /* Look for cpu sysfs (specific to s390) */ + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s", + sysfs, name); + if (stat(path, &st) == 0 && !strncmp(name, "cpum_", 5)) + return 1; + return 0; }