Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp995556ybb; Wed, 1 Apr 2020 13:35:05 -0700 (PDT) X-Google-Smtp-Source: APiQypLVc7kEbDY/toRWrRvnOEiRNS6wg66pS2xs9bpmhsssNWwdEg0y37UBvJVkHdqRpLR1HSwW X-Received: by 2002:aca:5b04:: with SMTP id p4mr139420oib.105.1585773305556; Wed, 01 Apr 2020 13:35:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585773305; cv=none; d=google.com; s=arc-20160816; b=YS6Sn5yk63ye6671h93ou8XnEvUzf1weBlrptnnpMJJI+DgIpExknex1So77PGTFDR tB2xXm9ESf62ZWN4wUyK/R93dEJjN3uhYo+MjmR+fEdCsmK9lZ9G34myLvDyE1tBdMSy It1SlOhuXFTWWUtZtlQ88MSrRVHQM7C3PiootO2M2D3/Ck+IgxxMtTrPfoaaXVEGsYU9 uOYfPMSXjqO/YyMfCisnZ2AghT0nsT+khHToIODpTipXcowhrTf7sbRaODe+GbpV+CPl D2wf2zgxHJS0wBmeEuhbxadvJ3RzZIUGo+m583UOmL+ERKZeOpmCEmSyoA8zhm2bQZUP Edfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:date:subject:cc:to:from; bh=+sXupTA73NjQ9D5gTcpxnjHiJy1amP6mpR1gI+VIG/w=; b=AK2r6XYV88v8i31cU7/6ynSJhB+0+sJjv+kWWClgdApzn+QZ9rs/tn8opcTWizdSc9 3fpSS8T4xhhrT3R4NP/YTvtz3GkvubTCEZf62XKIHWDGZRMGsh9WEQORaZ1so8D09VMd Age5h5TzQLuP+up+u+4/ji91HlV8SMzklcTbt5tB3uIwJQUD75RU5Qq06JhFy0hpFoNp 1cbibA9kQtfewvGaMhxjSWlQRiOBU2L+1TOSGtMMSWPB0kn2y3qDFUstRfimY8v+a7FC ZsNgicw8/XLU2ulkwJf6CCzuZuYF92vAI3HNf+TrXWPAkci/i+EI62Fwl7b1VMztvVBM YG7A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e25si1195636oti.274.2020.04.01.13.34.52; Wed, 01 Apr 2020 13:35:05 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732560AbgDAUe2 (ORCPT + 99 others); Wed, 1 Apr 2020 16:34:28 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:19398 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732337AbgDAUe2 (ORCPT ); Wed, 1 Apr 2020 16:34:28 -0400 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 031KY51k182798 for ; Wed, 1 Apr 2020 16:34:27 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 304mcbqumk-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 01 Apr 2020 16:34:27 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 1 Apr 2020 21:34:23 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 1 Apr 2020 21:34:17 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 031KXE0t50528760 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 1 Apr 2020 20:33:14 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 255F7A405B; Wed, 1 Apr 2020 20:34:18 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 65BB9A405F; Wed, 1 Apr 2020 20:34:12 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.199.38.236]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 1 Apr 2020 20:34:12 +0000 (GMT) From: Kajol Jain To: acme@kernel.org, linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au, sukadev@linux.vnet.ibm.com Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, anju@linux.vnet.ibm.com, maddy@linux.vnet.ibm.com, ravi.bangoria@linux.ibm.com, peterz@infradead.org, yao.jin@linux.intel.com, ak@linux.intel.com, jolsa@kernel.org, kan.liang@linux.intel.com, jmario@redhat.com, alexander.shishkin@linux.intel.com, mingo@kernel.org, paulus@ozlabs.org, namhyung@kernel.org, mpetlan@redhat.com, gregkh@linuxfoundation.org, benh@kernel.crashing.org, mamatha4@linux.vnet.ibm.com, mark.rutland@arm.com, tglx@linutronix.de, kjain@linux.ibm.com Subject: [PATCH v8 0/7] powerpc/perf: Add json file metric support for the hv_24x7 socket/chip level events Date: Thu, 2 Apr 2020 02:03:33 +0530 X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 20040120-0028-0000-0000-000003F03BF9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20040120-0029-0000-0000-000024B5C36C Message-Id: <20200401203340.31402-1-kjain@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-01_04:2020-03-31,2020-04-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 bulkscore=0 mlxscore=0 adultscore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004010165 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Patchset adds json file metric support for the hv_24x7 socket/chip level events. "hv_24x7" pmu interface events needs system dependent parameter like socket/chip/core. For example, hv_24x7 chip level events needs specific chip-id to which the data is requested should be added as part of pmu events. So to enable JSON file support to "hv_24x7" interface, patchset reads total number of sockets details in sysfs under "/sys/devices/hv_24x7/interface/". Second patch of the patchset adds expr_scanner_ctx object to hold user data for the expr scanner, which can be used to hold runtime parameter. Patch 4 & 6 of the patchset handles perf tool plumbing needed to replace the "?" character in the metric expression to proper value and hv_24x7 json metric file for different Socket/chip resources. Patch set also enable Hz/hz prinitg for --metric-only option to print metric data for bus frequency. Applied and tested all these patches cleanly on top of jiri's flex changes with the changes done by Kan Liang for "Support metric group constraint" patchset and made required changes. Also apply this patch on top of the fix patch send earlier for printing metric name incase overlapping events. https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=37cd7f65bf71a48f25eeb6d9be5dacb20d008ea6 Changelog: v7 -> v8 - Add test case for testing parsing of "?" in metric expression - Reaname variables name to runtime v6 -> v7 - Spit patchset into two patch series one for kernel changes and other for tool side changes. - Made changes Suggested by Jiri, including rather then reading runtime parameter from metric name, actually add it in structure egroup and metric_expr. - As we don't need to read runtime parameter from metric name, now I am not appending it and rather just printing it in generic_metric function. Kernel Side changes patch series: https://lkml.org/lkml/2020/3/27/58 v5 -> v6 - resolve compilation issue due to rearranging patch series. - Rather then adding new function to take careof case for runtime param in metricgroup__add_metric, using metricgroup__add_metric_param itself for that work. - Address some optimization suggested like using directly file path rather then adding new macro in header.c - Change commit message on patch where we are adding "?" support by adding simple example. v4 -> v5 - Using sysfs__read_int instead of sysfs__read_ull while reading parameter value in powerpc/util/header.c file. - Using asprintf rather then malloc and sprintf Suggested by Arnaldo Carvalho de Melo - Break patch 6 from previous version to two patch, - One to add refactor current "metricgroup__add_metric" function and another where actually "?" handling infra added. - Add expr__runtimeparam as part of 'expr_scanner_ctx' struct rather then making it global variable. Thanks Jiri for adding this structure to hold user data for the expr scanner. - Add runtime param as agrugement to function 'expr__find_other' and 'expr__parse' and made changes on references accordingly. v3 -> v4 - Apply these patch on top of Kan liang changes. As suggested by Jiri. v2 -> v3 - Remove setting event_count to 0 part in function 'h_24x7_event_read' with comment rather then adding 0 to event_count value. Suggested by: Sukadev Bhattiprolu - Apply tool side changes require to replace "?" on Jiri's flex patch series and made all require changes to make it compatible with added flex change. v1 -> v2 - Rename hv-24x7 metric json file as nest_metrics.json Jiri Olsa (2): perf expr: Add expr_ prefix for parse_ctx and parse_id perf expr: Add expr_scanner_ctx object Kajol Jain (5): perf/tools: Refactoring metricgroup__add_metric function perf/tools: Enhance JSON/metric infrastructure to handle "?" perf/tests/expr: Added test for runtime param in metric expression tools/perf: Enable Hz/hz prinitg for --metric-only option perf/tools/pmu-events/powerpc: Add hv_24x7 socket/chip level metric events tools/perf/arch/powerpc/util/header.c | 8 ++ .../arch/powerpc/power9/nest_metrics.json | 19 +++++ tools/perf/tests/expr.c | 20 +++-- tools/perf/util/expr.c | 25 +++--- tools/perf/util/expr.h | 19 +++-- tools/perf/util/expr.l | 37 ++++++--- tools/perf/util/expr.y | 6 +- tools/perf/util/metricgroup.c | 78 +++++++++++++------ tools/perf/util/metricgroup.h | 2 + tools/perf/util/stat-display.c | 2 - tools/perf/util/stat-shadow.c | 19 +++-- 11 files changed, 164 insertions(+), 71 deletions(-) create mode 100644 tools/perf/pmu-events/arch/powerpc/power9/nest_metrics.json -- 2.21.0