From patchwork Wed Jun 28 10:29:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13295541 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45A6BEB64D7 for ; Wed, 28 Jun 2023 10:32:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QVGR3/Ct+UQ1Vmx//asUFqFSsrUiydAK8J9EiLuHvkE=; b=ksful1hehfHlYF np7ZDSBv/i0fgC3tiaWeAmfvpOOWrq4eUN2KKJUPSo1NQdWA5vlsXo6DPgRMk8OZOHMSFIuX/CWMy v9ze0irX+uSpXzNX1S/RmgX87T4XInQkr1DZiK7ndEGrajpuNqKiH7/P3RBm8VnkpZ5ocTx2vUD2c IJmGDLQpylG58kj99+SaoLdCVHRslOCD74BseJV0JUCPvNH7ELu//3gfyA6hQX6vRGuEJYIg1tAzn Sl0uMvdiqiaZ3MpPRysMbmrU6zzV0mCsgzu7BAkCMIR7rUgr07pPQZmRCxPQlgniP6e8dbRM/Crs8 puP4aoDdyq/4o1oLrusw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qESSm-00FMZs-01; Wed, 28 Jun 2023 10:31:52 +0000 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qESS4-00FMJY-0I for linux-arm-kernel@lists.infradead.org; Wed, 28 Jun 2023 10:31:13 +0000 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35S8xqNI006634; Wed, 28 Jun 2023 10:30:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=SF2Z1yQ6fGo8UydqYC7791DC6yuhonVUb/gGK8uueS4=; b=H0yVBlJmocXu11xJfkTeIX6ZxwiHUBg19hNDMJQeQxymnPpIUqehlqszGxNIYQUV8fcb +zyuf78Q+JnLJ4O/qvofzc8AoRGt10R5fQ0V40GAz9OtJ5wBa2HF6NA5UczI4MJEVn2P AJ/pY5T4q9TqwO5az5/aQILdMpCc23bj1MPZXj+ujj6torQFOI6h7mOoa67Lwbvsy/Yq nqeHB/l+szkL5yqqMEIUQZShvdmvgm9QSlvdp2JQ0Do7tOguL/Sa9Ig5ARkUm5lrObQT yqpdkcCVMX4eYuYtHmnN80pjrisSOArqZzUfWYPAm3nsD1oJZBmb6P2Yo4S1JN9Ni5cW Rg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rdq30y9nd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:14 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35S8vphs013125; Wed, 28 Jun 2023 10:30:14 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2049.outbound.protection.outlook.com [104.47.66.49]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rdpx629e3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fDFQ+h62MTkY2qFVrrSX9M7f8fZS2aCvJ7x/5nV/4PWrowSWg9j5m6KzUWAVXaJi0HOK6WX6tXUrLLuw4+0AGBKFUGiYRFrAvHlvJi6qnjVQSu+WPVZHlk81svGnecNjJfs+ZghwHNrIr2XCzrOhmfKOn9TCZa5ZoQL3wyL58YJRK5wfJbYr0IiEsGj5iTQ3IGSi7TN18yqcrzi90CBGgXddoQCrO9Mseiq0P5aS4FvL3W/MMg9GkagjJwLbexQiJwcBDh7aUoihtaXCz6CJEDnJVS7E9h/Boe5N0hdvXsaAhkcZvHwdN9XCw/ez+l5gT/QVDjMXfSs7Mn2q75p+lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SF2Z1yQ6fGo8UydqYC7791DC6yuhonVUb/gGK8uueS4=; b=GwKffwmhpaUls6hrK3eRmwD66iMAiQgy+mEuAtUi3xj+PaWtjJiwDAIqRMp2R5gDZm57qgVKm+XVGo/rvz32tYcKXZNVFcm9TpxgkEdIwz/AF1STnwd1gu0KRjfXyMPu6nk8RAGx5le+0iZeP3QzFT3WJRQmlcpQN17yfkbmNi+PulNijleRwBVHiVpvWHL60fQbA3Oyo8lB+l7jpGupf7mjJIfp9mrwpDhk/zmbjoCTBjw+5HJA4qmBOTo9J8XjDk4NTJ0zoV17NAHLp6SGfUZfQsdWHGgk+AA63Fc2Hzaw1uZQZ+7PCP+DP3W+7QZYg6VP+wpIZ2ni9Zuiblrq8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SF2Z1yQ6fGo8UydqYC7791DC6yuhonVUb/gGK8uueS4=; b=p4rk+9sDNi/a2ZaQwP6jxoqTYsIL7DTNq2A9k+X79yL9yGh8GWMRJCiM6qEoK3xsmNTITe1n3ACD0Rf9G8wVQb+7Rir2ZRq4PLb6Gb8pGliDw9WJnOF19Z7+Anqs5ATn8meCC4mtfMm3xiONGLym0CMyYoDrWerNLg9sH4j6N18= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SA2PR10MB4715.namprd10.prod.outlook.com (2603:10b6:806:fb::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Wed, 28 Jun 2023 10:30:11 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb%7]) with mapi id 15.20.6521.023; Wed, 28 Jun 2023 10:30:11 +0000 From: John Garry To: acme@kernel.org, irogers@google.com, namhyung@kernel.org, jolsa@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, renyu.zj@linux.alibaba.com, shangxiaojing@huawei.com, zhangshaokun@hisilicon.com, qiangqing.zhang@nxp.com, kjain@linux.ibm.com, kan.liang@linux.intel.com, John Garry Subject: [PATCH RFC 1/9] perf metrics: Delete metricgroup_add_iter_data.table Date: Wed, 28 Jun 2023 10:29:41 +0000 Message-Id: <20230628102949.2598096-2-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230628102949.2598096-1-john.g.garry@oracle.com> References: <20230628102949.2598096-1-john.g.garry@oracle.com> X-ClientProxiedBy: BY5PR16CA0032.namprd16.prod.outlook.com (2603:10b6:a03:1a0::45) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SA2PR10MB4715:EE_ X-MS-Office365-Filtering-Correlation-Id: 7aed91fd-f1f0-402a-2146-08db77c2a74a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2IXrvDdYCpF4YF3Ttsbecpc+S3LJOgBayXDIIt1x7ePBDASRsW+ZY3y/2EovQq3j/VP90DzkK/M2LfLsY9XuvHm7xKzIMzDT1Z6LwwVyitgafhDykKTonuOlLS+ckVGbtBnd6mVF1cSZx8E22hp3KpCLIcY4ss5UyYYIX2gXL7Q/KAlq+aQqB4LJ/v/EjLWHCU174FS2zt8LeI7VOD0qk6+Am1mgBy/s6bQ0YK/euG8nNrL2Kt2K3/xVtuUINRgd8bqLmjHmtBECf5aW00Z0UUlBjus/QCjXCsxus8jqqoarAz8iz3UAwjKAkWRvUGSKnJF5II0sdKoZ/T3/pVo1CBXEJik+Asr6vf8UXQ/wXfjCPGUgoYwnRINBS8n2MZC0HcPf2/uC5EkZ5b2Sm0lqEvSsSpAvffFLxr0UmxfOTUwlvLoh7SE6zUazehv5Kmtl5jeTGRh/zheI+BjtJ0DrfQY5jOXBFx9SNAlayOUlbdCDqs9yIeecEFl2eR/KITfF1uou28hGnXiKotlIpc200jYgXRlw4+j8VTVjSgZ+PlevDHpVtGYtDgP5QulHPZqG X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(39860400002)(396003)(346002)(376002)(136003)(451199021)(38100700002)(83380400001)(103116003)(36756003)(86362001)(478600001)(6666004)(6486002)(2616005)(8936002)(316002)(66946007)(8676002)(41300700001)(66556008)(4326008)(66476007)(107886003)(1076003)(6512007)(6506007)(26005)(186003)(7416002)(5660300002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HY0PuDNePb08X/ZOufmc5Pt8tnN64xytqQN1DyUqZIbPIw91XS8AudEm7LZvoVUjPpGty0s7Wc2hb7b49bhtN4eoCQK5i2dqX2sGvroj96ZtOViEX1BwVCB1rcnVA0m/SPQ57i6Big1hQkmSvLsYHpE5gCn3zhhv8PLMFSi/VBj+AP79NVrZleEYcP+8Vq1G9rGwdaXDKi0agQO78wFoqgJNStkHrVl15RuhvSjSXvW3mCZiU1Xyv62rPVs7vhR/FuPcLlONE8t8gstj6NiV5mxA99PDNzl1pV2f+A8E073JGjBc61g4oAYVeHFfV1Aebvghjx0/DVYmYz0Kuklq+NRGwb5+uX0rtV6bbPkW+6wtcYLVcY/jkbyk3l29QT3GAtuT/A4qaXTQxn1IiDP/slOmkRN9GWRMNLNYrzF84mM92zrh0wBNndWLKYt7SjjFd/hUtVg52fan0qX9mz2CF2/RvUqHaLfu6BI8FJYxom1qPueD8KVAL8U7eMM1NIyE31GOGToOkLTElFhQ9rPjykYZwWCFfStFX7Bj2z/ayk1vChVqcbzaxlsJiiOFVhxMGAlawFnV2G6E5VSuuR7sHT5TtXiqizgfnT1Tjtf03Upkd7EMX5E9P2jOY1XolWcKmqaPjU2UkFuwcJQD2oRVidLl046FX5XVNZpKgKiQg6OrqmI4PFfZymHlqZkHPxwoAPKHYCectUIapS/DjdAErBlNtasGl886XCRDc/fVOOC6Fdv3efOTFvo6JbFRBC5USJ82lXbAjB4OtwOCmxxQyghCv6AHP4DX3sSzxhnwuI6XHtW7P2CFNh//zbI9qEUXRJFYZQyBk2OlxRLZVVgwLxiGTmg60CwQJC33ivVP8CjKyvEJJAf1kZyJJvx+noC3+xaqpw9hLxsr69kqg9gl/DkGqxsutTOduvoE7RvCQ8AV6+IZGNDw9swgC8ALb5eYJTDNF+FZksfz4PCsCdGbYWeUy5wxzBwsEujBy+GlkTcx4jkupj3kEgYgPv3C1g1Rcm9P9JXFTUn0IsH+XvuYh1XpHuVkG9hTuio1OVdqTX1aumJ6WquOLlnaAqre7rkDnr4LEKBMv7z4mX+K4hp/scdLfFo/mzfGYI+hf7Wtm6+Ff42KKb8NUixIXs7d/fZf9zq1pueMoRrOySmF+qUM5/0gv/9pMKn09ZbVKckIW9xL6Knjj0g6sySlnjWZhDJlUtKufSUosTA+1Hxl4nNxiktbE6+SaguloqeLrrmR8tHCdop8DU6kyV8rj7roqYY/47Q9d+F5KQay2KKKwUwAqC/3nry7z/GFWIYs9CByhFYlCbIegf0LHDev8nYH273CNtKbfdbaq+jgp4fi8GL0kM5po14+4O24narGHNlFs7Dy5pv+YmjaL36Pe1DmYOcVLZqToj5khg/BkeiwmXYPyGkJDDNXqSge18NsF9c++ia6pXRmX7+T4BQIVCtGAggGg1/JF8vAZhtVL/SdNgnr+SbV0PSO2UmUBFTi3PjmykngZ7jb3fRgkvVqwWEiZOnfEhc924Hi9E6gzVdwpmK60c8pAbNutuGxNRzj2m3oAtvYNNTQmfmDj+p8pqG3WZltoM+sC6KnR8pBCGYewUiRCQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: K4gq6sGswh7mtwLc+wLsro0l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bj+ITua81ibQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7aed91fd-f1f0-402a-2146-08db77c2a74a X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2023 10:30:11.8257 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rxp/8UHY8/BbWKhJj6Pjxkt/1wWH0NN3EcDEBsONomj2CDaPQh+DU+tDyoZ2eAIDvdWa5Sla+jKXsfh1VY5F9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4715 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-28_06,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306280092 X-Proofpoint-ORIG-GUID: nWAHPee0XKvOZcxCXFabLcwtA3-pIKBj X-Proofpoint-GUID: nWAHPee0XKvOZcxCXFabLcwtA3-pIKBj X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230628_033108_133313_B3CDFEF7 X-CRM114-Status: GOOD ( 18.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Member metricgroup_add_iter_data.table is only used in metricgroup__add_metric_sys_event_iter() as the @table arg to the add_metric() call there. However we only use the @table arg in add_metric() for resolving metrics, which is currently not relevant to sys event metrics. As such, don't bother passing this @table arg and use iter table instead, which is more sane. Signed-off-by: John Garry Acked-by: Ian Rogers --- tools/perf/util/metricgroup.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index a6a5ed44a679..4389ccd29fe7 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -798,7 +798,6 @@ struct metricgroup_add_iter_data { bool system_wide; struct metric *root_metric; const struct visited_metric *visited; - const struct pmu_metrics_table *table; }; static bool metricgroup__find_metric(const char *pmu, @@ -1112,7 +1111,7 @@ static int add_metric(struct list_head *metric_list, } static int metricgroup__add_metric_sys_event_iter(const struct pmu_metric *pm, - const struct pmu_metrics_table *table __maybe_unused, + const struct pmu_metrics_table *table, void *data) { struct metricgroup_add_iter_data *d = data; @@ -1123,7 +1122,7 @@ static int metricgroup__add_metric_sys_event_iter(const struct pmu_metric *pm, ret = add_metric(d->metric_list, pm, d->modifier, d->metric_no_group, d->metric_no_threshold, d->user_requested_cpu_list, - d->system_wide, d->root_metric, d->visited, d->table); + d->system_wide, d->root_metric, d->visited, table); if (ret) goto out; @@ -1275,7 +1274,6 @@ static int metricgroup__add_metric(const char *pmu, const char *metric_name, con .system_wide = system_wide, .has_match = &has_match, .ret = &ret, - .table = table, }, }; From patchwork Wed Jun 28 10:29:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13295539 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C8C64EB64DC for ; Wed, 28 Jun 2023 10:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oYtj0oeM/r8kY+0oU2ik7reQ38h66SgKLOmR9/tFv7Q=; b=iuZ7Dv7k1OxBDi Lok0TElPChK0g0Ho1utzZkCmUMihEfbChlq55rKBcJflPSaoIMqboYeW1p8XXzkiNrfgDis0vLihI Am5W6mweVhwiCxBGgCfEHym6dFLT/Xruozmh2L1KD3erYROKiVbYytOX2RIs2oaTBZx7enxXJ6JTx jHJmBKlPWE/LK1t4dPI6pfqJlBMiux8/Buaie5gH+DHBAmIGF0pdnPG6lGUjiUPbZlxxgi/3kycHF rLQO27qyHk+rv4tWJ68CBSjxuidjG/iZFt0haP9Ldg5aW5TzVObyLQVuYfXKHu7k8Stri3lCrXBs0 G/N5l2RfSpEooG5znl3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qESSo-00FMc9-1g; Wed, 28 Jun 2023 10:31:54 +0000 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qESSO-00FMJV-2c for linux-arm-kernel@lists.infradead.org; Wed, 28 Jun 2023 10:31:30 +0000 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35S8xoRh021934; Wed, 28 Jun 2023 10:30:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=I8X0xtui01ztzPFpCBdcLmFRSBjJ2ZtxODRIixykgeY=; b=D+mJCgRaO1OsHD7Orh0LIwY+EA8wZwxfgyDNfXn5iP/fracIzr9qDqnBAcAJHLdSjlTd Sv2k8oODW2nRvD3poIiwb1YLKe2PuHjTDJirvokAfqIxwFgUTT/9dzk7YVN0LT/DmfrC vP81h6BLSQ0XwqLKlZvfWv8tu2M14oOAoPu8ePSsA6e/mc42NoeSQJJ/aJeTxpVjeY5A r+acVUTaI74JN3ciHto9wbTn2FoZCXNY9lORoiuAQm2a1ow4OgPK7efgdW5wEYraVEIK b8sBx4oJ820EjsyDusqzoSkqGr3l0NdjtnwXTw8KaJJg4G0xrbe4ishMpwzQFnW/aiSl oQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rdq9376f0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:17 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35S94uSQ038175; Wed, 28 Jun 2023 10:30:16 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2048.outbound.protection.outlook.com [104.47.66.48]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rdpxcaxmt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bsL7q4BdzieD9vee7kwtF2QGlcj8n3qL1KzmdLbwm8I0RBPWVd6ouN7DcHAkl0PY13fQjrdJdf4IPobXE1vNmYsfgyAFO+E+m4WjdWXwvrVPTvcnsgm8prUUxNExSgtLFOz1j6MoUNrxC59v3aMM8s4QOk4aDdjdQFf3JjRv2p+KnifKGbcpOpd8P5P/Bnyuaccyz+R13x1S86VuaK5SN9KjeIo/62J0XXTGJPZt1AaaDW90RPhvrZ4wlbkS5xVlmVZcPK6C3RhK+Of0krWPCWsxjvvom7aMDvpow5Shin5ZGh8jePZ4SviVFOwASkS4WRFuVCT/nMF5qVCiJ+ceww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I8X0xtui01ztzPFpCBdcLmFRSBjJ2ZtxODRIixykgeY=; b=HxfBoMBMgk5gIrtR3gMNHRksSg3hMvoO6iXZnIs0sX0bK+1ol1nOxHgvxNVrTyNXvzAl2u8Nx4kTp4Q1REDwY3u4mpplun6juoXuqAVk8FtrCv3avEv69IJf4+K8dRq3v0sG7eBZ7Rv1p7bZ9sIPgjbqK3bmmkTjLAale5vmauiN6ZO8+Du9ZcjDadiryaQEEW/cWiiZA9NgJbLGsrXFJTPOsskmHUdBudahw0nm6o95WGiqM/OYaawpnvKblDu9FMMcScozPjzK0wwTgZKLQYrzspa6Q81VWiPY8FmjbrB0NI3wTVaMlvK9gY+f+3Jr/jc4/RWPJVOG9EB+ECt52g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I8X0xtui01ztzPFpCBdcLmFRSBjJ2ZtxODRIixykgeY=; b=zwgIv0B4gj35ayTmbyD4OlEUXmimqk7jnlMyc9A2naTNs9STRbVEtLg7zz92Ds73VH4Yon2uUjpjAXZOE1dGG4WR1h8+QNtDHEwgkvgo9xgjXlqDMrmqQfACIOv/vxEjBwD9ecWufPppQK7x57UGBfm05bpkEOkQdCNBKF3GjFo= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SA2PR10MB4715.namprd10.prod.outlook.com (2603:10b6:806:fb::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Wed, 28 Jun 2023 10:30:13 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb%7]) with mapi id 15.20.6521.023; Wed, 28 Jun 2023 10:30:13 +0000 From: John Garry To: acme@kernel.org, irogers@google.com, namhyung@kernel.org, jolsa@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, renyu.zj@linux.alibaba.com, shangxiaojing@huawei.com, zhangshaokun@hisilicon.com, qiangqing.zhang@nxp.com, kjain@linux.ibm.com, kan.liang@linux.intel.com, John Garry Subject: [PATCH RFC 2/9] perf metrics: Don't iter sys metrics if we already found a CPU match Date: Wed, 28 Jun 2023 10:29:42 +0000 Message-Id: <20230628102949.2598096-3-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230628102949.2598096-1-john.g.garry@oracle.com> References: <20230628102949.2598096-1-john.g.garry@oracle.com> X-ClientProxiedBy: BY5PR16CA0029.namprd16.prod.outlook.com (2603:10b6:a03:1a0::42) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SA2PR10MB4715:EE_ X-MS-Office365-Filtering-Correlation-Id: 6048d41f-99e0-40f3-ddd9-08db77c2a878 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NN1HADR2VeVXUZQaDLFJ6ajN6mSPNa9wuEP0EO4ncyjPiCC4iXHMVauNOIwZ029tRifI1kSdjISnXvXzqZlk1zDDwbpA/StoaQE32RWi5WNk5d9wUCaHeUCOgRIy+l/ZTnEuLn6VTz1fhUfNiD46Tiz/FmX57pIOa8OJi2HZVLCxQhJvjvm/AGXcEXBw5wLWmfCqn+SWKcM5w08gGXi32qlGunu5SIyB3FptVQr7ehiJbo3QfvRQBCqR6tC3ny3JEaSOP4JJ/RSS7oPSh//ZTSeUD6cMzVlKpiDU1BOehkGxEeiqLHXD/ClJE8wV1tbbGU6xwDarFa2a6nS60JWsOIpGSzmdc/ORoLErpgG0K/hknMgSxprxgWPHmbcXDMAFJKSoYGJhrhFDk5xdXb2wNtmaJo0e0mtMUAEPxAuvjGefaP5tyUKzRlK3kHk1CcdzBBOLL1AhN2yyg+XlXW1/WFXZLVymxjxrwdo2g3sOwTyH4LW1KDRqvWQCPgYPJICWOmv3ltfryGI92OI5zcHhAI3Wx+jOKVHZOITEF1T2hCPao2MvUEbWlZhHfODXLNfF X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(39860400002)(396003)(346002)(376002)(136003)(451199021)(38100700002)(103116003)(36756003)(86362001)(478600001)(4744005)(6666004)(6486002)(2616005)(8936002)(316002)(66946007)(8676002)(41300700001)(66556008)(4326008)(66476007)(107886003)(1076003)(6512007)(6506007)(26005)(186003)(7416002)(5660300002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iBwpMwPirNZHYX21wuZGMhUFcpHDjbiaUro6qlwgD8DZFK6DnRFbbPefaYlH6LjfOQz8tbJNzV1PYgPGbd1ylarZzO4NKfZimooYx4kgjU4mEAt4Lpkei/igOxcBL7od36+EhgQiWWPN15Vxud0ygaeyxSGINocQoTpj0VxDQCrTdjs7khUQ2fFLEEEs3rs7K7aHriEgunD9NK18Z6/PciDrAKBLP8t6JxiwyDwXMPXEejRpKjHpvNjpVpk1ZyMeA2HH0wCgC7nyNjzQ/7KdIPCPiAFmeKFwbHv2FkjCCTzKUWO/jT2Dq87bzZBRYss908sctuGz/AfNXy+zsxTSxV9kA29SOz8VEiBfeLYcCX+5Rjj9qQtW6rBJcKJMF+xZKMcCccz8mW1UZWm9Grn8kFE2oXdiBjrJLBhNkldu8f9qPnAlI6h+FEiqhczgyLZH4SMoSMdz29/QItGgGKtWKqPJ3tq2b2cjrEQhPeSeblIhkSSFNUM4+ZEmAxDh16+YK6HwE/CCmzRsgm/aN7EvmDDDThGdRtZbmCo9X8KJFzPRemAds32UUM/W0NovLHpTR256ZX1vni1O2x3l+EyPH5jg3MhrlqMKbQO0sCQoOompIwx//pQSzZMHJS0EAhr19BgA3zmz9BstYqq8OSCNObXkyK4gWdEVmWM0Vml+p6kFQmDXhUcn1XH+z32ZurzX1L1dY68VaTFzkv2OF5JcR3E9PyqKyjvOyTlpKpTxt185jGlTAtD0MFiF3MlWKmO6bBiJNMxKxeY/OchE48lQxDH8p2NobsEYX6ZnthsI/lhAxJywrxD604jivVRk6OelLsIsB3BKL/+QiOA9WF/b3wBycCdVd1ijikqBN6rguzZpgWugIV29AMkev/KYWYA6HUzVi878BaGDdjRrF8wyINyisLGaDgkXwfaClO1HYn4E/XNpz8jU9gINt4nq0SFWCykHjrlxZKoHE011/VWLXfzBTvfsemwweybGf5dr/oT3N74rMsUGbDaaXZ80KLmNmWXv0V+znhe7GNE36WDK/CLT0rMO8YF2m0DD/is8c1ixBJdQGpHpF412ediA94N2rQd1X4EVRQh5YyhpQ1VPoK6qoeDRLYdaF63csdvn9YrFIxghJXVhUX/nNaKfHZb5BgytB/lNJZzlbDcKezojKCHrfyswso2egz35tEO59bgcbIzJddpLhJtwLv5ST16OBZ67fGSJQlcMTuQ91P8CvLlfo8ElzDRvYoyQ/ekh+6nMEB185Le/o1Q6UEveVQzmscvBOyZop8fTRcRFlXK02Z7b7IDve/4UGD0JpcdNHZuYBiJj5tNn8HHy2At2sxsss44f5fWoAZK3c011z2TgHSMR7QOph0lg1LO+oRqqFDViQA/E+GHFgO33UVb3OAEY1evialqv4V5boo/O1XNYlTWg9aicS4u9goPb8LtuA1xg9lI6bBVLiDtM/mEJb+E/DlusoWyxIMfNgJc9wH/HmZq7o6pWSDaCC8wPWRwqzXlo3+42qO/NmahZ8JEq2nPRZQ0+TRMSk5n/HMJs8XcrPj7JwHehoYiK0KaugIat74VAXlaRQS2y0ejCJlF11SxB7SJq4TB+yZm/phlH4uojBQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: JZjIas21fSTfSgi3HVCx/FPR6eMihTx7gDO6TamU9MtmcYr3VBUPWDNhGZluz4MZrZbcZCA9XcxJJcRqB4IF5nc/KRJB98L6GXXGGXZLSNw58Jhbxn8D3hK/SRd/sIEPKd5E29aRFncC7ps15zCEjrAUlNu/fkiUxSa3CDeXeQHjfG9thifnAEFKhwGp/Kj2EAuFOxh0iKph+NrNK8LCyBAfkZNk7JXQrwGn4aKYMSyJ/CJrMIB/pJsPXqUFY6u+W3Gl+Mjhvh5VeVqS0fRLtmBJ8rxi0Dc8n3mk40lcpJfFYBAEMYLDF6jcsGXO3LhjTziE35ZHpPtrlZ//RX5eVGTM0miaD+HtZWbO9c/Ky4oNzv0sBnNn9a19BrGZ46jHaxnutWkkGKF9oEor9YaGqr3rQe++KnUcutj9n1zYYPbw+DSVkVd7uDESH/H3KSd/fx4UbRydrKxcT/wfjH5PM6ZNWP3QZn96NTlYwlsE1mA/p7lGrwPFZbxi7ofUDsShekVFCJZHjC3sI+gtNlBljX7MfVLxjBabblxP+8XSlo6xIcsbxgBnwrCmfx/tDJh4aWnhZCcedZchrjBeCxFV3qeP+oHhYLGJSScIwL2uHYLfx3HQCYkNxCDk9Aq1Yrcz9xOjJlml8kW6+FIjEVqH7lAKKNJqrxJMRyQ6UlLK62MxB4+vR+fS2F7yOIidMXV4N50KXdiJE8+m+Ek9sMwsZCvHpHgf0/MqZyOZbQzd/3ecbQmA9rSaeTvP1O5rHkHG3gLhVTE9EuK2/FXNHnKd6x6BxlObg3U2MPBpNOFKgYj+BDOauA8Z6fjNUUpkbitYzeq1WZ5N9nvyho1Y/uGNrryuvCubjoKKyQtnCQuYPbz5qtMMFV4YwXQCWo1TzrQPgbAC5ajMZ7CZyLq/wMafs4DtBYHf4f1kFVpsGrhiLo6cvBsJI7FKqW0s9u8dnnaiQXb12Dx6lr1b73c/vdxHjZnWxyA7mUNBTREDasoT7kL/h7ofRi4ppeh96SBrKI8AEfOucNQGImeumgFP11B3jW4lT2UN3TthHLlTyPR3FospoR8nqHFv2CG+pxpPagqgsJfkBRV6+EoDOPvsMcz0LQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6048d41f-99e0-40f3-ddd9-08db77c2a878 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2023 10:30:13.8111 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hYSPcY0AcSWNLwmlKg9F5lKScU8zKa1h+ol5yLmBxZuoMzn1HF335/wpucJw+tx/DPivzHUoRQnOdCvjKx9bbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4715 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-28_06,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306280092 X-Proofpoint-ORIG-GUID: Ei7PYWfq2AY0PM-jEmehI1gadyAzAQia X-Proofpoint-GUID: Ei7PYWfq2AY0PM-jEmehI1gadyAzAQia X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230628_033128_968716_7E06E688 X-CRM114-Status: GOOD ( 18.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In metricgroup__add_metric() we still iter the sys metrics if we already found a match from the CPU table, which is pretty pointless, so don't bother. Signed-off-by: John Garry --- tools/perf/util/metricgroup.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index 4389ccd29fe7..8d2ac2513530 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -1261,6 +1261,12 @@ static int metricgroup__add_metric(const char *pmu, const char *metric_name, con has_match = data.has_match; } + + if (has_match) { + ret = 0; + goto out; + } + { struct metricgroup_iter_data data = { .fn = metricgroup__add_metric_sys_event_iter, @@ -1279,6 +1285,7 @@ static int metricgroup__add_metric(const char *pmu, const char *metric_name, con pmu_for_each_sys_metric(metricgroup__sys_event_iter, &data); } + /* End of pmu events. */ if (!has_match) ret = -EINVAL; From patchwork Wed Jun 28 10:29:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13295534 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DAF6AEB64D7 for ; Wed, 28 Jun 2023 10:31:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+T59BB54FiFNPPmEbmEe+9fLt69QfxDDq8JY4WqIvmA=; b=BBLZxOOF+AsnmX HuJlvZnvCqSGCKAfDQZ78QBKkqwwBxUcpli2MqXC9i5iJ7Wd0+QwM2qFLdmUeoiTguXhtxD0QWnQQ 5Grz0duA13sep0bZgdy2nOdNYDK+ZsPZP5tACVq2bHhS2GKMinZperua25cavUILlM2njSvB8sL+u +pOoSVrH6Iq6S/rmEW6tvsDdvVTqIEglEU/mZMHMY8unNmlAqiuyREVEok0WMVavoWIsbv5i1Mtgt i0K5P3D9M1KbYomgWNwXDhqptWUvAPoL5G1L1XeCLS4igFLYT2u/a8hFartMLCZ7wmyJzSkhc4Bod SnFVw2oznTnYfYHz6cQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qESSB-00FMOm-0M; Wed, 28 Jun 2023 10:31:15 +0000 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qESS3-00FMJX-1D for linux-arm-kernel@lists.infradead.org; Wed, 28 Jun 2023 10:31:11 +0000 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35S8xqMM006641; Wed, 28 Jun 2023 10:30:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=r4qM/ngLrfPnqWi0Fb1fg1fq9WWVMk1a99HUIWr0bPA=; b=efZYaYsPICHwJk8oq0Fvu+EWh82/OPUo4CsIAx0A+WvgZUojtWOWCBv7szHcDUDP/uJt Db0kai/z2HnoaZdTTuRcy5bwpadVJFfnc1cojXnaeN6wLTJ/NTv+z1d0LovWBGQ2ldUU sIMwjOWFmZDSjtPBW3J8gJGneBFiTiMFGWDbOIEj/bRrm8RewSQNv3G0262oimfyMi2V iyqK/ZzAgrdKTn8vRl5vMXE9a/rUY0ff4Iqt1cDqX7fMABPDIaSPorMEdW7coBmbHQ7D C6gg/0GnJbKvR8suQEFODJsy19NFLwRd3xL0IjC3dBF+o5AAxaOTA44GWLO6k7No8DBL 4g== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rdq30y9nn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:19 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35S9EXdP008565; Wed, 28 Jun 2023 10:30:19 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2173.outbound.protection.outlook.com [104.47.55.173]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rdpx5tra2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nCHSCU0yMl4HeUK8boLvqCVa5PVV22fXcj0GmYAew4W7OsP96/e1ayM0o7RgqgnqVWvQU17EpwYVQ8wgf587dTBULfZFtFPUiwyDI26zUFTzJtvY4J2VQHwRTY7mEt5qOb0bgy2IYsCnPJiNhUdVffrJCbJUwSw3n/7lJJIzDX78HO9iwU3h/e0wcmaQznar8dl+t9im7JG65NLXgaz0UhJ01KiiRE/2HraBvm8uX4AAHeTeXp4SKWUjA+ZgpcU3TDzWajZO6M3PIuxgQF/dyGwVKWLXyaRfRfmFkquMa+ZVfyXVlXya/fCdA++OTivqRjggjw8+34Io0DjcChkuMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=r4qM/ngLrfPnqWi0Fb1fg1fq9WWVMk1a99HUIWr0bPA=; b=aQVdUcNtL+gzozKzoIGsf6QG7aeKWenLUNuNIxzsq/oT1wm4+37+f2JOa10/4GTvd4jst5p26e86yn2rlJcZgp9alQ6kxFsfCg9NYNL8NieIY3NPHAO4pFWg9FCcx7Gi+PhitdhBndp35/Eywev5kI1ph5LN48vca260ZVZTIRlfziM33rx/VU41OlkSu68ZkUDtiq+gCN4KqojVM/DUt5TNfAyZebssnPy2eREEByjzDdp+nK8xtWkybxCJPX4gyMu6h0eYu7QkFLNcF564cVHViL6RQcc54Zeoz2QsT8oe0DxgBZ+QMHFpcl9pcFbL/y+XjsjcXZuvMRGRrhbApA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r4qM/ngLrfPnqWi0Fb1fg1fq9WWVMk1a99HUIWr0bPA=; b=EHFh6jKluoG0b5qu0usDHKtSbLJXfS3LDfM+d+qDZdtCCAPrL6NfNKxU5ykEwshgsPEgQlYrDKu77qNLUzVzEDVjS3GXdbZd1OEb65+5Rga34PmoV0j0brRiD5Ej7Oe9EdWLQvlcsxGyGi/2rmwnCjM/j3zK1qcx2QXLQz2AMW4= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SA2PR10MB4715.namprd10.prod.outlook.com (2603:10b6:806:fb::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Wed, 28 Jun 2023 10:30:16 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb%7]) with mapi id 15.20.6521.023; Wed, 28 Jun 2023 10:30:16 +0000 From: John Garry To: acme@kernel.org, irogers@google.com, namhyung@kernel.org, jolsa@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, renyu.zj@linux.alibaba.com, shangxiaojing@huawei.com, zhangshaokun@hisilicon.com, qiangqing.zhang@nxp.com, kjain@linux.ibm.com, kan.liang@linux.intel.com, John Garry Subject: [PATCH RFC 3/9] perf metrics: Pass cpu and sys tables to metricgroup__add_metric() Date: Wed, 28 Jun 2023 10:29:43 +0000 Message-Id: <20230628102949.2598096-4-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230628102949.2598096-1-john.g.garry@oracle.com> References: <20230628102949.2598096-1-john.g.garry@oracle.com> X-ClientProxiedBy: SJ0P220CA0009.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:41b::25) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SA2PR10MB4715:EE_ X-MS-Office365-Filtering-Correlation-Id: 4dd79a60-3229-4fe6-0601-08db77c2aa1a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 80lcX4R12gaweELdcsNAFJ0V2BwUqPBm57HZ2AHY2lAabgxmFx0znFPdyGE00RpS986TvjiThU6rs7ShUo+uSXecxnyE5R+GuDzcom2Uj3VF83PThBy9lxuK5P86UFJjaig/KiGBhi9jMDAyOKx8RriV/XLIA8EMugkN/v5/LE0/vEnhUDQigdVB3bi+OnLQisDNnkphAxYFlqRqrXk01QTznJC96uxSoT+/6USJGu7Ad40g31tuKKmpN3bDFnp/M29eMej6JgRUFKf9M+GV9E1PjANFoco0OeyPmrDiS63VQ+eTjzBoad56K9IQlZCZ4brNu7l4XXO7zRh7ZomCOwluhKaOYG+1i5A9zjjYvNZoLqbG8nvZSdbMr80pwpwQSkOHQGfIicgNcfAU3tHcWxAhugXWZzUv4BR8sPD9MkE0/4pGr5+KyzgKGb5+Sg7Qu9xUuXXvTmYA2YceDJyeRJV00S7DF8KouThcUCHv/0vkpGEEFKqcOXlt7/N+D+gQ/xDJ8yCz1T2Cwt1x7E2YuocPeFVNwb75+pX7H/95fwUi/8k4rDUBZKQMGQe1Lov48EkiDiiquguU6eHYNp89iibFplB+5kVIxB5iFVenjBBxT6B0uDlnU+riYwukzUdv X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(39860400002)(396003)(346002)(376002)(136003)(451199021)(38100700002)(83380400001)(103116003)(36756003)(86362001)(478600001)(6666004)(6486002)(2616005)(8936002)(316002)(66946007)(8676002)(41300700001)(66556008)(4326008)(66476007)(107886003)(1076003)(6512007)(6506007)(26005)(186003)(7416002)(5660300002)(2906002)(101420200003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MZUFrd359r1ckDq76oy+/DuK+rnV+UVDEnxFbpRBaPjwLT47Fn7ZDSfGRc8x2q4XeJF3HHxSKWOHVxWrcTi3xXTdTsqQU26aC3Y+ltySnQX/DqWdcplq1XN/ydhXJJUlJYloRoPpzTtlRCBDLifpuAUAILakvvpEsXje9LV7X96+GOr0Jpy8cgr4KvgqwHytc0xLY2tLS3mz9RDwKIjW1uwclvvRA4XBRW4oM36ppAtltrsBMDtQ7Oe4pel7wT0WLFT3e6/6gnHegFvEI7YCuWxjpe590a0ZGyHsFm6Dv+Sl47A7A8D9zslI0Z4oJoccjdxv3lgngBTFjuRESj8aKkbxAOS6bYn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+OVvaf6WUJqsZhMq1Zd5UOYQ45eStRddMBCRD1MXxgEiTWkiZJ00z0vc6qe3xf8mWtgCLR7iuT45ex3PD8kn4aUT2Woob8SR7DcIzcKBui0C2HlgHiEtZLDZlRwC/DynNQEk0uzvTLk0aRW4c7fkSvGPK8JC5Jfo72+19RakUg7MzXzjyYmka//JkKZXKpcbEIsBOb+Djzaa7qK1RT4gwgHOT4NIWiq205VUiHlEoOnRraCVlYxBtn9YmZmwaONRxZjtUGEr08FntRC23lxD5gCNPnHZ7z++lZqro4bwo5vflaHnmf+Bayk+Xz+Qu9wQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4dd79a60-3229-4fe6-0601-08db77c2aa1a X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2023 10:30:16.6011 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PZ5qs0KYNVmPWWsBomVW5MGgZTFGDaV/Fx2fjg6JZZBp7VjfEv7aAOQEt5EzDDGVN0uf3bjvK2tFq4rbgLVcwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4715 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-28_06,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306280092 X-Proofpoint-ORIG-GUID: Zh1faJHjqPMjsUabR94QPohG6tcK1dPI X-Proofpoint-GUID: Zh1faJHjqPMjsUabR94QPohG6tcK1dPI X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230628_033107_824364_219EE234 X-CRM114-Status: GOOD ( 21.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The current @table arg may be a CPU metric table or a sys metric table. There is no point in searching the CPU metric table for a sys metric, and vice versa, so pass separate pointers When sys metric table is passed, this would mean that we are in self-test mode. In this mode, the host system cannot match events in the metric expression as the associated PMUs may not be present. As such, just try add the metric, see metricgroup__add_metric_sys_event_iter(). Signed-off-by: John Garry --- tools/perf/tests/expand-cgroup.c | 2 +- tools/perf/tests/parse-metric.c | 2 +- tools/perf/tests/pmu-events.c | 29 +++++++++++++++----- tools/perf/util/metricgroup.c | 45 +++++++++++++++++++++++--------- tools/perf/util/metricgroup.h | 3 ++- 5 files changed, 59 insertions(+), 22 deletions(-) diff --git a/tools/perf/tests/expand-cgroup.c b/tools/perf/tests/expand-cgroup.c index 9c1a1f18db75..50e128ddb474 100644 --- a/tools/perf/tests/expand-cgroup.c +++ b/tools/perf/tests/expand-cgroup.c @@ -187,7 +187,7 @@ static int expand_metric_events(void) rblist__init(&metric_events); pme_test = find_core_metrics_table("testarch", "testcpu"); - ret = metricgroup__parse_groups_test(evlist, pme_test, metric_str, &metric_events); + ret = metricgroup__parse_groups_test(evlist, pme_test, NULL, metric_str, &metric_events); if (ret < 0) { pr_debug("failed to parse '%s' metric\n", metric_str); goto out; diff --git a/tools/perf/tests/parse-metric.c b/tools/perf/tests/parse-metric.c index 2c28fb50dc24..e146f1193294 100644 --- a/tools/perf/tests/parse-metric.c +++ b/tools/perf/tests/parse-metric.c @@ -95,7 +95,7 @@ static int __compute_metric(const char *name, struct value *vals, /* Parse the metric into metric_events list. */ pme_test = find_core_metrics_table("testarch", "testcpu"); - err = metricgroup__parse_groups_test(evlist, pme_test, name, + err = metricgroup__parse_groups_test(evlist, pme_test, NULL, name, &metric_events); if (err) goto out; diff --git a/tools/perf/tests/pmu-events.c b/tools/perf/tests/pmu-events.c index 64383fc34ef1..de571fd11cd7 100644 --- a/tools/perf/tests/pmu-events.c +++ b/tools/perf/tests/pmu-events.c @@ -798,9 +798,9 @@ struct metric { struct metric_ref metric_ref; }; -static int test__parsing_callback(const struct pmu_metric *pm, +static int _test__parsing_callback(const struct pmu_metric *pm, const struct pmu_metrics_table *table, - void *data) + void *data, bool is_cpu_table) { int *failures = data; int k; @@ -811,6 +811,8 @@ static int test__parsing_callback(const struct pmu_metric *pm, .nr_entries = 0, }; int err = 0; + const struct pmu_metrics_table *cpu_table = is_cpu_table ? table : NULL; + const struct pmu_metrics_table *sys_table = is_cpu_table ? NULL : table; if (!pm->metric_expr) return 0; @@ -834,7 +836,8 @@ static int test__parsing_callback(const struct pmu_metric *pm, perf_evlist__set_maps(&evlist->core, cpus, NULL); - err = metricgroup__parse_groups_test(evlist, table, pm->metric_name, &metric_events); + err = metricgroup__parse_groups_test(evlist, cpu_table, sys_table, + pm->metric_name, &metric_events); if (err) { if (!strcmp(pm->metric_name, "M1") || !strcmp(pm->metric_name, "M2") || !strcmp(pm->metric_name, "M3")) { @@ -890,13 +893,27 @@ static int test__parsing_callback(const struct pmu_metric *pm, return err; } -static int test__parsing(struct test_suite *test __maybe_unused, +static int test__parsing_callback_cpu(const struct pmu_metric *pm, + const struct pmu_metrics_table *table, + void *data) +{ + return _test__parsing_callback(pm, table, data, true); +} + +static int test__parsing_callback_sys(const struct pmu_metric *pm, + const struct pmu_metrics_table *table, + void *data) +{ + return _test__parsing_callback(pm, table, data, false); +} + +static __maybe_unused int test__parsing(struct test_suite *test __maybe_unused, int subtest __maybe_unused) { int failures = 0; - pmu_for_each_core_metric(test__parsing_callback, &failures); - pmu_for_each_sys_metric(test__parsing_callback, &failures); + pmu_for_each_core_metric(test__parsing_callback_cpu, &failures); + pmu_for_each_sys_metric(test__parsing_callback_sys, &failures); return failures == 0 ? TEST_OK : TEST_FAIL; } diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index 8d2ac2513530..520436fbe99d 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -1232,13 +1232,14 @@ static int metricgroup__add_metric(const char *pmu, const char *metric_name, con const char *user_requested_cpu_list, bool system_wide, struct list_head *metric_list, - const struct pmu_metrics_table *table) + const struct pmu_metrics_table *cpu_table, + const struct pmu_metrics_table *sys_table) { LIST_HEAD(list); int ret; bool has_match = false; - { + if (cpu_table) { struct metricgroup__add_metric_data data = { .list = &list, .pmu = pmu, @@ -1254,7 +1255,7 @@ static int metricgroup__add_metric(const char *pmu, const char *metric_name, con * Iterate over all metrics seeing if metric matches either the * name or group. When it does add the metric to the list. */ - ret = pmu_metrics_table_for_each_metric(table, metricgroup__add_metric_callback, + ret = pmu_metrics_table_for_each_metric(cpu_table, metricgroup__add_metric_callback, &data); if (ret) goto out; @@ -1267,7 +1268,21 @@ static int metricgroup__add_metric(const char *pmu, const char *metric_name, con goto out; } - { + if (sys_table) { + struct metricgroup_add_iter_data data = { + .metric_list = &list, + .pmu = pmu, + .metric_name = metric_name, + .modifier = modifier, + .metric_no_group = metric_no_group, + .user_requested_cpu_list = user_requested_cpu_list, + .system_wide = system_wide, + .has_match = &has_match, + .ret = &ret, + }; + pmu_metrics_table_for_each_metric(sys_table, + metricgroup__add_metric_sys_event_iter, &data); + } else { struct metricgroup_iter_data data = { .fn = metricgroup__add_metric_sys_event_iter, .data = (void *) &(struct metricgroup_add_iter_data) { @@ -1320,7 +1335,8 @@ static int metricgroup__add_metric_list(const char *pmu, const char *list, bool metric_no_threshold, const char *user_requested_cpu_list, bool system_wide, struct list_head *metric_list, - const struct pmu_metrics_table *table) + const struct pmu_metrics_table *cpu_table, + const struct pmu_metrics_table *sys_table) { char *list_itr, *list_copy, *metric_name, *modifier; int ret, count = 0; @@ -1338,7 +1354,8 @@ static int metricgroup__add_metric_list(const char *pmu, const char *list, ret = metricgroup__add_metric(pmu, metric_name, modifier, metric_no_group, metric_no_threshold, user_requested_cpu_list, - system_wide, metric_list, table); + system_wide, metric_list, cpu_table, + sys_table); if (ret == -EINVAL) pr_err("Cannot find metric or group `%s'\n", metric_name); @@ -1534,7 +1551,8 @@ static int parse_groups(struct evlist *perf_evlist, bool system_wide, struct perf_pmu *fake_pmu, struct rblist *metric_events_list, - const struct pmu_metrics_table *table) + const struct pmu_metrics_table *cpu_table, + const struct pmu_metrics_table *sys_table) { struct evlist *combined_evlist = NULL; LIST_HEAD(metric_list); @@ -1547,7 +1565,7 @@ static int parse_groups(struct evlist *perf_evlist, metricgroup__rblist_init(metric_events_list); ret = metricgroup__add_metric_list(pmu, str, metric_no_group, metric_no_threshold, user_requested_cpu_list, - system_wide, &metric_list, table); + system_wide, &metric_list, cpu_table, sys_table); if (ret) goto out; @@ -1697,18 +1715,19 @@ int metricgroup__parse_groups(struct evlist *perf_evlist, bool system_wide, struct rblist *metric_events) { - const struct pmu_metrics_table *table = pmu_metrics_table__find(); + const struct pmu_metrics_table *cpu_table = pmu_metrics_table__find(); - if (!table) + if (!cpu_table) return -EINVAL; return parse_groups(perf_evlist, pmu, str, metric_no_group, metric_no_merge, metric_no_threshold, user_requested_cpu_list, system_wide, - /*fake_pmu=*/NULL, metric_events, table); + /*fake_pmu=*/NULL, metric_events, cpu_table, NULL); } int metricgroup__parse_groups_test(struct evlist *evlist, - const struct pmu_metrics_table *table, + const struct pmu_metrics_table *cpu_table, + const struct pmu_metrics_table *sys_table, const char *str, struct rblist *metric_events) { @@ -1718,7 +1737,7 @@ int metricgroup__parse_groups_test(struct evlist *evlist, /*metric_no_threshold=*/false, /*user_requested_cpu_list=*/NULL, /*system_wide=*/false, - &perf_pmu__fake, metric_events, table); + &perf_pmu__fake, metric_events, cpu_table, sys_table); } struct metricgroup__has_metric_data { diff --git a/tools/perf/util/metricgroup.h b/tools/perf/util/metricgroup.h index d5325c6ec8e1..b5f0d598eaec 100644 --- a/tools/perf/util/metricgroup.h +++ b/tools/perf/util/metricgroup.h @@ -79,7 +79,8 @@ int metricgroup__parse_groups(struct evlist *perf_evlist, bool system_wide, struct rblist *metric_events); int metricgroup__parse_groups_test(struct evlist *evlist, - const struct pmu_metrics_table *table, + const struct pmu_metrics_table *cpu_table, + const struct pmu_metrics_table *sys_table, const char *str, struct rblist *metric_events); From patchwork Wed Jun 28 10:29:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13295540 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A5090EB64DA for ; Wed, 28 Jun 2023 10:32:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ORr1qLbVVfUz8KfChVZeHbf307HRQUEThyYeegRFoXE=; b=ibMyL+VypsDp3x YBDN0QPbKcEIX4/NCkLBEdPS3ueLYaKeAexKxEQ0aMQdp899m23c7dVfkQ+GS+zPy+Xy4cEw+sccC 2WW3VT7mFV81MW8EkCKWNpitX9Y0LvDjb7ngQI5jw1Tm7V4pR+1dAFYEUM0y3CP5O/U3A60gzWfsU QnRuEIM78aiw/WSiU99nU74/tEqGwpOcBCZEC+xC3f3NG8G+EGmekIepnIjK5dd8OYyX05Af3WLUt MVkrB5zbtPNcAavKIrmNnXUJj+Q/ArqxyEgln3gRE4xYKl6IOMrE/wUk+hsJMyB94+MGigm2yFDxj v7tUx0Kf+Rr7nGYDHoDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qESSm-00FMaT-1t; Wed, 28 Jun 2023 10:31:52 +0000 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qESS4-00FMKj-0J for linux-arm-kernel@lists.infradead.org; Wed, 28 Jun 2023 10:31:13 +0000 Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35S8xptI023003; Wed, 28 Jun 2023 10:30:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=hDsL0TaLiobo7uqJNdvWlxbrKXtS9CwEhtroNWANHLA=; b=WK+jWImpkAsl47HwUVma9i0dmnCrgTu531e7kQ+U1SJMAvKzg7WPwOk8oqv1mJwUUQVw rERwbTlfkV3BiXURI5bRgBEF5l40HTYJt8vII7RS/PKbNPLrepREq182z+8KDjsuRLMF FoXh3Myp9GfTpPqUE5I5dnWSqvvwMFXF/b3BPIU27XuMN6kj0uPvvcmkykyrI6pVQd4+ 6qXiaFSVOa/fKIBH7qGHE/YLIOMAD05pwiz7mNjyzwIgrufmgVPyxUtG3eAUIicZTYLJ wcog+dP8su1rqf9THUXU6godvFYSK349Dd9lXR5mQPhzruUD5luJrygtqAHNmY+z9rMF Xg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rdqdtq5w7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:21 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35S99cKq008684; Wed, 28 Jun 2023 10:30:21 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2177.outbound.protection.outlook.com [104.47.55.177]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rdpx5trc4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fPDuBMQkUXyrPJLZRsg4z2LH+0+QkZdMOTp41lJ2zhRSgKq2N5Ecuc7yoIOt/tUtuDHnSeyLh9SQBSa5JSMXsa59JTJB6YlYN3erb1fjdN2B5HVumAyxeSGfHXEpwO0qv1eD6PIHMocWEcRxtRqoKOAGIcEyMj2BPmdBONBazhRr72xpQ4yBTp2kEwCGXhtf6aTmgJukhGA1XIVaCSB7/In6K+PZIzqXNLTLmck4Xhp6UF242nGOFSnR2F++LeAiuAllkZXFPGsopJMzmMoN+oCvTQGLNVPKYrv0soBOFL0AwfzUZvGOGbM8tW57gfAvuTsRQ9XCPoQ+Eody0ChAJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hDsL0TaLiobo7uqJNdvWlxbrKXtS9CwEhtroNWANHLA=; b=jFxQj1AVeFnhkod2eRN9QQRLBHZstCdNkPCta2f0zTHaGcZizUsZLLOpcCCcBMnZl8Xx1DXVg08/dvxRaQekhm04OIqL3ti7fh5Wb20dKQKzBTHVFlvtNoauFPRuSXQ5TBpZ0nO4yJox5cp4ttB6WFl2tJOsnEkK5PT3A6TzsDJ/5zrWZwtMJ2HvRplspWQE8dx1vfM0Ow8ytPfjF/meViFZD9Y1cKIyPBPAA8mZ/4p38m1Vb17qQ4lpLcVMJ6xCZvCxASSeYltb7I1lLT0bp4GFfZIPC14lA8JsBonsHk59browayiAoyiUdzny9TFOleP2/HqaBg6ZFzwY/egB+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hDsL0TaLiobo7uqJNdvWlxbrKXtS9CwEhtroNWANHLA=; b=l28osTJgMBYziQjWAtoB81z0Einx4R4kc4z+DpvQqYlUFUQ6f5ZCcidxQlmA9GEPr8LfhF/2J+bkZ4guTMixURuRb2/j1nKU12W96fbi949Ti3yhjEA4s3ej63pXpbVgIRUb66vR9fPk303knTL3TAKI2FyBeJblyGql83azGFE= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SA2PR10MB4715.namprd10.prod.outlook.com (2603:10b6:806:fb::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Wed, 28 Jun 2023 10:30:18 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb%7]) with mapi id 15.20.6521.023; Wed, 28 Jun 2023 10:30:18 +0000 From: John Garry To: acme@kernel.org, irogers@google.com, namhyung@kernel.org, jolsa@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, renyu.zj@linux.alibaba.com, shangxiaojing@huawei.com, zhangshaokun@hisilicon.com, qiangqing.zhang@nxp.com, kjain@linux.ibm.com, kan.liang@linux.intel.com, John Garry Subject: [PATCH RFC 4/9] perf jevents: Add sys_events_find_events_table() Date: Wed, 28 Jun 2023 10:29:44 +0000 Message-Id: <20230628102949.2598096-5-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230628102949.2598096-1-john.g.garry@oracle.com> References: <20230628102949.2598096-1-john.g.garry@oracle.com> X-ClientProxiedBy: SJ0PR13CA0193.namprd13.prod.outlook.com (2603:10b6:a03:2c3::18) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SA2PR10MB4715:EE_ X-MS-Office365-Filtering-Correlation-Id: 5f35fef0-a16f-4e08-3721-08db77c2ab5e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /XOtBxFB+3AgAvp7kfT03Qv3eZNeYUIfx0tI/ifABnKN+qbR8FA/DbLjeWPG1fsUx6vnAD0abfQRe5rpyQDn7PlXDM1ZkqzYJ0FkSDBLzB0ph3R2nb0rNjffyE7Z6GPB6QkyF27I8qV8uYCTztuQSynYOM6XO5dpavyjQO88E5Qz2jNxYmhgoXSeOpqsIZTPdsPUqFipaoJjHuThR0fkGaVDbXshwuv5h6z0btc6ewFfp14Fy5++GGkw9i4kpfyGnjYWxR0YbFqjcpiy1/UPhBc+xv81bcpVUU+UAKcBhCImYimjfAICvd6m9YCaBrStZdpUz62j6u8ViuI7rxjXZqMjSwpRJcq5s1Qa2hh9ODeUFjoG7gMCDzOco/vhSKSwZfYAorwlpAFnugg9n7MR+NzFCTbBEdl6OV8xGWauYWxtT2scQMyNBKySIQ42Upe28LbJ/o0O04d5zzmPV3o3ijmKksIQI7gSbpLJj5PpsuFI39h+kOn7OBonEmWbEc8nol30JYxccFY5YZZtmszBvMrHNUkp/A5zqc7Jx/fqLIRQi4q0G69sfAPB1pGbUaW6 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(39860400002)(396003)(346002)(376002)(136003)(451199021)(38100700002)(103116003)(36756003)(86362001)(478600001)(6666004)(6486002)(2616005)(8936002)(316002)(66946007)(8676002)(41300700001)(66556008)(4326008)(66476007)(107886003)(1076003)(6512007)(6506007)(26005)(186003)(7416002)(5660300002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vagiZz3DI91c3sosbeLNrhT6Uhk4exa/wDA9PBwxg9iDuHKlC3YGEahlMxuoPzw+bDOJe6MZVhM7p/t8aZvKG46obo86UtcCJWW0J6FYtSwcP+2F9s/1JriNujsXChgw442YMIlGZsHzyVJvPralHXSY272gzoJndQb3lHLOMutkAikbvHR+sk9g7zw6ZJxItQc4Mwk2gk5pslGjBc+Hb2Vg7JQ1buW8uxMZidem40slYpDKtMHAxB5qKm+kWG6lB20QmlXyW+OZXtaqtDvuCWybRdhnFkay7FXg8hO72+LdzVpWDooweyG9iz4uAGsiCo813NMBGLwk9IISMdMAcS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MlAxNls9FHPGlaSmP75eGSfOuUCJTlKm+4sqpx0xQ5iDhIJAeXsJ33kC8DeFgRjahiRVIQpLFamoc5g/TrfyJKRHhS9CrAepsNC98d7bgav/UXE/62W2YgjVRxBbvXqyr2CLAhOcgQHvDPXaAhS19RXICmQx6QkjNJ4+WFCZdKYlsc3+UFbJVYiRVGlPQzC8nnTDmLshX1NepifX+FqRXupVDEMETHiuQuuOhM6FSNxorZr+i3iWviT6hH7B3I/ZgjRd8py3lvFx5Y3GfserPA5dBdoLwxl5SCzJkYIgk126w== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f35fef0-a16f-4e08-3721-08db77c2ab5e X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2023 10:30:18.6332 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: S9XnbolKZtmHx4M3H42DwmSAhUUiqtoS5wnJowYFu2g4Xp0+LhRfOu6pR+nsVQUWmLgWm9MdYjRtYxJdRN4XQA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4715 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-28_06,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306280092 X-Proofpoint-GUID: Iapxjc13p_ydgA7t2gpxNYsOAP6xBEzI X-Proofpoint-ORIG-GUID: Iapxjc13p_ydgA7t2gpxNYsOAP6xBEzI X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230628_033108_140951_BF8A2868 X-CRM114-Status: GOOD ( 18.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a function to get the events table associated with a metric table for struct pmu_sys_events. We could also use something like: struct pmu_sys_events *sys = container_of(metrics, struct pmu_sys_events, metric_table); to lookup struct pmu_sys_events, but that relies on the user always passing a sys events metric struct pointer, so this way is safer, but slower. Signed-off-by: John Garry --- tools/perf/pmu-events/empty-pmu-events.c | 6 ++++++ tools/perf/pmu-events/jevents.py | 11 +++++++++++ tools/perf/pmu-events/pmu-events.h | 3 +++ 3 files changed, 20 insertions(+) diff --git a/tools/perf/pmu-events/empty-pmu-events.c b/tools/perf/pmu-events/empty-pmu-events.c index a630c617e879..ae431b6bdf91 100644 --- a/tools/perf/pmu-events/empty-pmu-events.c +++ b/tools/perf/pmu-events/empty-pmu-events.c @@ -290,6 +290,12 @@ int pmu_metrics_table_for_each_metric(const struct pmu_metrics_table *table, pmu return 0; } +const struct pmu_events_table * +sys_events_find_events_table(__maybe_unused const struct pmu_metrics_table *metrics) +{ + return NULL; +} + const struct pmu_events_table *perf_pmu__find_events_table(struct perf_pmu *pmu) { const struct pmu_events_table *table = NULL; diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jevents.py index 80b569b8634b..947e8b1efa26 100755 --- a/tools/perf/pmu-events/jevents.py +++ b/tools/perf/pmu-events/jevents.py @@ -786,6 +786,17 @@ int pmu_metrics_table_for_each_metric(const struct pmu_metrics_table *table, return 0; } +const struct pmu_events_table * +sys_events_find_events_table(const struct pmu_metrics_table *metrics) +{ + for (const struct pmu_sys_events *tables = &pmu_sys_event_tables[0]; + tables->name; tables++) { + if (&tables->metric_table == metrics) + return &tables->event_table; + } + return NULL; +} + const struct pmu_events_table *perf_pmu__find_events_table(struct perf_pmu *pmu) { const struct pmu_events_table *table = NULL; diff --git a/tools/perf/pmu-events/pmu-events.h b/tools/perf/pmu-events/pmu-events.h index caf59f23cd64..a3642c08e39d 100644 --- a/tools/perf/pmu-events/pmu-events.h +++ b/tools/perf/pmu-events/pmu-events.h @@ -77,6 +77,9 @@ typedef int (*pmu_metric_iter_fn)(const struct pmu_metric *pm, const struct pmu_metrics_table *table, void *data); +const struct pmu_events_table * +sys_events_find_events_table(const struct pmu_metrics_table *metrics); + int pmu_events_table_for_each_event(const struct pmu_events_table *table, pmu_event_iter_fn fn, void *data); int pmu_metrics_table_for_each_metric(const struct pmu_metrics_table *table, pmu_metric_iter_fn fn, From patchwork Wed Jun 28 10:29:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13295535 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C3A5EB64D7 for ; Wed, 28 Jun 2023 10:31:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wdxqW/kmhDrQbp16VlqJDQIIOPoIE6jYdSzcXTHMb48=; b=usCI1zASPZiLDO Cn18gTKQuFe5LEPRWrpEuGwsrlOFJLcDgT6geCW0Gre6d6lV7CNyoevIJLWTgziBJlLoZy8QiwzFf Wx8dSG1rzfciAXD/34RaKL5yse5GBRa5YixW/Wt9UzurPeBvFY4jC8RP+4HWgjFmrA5Med4yXslBv fKwqDbooa/eSf5YIB7Ul8HGc/OZGOjuzJ8Y6kEbegPEfVo/UrIH6Aq84VvGvZ6xnfWDu5hBVx74wA 6q47fCQnT6adqT1Q7b+aJfRWRvIugL0z85OdZom36jaWBhU3o/6nRniVjb759uG8oyKdQGcSgOAxB 1sGBuRygaWHwsw3vRJUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qESS9-00FMNb-0v; Wed, 28 Jun 2023 10:31:13 +0000 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qESS3-00FMJZ-1u for linux-arm-kernel@lists.infradead.org; Wed, 28 Jun 2023 10:31:11 +0000 Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35S8xpY8023199; Wed, 28 Jun 2023 10:30:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=I63gI5Z2fYJEZuuoUwEztOOjT+fmTVS90Iv/RJgFuro=; b=ZV/lgJTDvah8Wu58jgug1BRwD4DnD+qpVv/oXddvB8Ah9jbkzD/r9XGF31r+lTHc0QPl Hw2lvrfGbTPyuT7RKDjs5u8GjrEReenDGvYAWEzYh7RPLr9Ilsg+PhDXEpJMxhJACZIl JKh5dv+tOVGvpDjBTKMyVClzhPWGKXwLElHb6X9UoZxvb0XYbIwzrLHt4a4BRrR7x+q3 40XAn1TrtckaTXzx2KRH3CE2ffdsxImURf/Aybf+YnfEd4ols8ggw8UJdtinqvzAaxjh 8yce+JIFVBHD02/3Nyi/nyj3xtvB7vQg1DqE2vk9qOexd6T4Pxdmzhm+bUzLsLcuyYfJ DQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rdqdtq5wb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:24 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35S9H161029644; Wed, 28 Jun 2023 10:30:23 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rdpx5tpwe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kd0nV1hgjecwgRfeMTpRLl0G7KD5AGmbyttgbe2HkIgC4b9lZYZoq3vAoEQZ6f8fJ+IFPqCwtCZCRPUWeENOvhu8D8FzoeClM4EvxG4GwCxHirNQc4qNke9UhsWlO0tHbIgWkvW4SBgsOqWr4bqCAfBrXHA6FFxbONPQ9hxOg1kKcBDoWx4AnGHRzY2lqVjFG7E1c8XKPXuzG085qlQEM9CPX4YWmGGYPS5RoIprmex9zc4R+aA/QBvNNkOV7nDzoGaL+uBLVIZc63fsk9R3s22cpVC8qFpuJjoGM1+rfKz41vUZ3k0Vv+k3aWC22ZvfcUHPrjY3pgh+PSW7SQoHmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I63gI5Z2fYJEZuuoUwEztOOjT+fmTVS90Iv/RJgFuro=; b=UzmaZS0a0o/92iTILVc4vC7B8CTdhesJpRMuFV2n/2BXNM6AsP5EOuYhHrTirQs440j+R6tVLGGHOfcC7tYPHBwoEhXx2voclXiRWpCUKcx2ClAALE+bCAHc/vY3+2TZ1/DG9oDPJg+yoVSnyNqDtVoiVAkbxj9JnObuEs5KfUnYv/m/ZvHSos/bKaLrm3j2gnFLXRdVJMKOQ0yDu4aq/7dTrsxedcchVk901snk2BUEQVno4S9YnSxr3Yp6f5wkeRB9JNWv64wevJ7GZNE59HILb7Cm7NN08zUH+eOcYJ3FJo0GL6pfmX8Kj1BzMgGQhOQqWiZdWKeMmUJM8XTCPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I63gI5Z2fYJEZuuoUwEztOOjT+fmTVS90Iv/RJgFuro=; b=vRKYcJnABQ7kzxx6DrJacC6OFv3G+495JV3zcbKIAflh0KEpdYDodIg4Umkk+gfIhqZLA3blgTIK9lWs+3Ufoto5pGuX3doEkaYtSAIG22s99kTNbPrOHz6Of1VcERH8tPPgdWuBrgd+9QIMU4qkf4Ns0Ytn1UokFLiD78USfZY= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SA2PR10MB4715.namprd10.prod.outlook.com (2603:10b6:806:fb::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Wed, 28 Jun 2023 10:30:20 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb%7]) with mapi id 15.20.6521.023; Wed, 28 Jun 2023 10:30:20 +0000 From: John Garry To: acme@kernel.org, irogers@google.com, namhyung@kernel.org, jolsa@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, renyu.zj@linux.alibaba.com, shangxiaojing@huawei.com, zhangshaokun@hisilicon.com, qiangqing.zhang@nxp.com, kjain@linux.ibm.com, kan.liang@linux.intel.com, John Garry Subject: [PATCH RFC 5/9] perf pmu: Refactor pmu_add_sys_aliases_iter_fn() Date: Wed, 28 Jun 2023 10:29:45 +0000 Message-Id: <20230628102949.2598096-6-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230628102949.2598096-1-john.g.garry@oracle.com> References: <20230628102949.2598096-1-john.g.garry@oracle.com> X-ClientProxiedBy: SJ0PR13CA0182.namprd13.prod.outlook.com (2603:10b6:a03:2c3::7) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SA2PR10MB4715:EE_ X-MS-Office365-Filtering-Correlation-Id: 00582e73-4061-4588-f35c-08db77c2ac8c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LCh1JtPZmod7/1xma3t754m87XlJQ0JNnAcS3y/Q8C1uAXDwB+oJdjKjn0aP2QnO5UV1K8k+WJgrcUT+kU5Vr18QSvl7F0Htt9+pIzYsTCDoQ82+dSoPkC7x7YKX4v2JdAQ8aIQjvgiJ/7Vfv5aKyY/Fp+wNSvljh10r7h6cR6YVxTrKFcS6WZpM1hDdfCAdhL7hMo+jV0a+tHRjasuDfAR7NFK8Mk25D/rlxEcnb2NgESK5ks1u5yabVVI+FqpwR/faKlTUDJicPdAH8uWQRpkm6E/meXq7CD5Or61vE8Ijz4I6ja5NxqsRDsjm5H4VX7E65K5E366jphOfM6IOXJ8fcHEbX0Vj8TQ11u8CThKOQStd/wAf2oODnW3jh9XzwZ/SNhV16maXYfAlaJnNgHZW5ZTtLpKMUOHyQhQkvXVm2OOTKSK2GYHdZQYcUigzOrK71QhS2agRPclDnty6DLj00x04En53/hsVzABBzC5ljbHqgs9NcgDqn09ByPqnmIyl3/H2rVx9eEqeI6K2aEAIMkFZOz1XhItEPvH5BDf5WpHd7G20SVtUHspT953/ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(39860400002)(396003)(346002)(376002)(136003)(451199021)(38100700002)(83380400001)(103116003)(36756003)(86362001)(478600001)(6666004)(6486002)(2616005)(8936002)(316002)(66946007)(8676002)(41300700001)(66556008)(4326008)(66476007)(107886003)(1076003)(6512007)(6506007)(26005)(186003)(7416002)(5660300002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aoQUDfpqVY0Lv5E7qaVZJSi47+4AlvejxAybgj8hgtC4ZIlVjHMxgoH013/OFNBq1Yeq7gokT4yxhGGcS/C2F52dFQPgTpiR7LRI2QVUjRv8G13ZUnEyRrpyuXa6lmO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DEvSxfa7DNZoiIh2jxrYtj8dPlFnlUMKVmhwfQnA5oNB8BuwV/0doX4taFGPZHC6DOaAeTtdlVq2lJiTUvfw1I6dNuSsVijK5Rkb8guIJKLwYY6KXI+lzA7Kd0iCvf8RtgizSqW4reRZMvKl2KZRbu4M73o09AkYAv0YYKVIJGfkChT7r/KIcVRygIbjxFCA4OJL1p9lrKust6EWwtUai6VOrKuqXgy3LlsSRr9tQ1NCfejo28l0j5SGgcy+afkoBIeN/zTtEjrFT83GCjWA2EODTY0Oj940pN0y/dn9ygMAr5yGw2pRfAmJ0FDEzgq+bck6SYl8/XmcD9BJTkrVfHk4LtdZ8JfW4MNrTjW+oxNGNDZZ0yp25AuqshGb4ReBM1J5o/qFlrrAwgt+vyOniqaqR42akjLQrqrRtVUQaV+AVLXDy8GZWg1T+6ncTNlimK7WDJBKrjfaNwJ2Vvj6c87FK2wRcVzsITqur1+OL8T+Bey5rqh48UvjMh8fCfd/R8lQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00582e73-4061-4588-f35c-08db77c2ac8c X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2023 10:30:20.6472 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KYcp/nLggZTXjJ0FTXkRheU9aKJifjmjkIPzKi1ANE+K6MvLeEoCyj65ID5I0jJW6l3ez8Ntam6ZOBVYaym53w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4715 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-28_06,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306280092 X-Proofpoint-GUID: ZUQObEtsCYZ68AeawPRFgxxHM6rCd_kK X-Proofpoint-ORIG-GUID: ZUQObEtsCYZ68AeawPRFgxxHM6rCd_kK X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230628_033107_824361_3EC77E12 X-CRM114-Status: GOOD ( 19.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Refactor pmu_add_sys_aliases_iter_fn() into sub-function pmu_event_match_pmu(), which is a function which allows us to match a pmu against a "unit" and "compat" values. Signed-off-by: John Garry --- tools/perf/util/pmu.c | 20 +++++++++++++++----- tools/perf/util/pmu.h | 2 ++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 6142e4710a2f..ae1a2a97965c 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -801,6 +801,20 @@ struct pmu_sys_event_iter_data { struct perf_pmu *pmu; }; +bool pmu_event_match_pmu(const char *event_unit, const char *event_compat, struct perf_pmu *pmu) +{ + if (!event_unit || !event_compat) + return false; + + if (strcmp(pmu->id, event_compat)) + return false; + + if (!pmu_uncore_alias_match(event_unit, pmu->name)) + return false; + + return true; +} + static int pmu_add_sys_aliases_iter_fn(const struct pmu_event *pe, const struct pmu_events_table *table __maybe_unused, void *data) @@ -808,11 +822,7 @@ static int pmu_add_sys_aliases_iter_fn(const struct pmu_event *pe, struct pmu_sys_event_iter_data *idata = data; struct perf_pmu *pmu = idata->pmu; - if (!pe->compat || !pe->pmu) - return 0; - - if (!strcmp(pmu->id, pe->compat) && - pmu_uncore_alias_match(pe->pmu, pmu->name)) { + if (pmu_event_match_pmu(pe->pmu, pe->compat, pmu)) { __perf_pmu__new_alias(idata->head, -1, (char *)pe->name, (char *)pe->desc, diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index 8807a624e918..8cccbc9b2548 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h @@ -288,4 +288,6 @@ int perf_pmu__pathname_fd(int dirfd, const char *pmu_name, const char *filename, struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char *lookup_name); void perf_pmu__delete(struct perf_pmu *pmu); +bool pmu_event_match_pmu(const char *event_name, const char *event_compat, struct perf_pmu *pmu); + #endif /* __PMU_H */ From patchwork Wed Jun 28 10:29:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13295533 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BCA9BEB64DA for ; Wed, 28 Jun 2023 10:31:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oxR0ZIPCjCaxp/np/az+kk4G47wj7OcaKW0hRsiHaN8=; b=Nzs3hOBZl1R3pv CyN7gmywy9V9H+ApZSM2iC/y6Sbx/7gs7ZOVQLhGSM8lbEtii+OCv97r03i1nuQaf1Kt+9ikuXUEz x7iV4O32NvmEIlemfGMjCnt+Q3X2RZI7sI6woot1pPRDl7RzlX7XybxQDnzQXDd5RhVUSt1W3T+bV fFzg6Zs5RabSG51hEIqk0JTCwMQms9W0fd4t7Y+Wy4Dyo6yfDrWWI/y1/N0pocTXfWBcDO+tqzRvb V1wGRz/mC7GU3PzhoFpVoPeHnkLFs4oJS4gWgEAj8qtYV/hnmmqt4cu2M+l4xtxf3RnjxXOnSVTwh JWpzudRwMpkKuvd68o6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qESSA-00FMO1-00; Wed, 28 Jun 2023 10:31:14 +0000 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qESS3-00FMJa-1k for linux-arm-kernel@lists.infradead.org; Wed, 28 Jun 2023 10:31:11 +0000 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35S8xh4Q015057; Wed, 28 Jun 2023 10:30:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=UU2sHGlmXXcaiJGNyo96qt+oyclFyaELE//6xrkiAbc=; b=XYNgcvMDENO7YQVwtryj+cXu8DcwFcne5IT4rj3CrFCLTvNNQvlDabaM26Q+jleakOTv 5b4AnzLbct7uXOT95yXud+khYF5s9cNkEufkcUPksRRaoOttEDdY3S4X7Zc556lydZCZ vF7sZAzNVXupuaV1Cih26Y9shE+ue26yMMajxVtmjAog1g4JIyDAPlYL/YL0rJS8mnQd rL16jhhKG94OHbmK9iXAd5WfJmZntTKgMkKtX9XA/U3Rvhi0hItDoepSgfhc682FZ3sJ hbxdw3n4MfICqztdlyqSkGgKRA6/eQhi8IDnTmurUWJ9Lxohoa3Pea+yr5v4bKAVAWtB cg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rds1u73hm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:25 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35S9H164029644; Wed, 28 Jun 2023 10:30:24 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rdpx5tpwe-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BWk1bnFDeVqC2jc9xU3htcTqWE/lZvoBnUbW9jztO1iXIK+y4OEJ1BRvQS4XUM7TUsYVssaGRQPzZijvJOWkUVsuNghpIX/t3czCiBAFMfgb41tjOQEcTVtP5YWSJyHLJrzHc2i4JE6TNwxBLTj5A7PcFfv19Zm0q+NqKC8Q8iRs24mBboxHacVvogq6txKaH/PhMiAg7bJbZ94eTo3Ljxvso6gCUF/6Kim1zJBmS9vTqbRP5xjFXjuqIQNePGzUiZjjFD66+Ugru7R6SqZcw+xzyNxgDdjhQzFw4PB5S/6H7XxgcYq6/4C1dKM+1XXzSmjwaTP4BvZcI8x97Crrqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UU2sHGlmXXcaiJGNyo96qt+oyclFyaELE//6xrkiAbc=; b=XYe0wGuVCu8DNlf3dlkXUv+S1Q2oSZGOE4sB9JYuH1Vy5wfAZmJuEJwnXxRPNmGbqtVWPkqT5nrHIdl5g94gIDELekNNh6WXz2scQtSnmXG7oAVeMloPn+t2haEdeQtTD7dFl/CSR8tNwG6dLot79iSm0z/PPbTqhHpyQsDOHCeaEvSzJenu7jj6OBfGARwEpncbnWof6AmiXsRm5BMKRH43YV7WGupW0G1Wjz+Owcf7e5aDFanwalYfhO5vRkyoUUxunfjOeHZNyVurYFdaHcKE2hhbJeLw3oOU78JwygfhresfCsEtQDQofM0bHDlv4NLg8MbSwH9uk9HXdgRzVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UU2sHGlmXXcaiJGNyo96qt+oyclFyaELE//6xrkiAbc=; b=GZO/p+3oqE2KzpoQXcBfF0t1j0M/y9AChsovZiyrdr9Lx/0zpaZCgcAuGwm1HyXyrpIWja9MdkiOfBn8DKQzIqIb584jSv9ZgFlxH3MhQRRojTRkpdQXf9GXJmm2HMIrJcqkjllDpdlrHwAqC8RVplrehRl0zZp6ZZUVRrEbkfs= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SA2PR10MB4715.namprd10.prod.outlook.com (2603:10b6:806:fb::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Wed, 28 Jun 2023 10:30:22 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb%7]) with mapi id 15.20.6521.023; Wed, 28 Jun 2023 10:30:22 +0000 From: John Garry To: acme@kernel.org, irogers@google.com, namhyung@kernel.org, jolsa@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, renyu.zj@linux.alibaba.com, shangxiaojing@huawei.com, zhangshaokun@hisilicon.com, qiangqing.zhang@nxp.com, kjain@linux.ibm.com, kan.liang@linux.intel.com, John Garry Subject: [PATCH RFC 6/9] perf metrics: Add metricgroup_sys_metric_supported() Date: Wed, 28 Jun 2023 10:29:46 +0000 Message-Id: <20230628102949.2598096-7-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230628102949.2598096-1-john.g.garry@oracle.com> References: <20230628102949.2598096-1-john.g.garry@oracle.com> X-ClientProxiedBy: SA9PR13CA0066.namprd13.prod.outlook.com (2603:10b6:806:23::11) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SA2PR10MB4715:EE_ X-MS-Office365-Filtering-Correlation-Id: 5c440c4b-5c93-4459-a0e6-08db77c2ada8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ru++znWGnBDfIE9sIGOrU+lBbF/JHg1rXt1akdqStGjyPiJRLOKECa/fL5dJsk9luLsjSIK8KqZZwx/IWFAK9i3ibz1GZQIYDNBrZ9mfqbkutaBIG1G6Mz9K8NmIsBXDfUagYIV9EO1nLEe7BRE/3TIaA1nYF0yLZAhwKqhtcfyfXBSLznAVlbjvKH+kk5739epPWiVKVAriXuM7zLiNoXlz7il8vwksknoKYhHxkrzBUmYYP4Ww+uZrrhNitMopz2v/fP8MIQNpEOLefD+8pW0rsKJei8rBXQ2aHplGDfETZYZEW8RaR3JaSDplolhljjE4Aa9RrWwdra5b0cGL+Uie/3/wkCrFPIt3mTML5IbkYfOFzX/h5alGudlogFFCaiPd4Zp/1sV0gOZwh8GyxJFAC2ETznHzEcOqWkT8+gzLzzA/3FiWTK0fiIsM45TvtNRuwHIRq2XlkSeNCpE/doBXB4LIbMWs3uTGcUhjxVbzLPZ/fO2wK3Xhkx5EwxsctDiW/lhKax0HYcaiUzP16KZU4bBh8/ZZlQTPzKyF95RkNdwtZwTz1wpEqzvk2Z7V X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(39860400002)(396003)(346002)(376002)(136003)(451199021)(38100700002)(83380400001)(103116003)(36756003)(86362001)(478600001)(6666004)(6486002)(2616005)(8936002)(316002)(66946007)(8676002)(41300700001)(66556008)(4326008)(66476007)(107886003)(1076003)(6512007)(6506007)(26005)(186003)(7416002)(5660300002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qQsbxo1JQCExF1MfJbz4KfEXnsvW04dgjNvn/Ss5zhg4yMcdbzW2iBNAhgai7xI/pr+F059ZDC2lkvYbxYQsIrGS/VdU3eNOoh4WmInVXRNX/Pm0zAAA8BRv/p08g5qbJovpQfmi2WonlFDBuVHeYd5j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rJrsxySGwRbg5QMZ8BiGpbAbMwQmqcDCimDs8xh6fYjXAesFQ7AIXg5nzXs0vIRm/rXKvF7hbfBW4N9RqUtg220r2cMA2kUyuSTX0boz4dsw413biOOuBecoFaFb7d5N/To10smbv56KlFZ5Zprm0CqJ58/S4jt3fXijGvwavbutDzUOe0sVRvPrw7ejH3H5ZPSCRIAl26eRkTkKkv8LTyegjKDYgM44PyU/TmNS66Og0FmfgcaktCr3/vDxyThXwf3Pd+DdOOdavPkmkUx3wqwuLWWtjf35IdRuO7xulU8lagcMM6xPGbuzR2XXAlN93xxLNUCqXdbE/Azj/9+G3g6sfJ/CrZ2V5iJsKHHqgqikZfR2UaQLX/nwXAPlSeDyNz6NPjG9dvVYmnFTH9HJVfXmyLFb5JZaK/XWQbSYHOqOLKSCKDkaVdqmuJT/QAihTvXbRsgxSN49CahFhO5ga6DZceSakdQwUkRLylLLb50T39HXwiHKgyvCt+BtYvRcbyuVFpeehriZk65eaNcyM5Yz1A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c440c4b-5c93-4459-a0e6-08db77c2ada8 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2023 10:30:22.4974 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 52LVoTVCPGYqnrqKsBjrpX8gY/kh0F6VGDE4PNXVY68Lx6T0wqaqfz0se/JICTeg/XuNdvL8wjAS1qOBFxUnPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4715 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-28_06,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306280092 X-Proofpoint-GUID: t4hyf-cdVM9pw-cj4MzAaev4aUmDo9u0 X-Proofpoint-ORIG-GUID: t4hyf-cdVM9pw-cj4MzAaev4aUmDo9u0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230628_033107_834547_86E61EAC X-CRM114-Status: GOOD ( 28.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a function to match a sys metric for the host. Currently we do the following the match a metric: - iter through all sys metrics for all sys event tables - for each iter, iter through all PMUs - if the PMU Unit and id match the metric Unit and compat, then the metric matches for the host We should not be required to match a metric Unit and compat, unless the metric explicitly specifies target PMU, like: "MetricExpr": "imx8_ddr0@axid\\-read\\,axi_mask\\=0xffff\\,axi_id\\=0x0000@", Rather, we should be match against events aliases present from the events in the same pmu_sys_events structure. Those events added will be gated on matching Unit and Compat specifiers. The steps in metricgroup_match_sys_pm() are as follows: a. Find event table associated with metric table b. Call add_metric() for the metric, which resolves referenced metrics and generates a list of type struct metric c. Iter through metric list and parse ids, to find a list of evsel's d. For each evsel, match event against known events in event table e. If we can't match an evsel as the metric explicitly specifies target PMU, just match evsel PMU against metric Unit and Compat. Step d. is required as in parse_ids() -> parse_events_add_pmu(), we might have matched metric for other system which has the same name, i.e. when we find matching event and PMU, we must ensure it matches compat for event from metric's associated event table. Function metricgroup__sys_event_iter() will now call metricgroup_sys_metric_supported() to match the metric. Signed-off-by: John Garry --- tools/perf/util/metricgroup.c | 115 +++++++++++++++++++++++++++++++--- 1 file changed, 105 insertions(+), 10 deletions(-) diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index 520436fbe99d..6be410363099 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -486,23 +486,18 @@ struct metricgroup_iter_data { void *data; }; +static bool metricgroup_sys_metric_supported(const struct pmu_metric *pm, + const struct pmu_metrics_table *table); + static int metricgroup__sys_event_iter(const struct pmu_metric *pm, const struct pmu_metrics_table *table, void *data) { struct metricgroup_iter_data *d = data; - struct perf_pmu *pmu = NULL; - - if (!pm->metric_expr || !pm->compat) - return 0; - - while ((pmu = perf_pmus__scan(pmu))) { - - if (!pmu->id || strcmp(pmu->id, pm->compat)) - continue; + if (metricgroup_sys_metric_supported(pm, table)) return d->fn(pm, table, d->data); - } + return 0; } @@ -1705,6 +1700,106 @@ static int parse_groups(struct evlist *perf_evlist, return ret; } +struct metricgroup__test_event { + struct pmu_event *found_event; + struct perf_pmu *pmu; + char *evsel_name; +}; + +static int metricgroup__test_event_iter(const struct pmu_event *pe, + const struct pmu_events_table *table __maybe_unused, + void *vdata) +{ + struct metricgroup__test_event *data = vdata; + struct pmu_event *found_event = data->found_event; + char *evsel_name = data->evsel_name; + struct perf_pmu *pmu = data->pmu; + + if (strcasecmp(pe->name, evsel_name)) + return 0; + + if (!strcmp(pmu->id, pe->compat)) { + /* Copy, as pe is only valid in the iter */ + memcpy(found_event, pe, sizeof(*pe)); + /* Stop iter'ing */ + return 1; + } + + return 0; +} + +static bool metricgroup_sys_metric_supported(const struct pmu_metric *pm, + const struct pmu_metrics_table *table) +{ + const struct pmu_events_table *events_table; + bool tool_events[PERF_TOOL_MAX] = {false}; + struct metric *m = NULL; + bool ret = false; + int err; + LIST_HEAD(list); + + events_table = sys_events_find_events_table(table); + if (!events_table) + return false; + + err = add_metric(&list /* d->metric_list */, pm, + NULL /* modifier */, false /* metric_no_group */, + false /* metric_no_threshold */, false /* user_requested_cpu_list */, + false /*system wide */, NULL /* root metric */, + NULL /* visited */, table); + if (ret) + return false; + + /* + * We have a list of metrics. Now generate an evlist per metric, and + * match each evsel. We match evsel by findings its corresponding PMU + * and then ensuring the we can find it in either a. the event list + * associated with the metric or b. if it is a metric referencing an + * explicit PMU. In both cases we match the pmu->id against the event + * compat. + */ + list_for_each_entry(m, &list, nd) { + struct evsel *evsel; + + err = parse_ids(false, NULL, m->pctx, m->modifier, + m->group_events, tool_events, &m->evlist); + if (err) + return false; + + evlist__for_each_entry(m->evlist, evsel) { + struct perf_pmu *pmu = perf_pmus__find(evsel->pmu_name); + struct pmu_event found_event = {}; + struct metricgroup__test_event data = { + .evsel_name = evsel->name, + .found_event = &found_event, + .pmu = pmu, + }; + + if (!pmu) + return false; + + pmu_events_table_for_each_event(events_table, + metricgroup__test_event_iter, + &data); + if (found_event.name) + continue; + + /* + * We dould not find alias event, so maybe our evsel + * is for a specific PMU. + */ + if (strchr(evsel->name, '/')) { + if (pmu_event_match_pmu(pm->pmu, pm->compat, pmu)) + continue; + } + + return false; + } + } + + return true; +} + int metricgroup__parse_groups(struct evlist *perf_evlist, const char *pmu, const char *str, From patchwork Wed Jun 28 10:29:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13295542 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1EB68EB64DA for ; Wed, 28 Jun 2023 10:32:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xi+f8N3BZMo9Nwswta71hITYvQmeGOo2zMXqrPXjK6M=; b=LoKjSYAgqEI4y+ avT/CXKobXHedI26BSx+Qg2qYn9td43COYdf5ViL+wUdh+8OksHGZRVp7B+ehta/TOdxJgwH8tftp rtHBWI0uSCegDJm8kYnecBGrMEV5j2Bi/wFJi3coJzLkbcXaKw37BOoUz4NX4I3bbg/gmnLT88/m8 xcBaWaCE00uQ8EKm+sIzKBE6srh1vabK0pGr2M1ukMjMueBRCpXqMhNet9pdXZiWhOb6sj3M6NZJT qKbSiRuVKKy6yoY9ZyZCmJavHAs3scfpeRW68wDG9j1KZWha6GoqiSgWDiWL22bErRpwjQ4OCDFJQ hnmtskg8DJ9sfri6Zd4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qESSn-00FMbW-2Y; Wed, 28 Jun 2023 10:31:53 +0000 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qESSO-00FMJo-0k for linux-arm-kernel@lists.infradead.org; Wed, 28 Jun 2023 10:31:29 +0000 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35S902kw031526; Wed, 28 Jun 2023 10:30:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=ebfd71yKQLFHnsDikp7a41Tk95DNc4aJaNTDvEr9Yc0=; b=WGoIUOjxKozvlf88OLtO1IjMTXfKs75Lt4x9akLdRzPm/SZIOhv5YTZuLy3HiegPH8vt EYoTQxLN7ZwLAMiJnS0csee0IJ8+23qAS9i1rfHvkcr6Ev5m9dpqQJ6LTnLwJq7s6ZSx O6DgH7xM+gjUGxq9krtKwG3ppKaAD0Ai9mebCLgR9l7M4jMQt21cQ4Z0iZtJdWm83zkc val1BbomKy3ur+024HgkWXSBT4HF6OFkbH8XC14POVKv5WZnPqXsuOORklp6tOyrs3LO LLBTwW1ewavqOjIuUT0l9D1tUTnOiXCwyAAqtnqxykarZoJbhtb6tyO1tfZQ9sl4q16t hg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rdrca6xxg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:27 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35S99Hll008566; Wed, 28 Jun 2023 10:30:26 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rdpx5trjr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZWYuZKzZwtrFPzjfSddMy2iQW0ksM72z79euXeTy07H8vu/i/LaBpeNnk9RvaBlQsLXlnwp/gOHkcv9/PdF4lPyCjlX41v352CdG8o6e8POSSmwdq3rMA+mHLZ1E99bTeV1paaBPy9gG+fItdhN1BXbwri9HZ4nBkEUnHPZlTYVFFqOBBdVlZX7AaCTOuRovDdLQ3DR5sUxLlftmJLYpHJYP/+hNM07tVycssO0grgxDAu/AZlHcS63TiBAmqTANzhh6AruoARbYTMheTYAaq8UNOZwhiE7E0Zm4v3P1BtlIlSiU1AmdceFQhrccKSlF2VddSI8YjhfY5HSrDCm+sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ebfd71yKQLFHnsDikp7a41Tk95DNc4aJaNTDvEr9Yc0=; b=bbdCprA6DVzYo7BznKGZSdfra11VlpAThalf6zW9S7JZ+52ZYk4eRxlN5u18Ys+NCb7dGFUG6L5ciaqp7fTtUHhc60yHBssg83nMU6WXdiFvzm4yW8m7icsSRcg8Mz2oea8LL1FKBi+sWUxEoH3uPKv07ZSSpppzbpmsfC+WQROWc+lPMuKMOGf8EYpDJrWEGs+xerKtKeQ9+m8WspRtpEogQd35GH6Nldol9IHFwAAGDIjbDvq1mhbYc+cCmqrjgfKKxhy00wf/hHVnk7IiC5fDTw2loocID6GBbgbe3zJINtGL0igaEgeFLvAAx/M+QeMtbpdREOsqyY3PJALVOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ebfd71yKQLFHnsDikp7a41Tk95DNc4aJaNTDvEr9Yc0=; b=wpCoh+JrEiJ8yLdZ/+lnIa6OusXjlxMVdtvUqYiUpmlXKcmvSQC/pGoBqzeIv0e5GZ9UipWVn36okDASCGBI+kmAzp/1XFgvYbAtvkVZOMA3qOr6Il57oVnIVbatLXVWduQTAv7GX9DgW3hiC7MjMW7DNbI/np8BFJngMFwl+WU= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SA2PR10MB4715.namprd10.prod.outlook.com (2603:10b6:806:fb::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Wed, 28 Jun 2023 10:30:24 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb%7]) with mapi id 15.20.6521.023; Wed, 28 Jun 2023 10:30:24 +0000 From: John Garry To: acme@kernel.org, irogers@google.com, namhyung@kernel.org, jolsa@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, renyu.zj@linux.alibaba.com, shangxiaojing@huawei.com, zhangshaokun@hisilicon.com, qiangqing.zhang@nxp.com, kjain@linux.ibm.com, kan.liang@linux.intel.com, John Garry Subject: [PATCH RFC 7/9] perf metrics: Test metric match in metricgroup__sys_event_iter() Date: Wed, 28 Jun 2023 10:29:47 +0000 Message-Id: <20230628102949.2598096-8-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230628102949.2598096-1-john.g.garry@oracle.com> References: <20230628102949.2598096-1-john.g.garry@oracle.com> X-ClientProxiedBy: SN7PR04CA0001.namprd04.prod.outlook.com (2603:10b6:806:f2::6) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SA2PR10MB4715:EE_ X-MS-Office365-Filtering-Correlation-Id: 615a051a-bfc7-4e2f-100d-08db77c2aeaa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gP+d1f3O/iCqeNl3tGnKD2FgBctinCcJjYmxC9Q1G3VZF8k31latnUUsFXjK1hdIbtOkjw2wr4YMJDQLKnYlQDC6Azra721xbSLfa9Nq1xJ4cvHmFPt57ytK50h+JGurOMa1kZKE43bUGk7G2a5CsDX2dlvBGMt0Y5O9s1vpVyr/7/+5MSmjNYBp3yI3DnJwnQni6+RLrMcx1znPjIKVkmVgehrPjuCURfN1ybHlUPbkCnIdW31aYngpWULLO108W5U0l5ESHeQ8Zdwa4N2LBfxNuD/uEYusHeXeOXRlsk7l1BsdAwLCjQYjo89FCFI/zpRXv6innXaPTonABO/h1/gxtkylU1XOJn0qK5RngPTg6CjTOuh9r5egb5eXf0QY72ttA5XJAF9CkxgRK/y+hisxc7X9n+jgNs/aijUV3YSsJ8zYqFAAJ4P1sBg+eJAqk0eCBVxLo1JOLjsReg2sk3AtjhUz9SbCCnlyHtHWkYBtx4+sRVZzPANT/DrvYJsS6T2Ks1mTbbtiHloK/d8QtVTbpWWlRpK9FB0Bh6FEVkXViPkdtBXqlvpu6VNABbaQAabMJHDLfwKXmeXCX7+QzvWXH3wugJ2YQ6QcxyCgMKX2swLUNIU3C9Sevktcra18 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(39860400002)(396003)(346002)(376002)(136003)(451199021)(38100700002)(103116003)(36756003)(86362001)(478600001)(6666004)(6486002)(2616005)(8936002)(316002)(66946007)(8676002)(41300700001)(66556008)(4326008)(66476007)(107886003)(1076003)(6512007)(6506007)(26005)(186003)(7416002)(5660300002)(2906002)(101420200003);DI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CdhTZ6WXwyoicxtaSrWBriTZ03iRqA97vxQLhPa3c6KUpHuIQGVVHh9DJIhvncWA8SXnE50ylOCUfHN8kZbeG0YUKmzT0QdwtymnqznZ16LedJsZM5YstubTMMPaPr6Vqd3KlJxZrt+QDd+2HfmLfHzjV3MZ5/LjlVjsv0y1D1OsZoqpv8F4rJpbh5s93owEMeW7qg7MuCKry4tm7yN3JNrwFM9SDrnJyLjmgWiqLWnrZrxyVk5k+ZAH3mVApf1DiTwW1QIsX7crQ0J8gQS8BWhByE99l6n6o/zidPwtj5T6cyc9QM25mXniBJkJHpja5G2UvwOdxm4zYcKTp3htEVUoWxfAaMbSKHWtw7JqGzAsYpe0/SABbzkrZ1jSI9XXAy+0LBnVMyzLxj2vPEGb7jrvPKTz929ZOm7//LfwPgWig6tPRTqqx/70MmpIcqy+WRFv+d9+01up+qVOwH+4UU2gJuf2IndHcBV7IkE2Beyxtm9V87mUl/FV15uFu1HFuMB0ZZeenKgt6dmWjmRvQYpF5pZwvuPc+XRC4JxgskYXeQMVO8CZK6UMxZGE9m5sU5QoUz2IYOZBvU2VY4QBsQSKmwxQUStPFvrUYD2RFAu9/KPVUv/SpKTiK6rNEwpew3B9nNATqNruRxR+yYmhq5hchQsEmr+JstUxDlpuqNUrIXbaO24aFIk966VO/a6hLHqIInr76wFe4KFdq/w3G6H4gOI2bmZA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 615a051a-bfc7-4e2f-100d-08db77c2aeaa X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2023 10:30:24.1952 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: e3RkOsZAMf6Qovo0PdOwahXVl4M/+lCRzknjaWF0fedEYAubV+5UVTwvRxx2rdpfPbH+eAzeZz2Tch7Ek3tjPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4715 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-28_06,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306280092 X-Proofpoint-ORIG-GUID: YhVXq7N5nomKoj0gmvWcbcft69A6U4nM X-Proofpoint-GUID: YhVXq7N5nomKoj0gmvWcbcft69A6U4nM X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230628_033128_278317_BABBFD2F X-CRM114-Status: GOOD ( 21.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When we add a metric in metricgroup__add_metric(), we first iter through all metrics in each table from pmu_sys_event_tables tables and call metricgroup_sys_metric_supported() to test whether we support that metric. The second step is to call metricgroup__add_metric_sys_event_iter() -> match_pm_metric() to check if this is actually the metric we're looking for. It would be better before calling metricgroup_sys_metric_supported() at all to first test whether we're interested in that metric. Add metricgroup_iter_data.metric_name, which will be set when we're looking for a specific metric in the iter, and check for that in metricgroup__sys_event_iter(). In a way this duplicates the metricgroup__add_metric_sys_event_iter() -> match_pm_metric() check, but that is needed for other cases. Signed-off-by: John Garry --- tools/perf/util/metricgroup.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index 6be410363099..111ad4e3eb6b 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -483,6 +483,7 @@ static int metricgroup__add_to_mep_groups(const struct pmu_metric *pm, struct metricgroup_iter_data { pmu_metric_iter_fn fn; + const char *metric_name; void *data; }; @@ -495,6 +496,10 @@ static int metricgroup__sys_event_iter(const struct pmu_metric *pm, { struct metricgroup_iter_data *d = data; + /* We may be only interested in a specific metric */ + if (d->metric_name && strcasecmp(d->metric_name, pm->metric_name)) + return 0; + if (metricgroup_sys_metric_supported(pm, table)) return d->fn(pm, table, d->data); @@ -1291,6 +1296,7 @@ static int metricgroup__add_metric(const char *pmu, const char *metric_name, con .has_match = &has_match, .ret = &ret, }, + .metric_name = metric_name, }; pmu_for_each_sys_metric(metricgroup__sys_event_iter, &data); From patchwork Wed Jun 28 10:29:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13295536 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 593A2EB64D7 for ; Wed, 28 Jun 2023 10:31:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sBlzffcAouJnJeBgEP24KomGGjXuPj3bmvc2iVB0ZFQ=; b=XvnDxzglNg8Q/4 yOFXkA8kJ3posdegTt7uNH2gdexcb8Ym4uZXBGL2/YE0rEA7KPaanCHHwXDOhgGpSwemNNppLFyyh NrjVwZLTLMPsxNGF/CNH2/gUqHoRY+GYFtJyQ+/moFxXNzQAquWMmJwPsjnWvAMboJTgS7BtMKFY7 HcUdtnOS/JVAQgSQm5dOm7DcsvKoJNL5wICYi6dcOhPJ2G0t3k2G4/qmij+MTBjBLJ9SSzzhiKffd v8GlOJuLKK6aZtV/CFuvDgWosUUeF8BuMPXTjxtMVtXRJA3PkybwRj0DEyF68iHC8VVPf9jyeABeW w86N6tMJCJSmHCdCg1TQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qESSA-00FMOR-1s; Wed, 28 Jun 2023 10:31:14 +0000 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qESS3-00FMJb-22 for linux-arm-kernel@lists.infradead.org; Wed, 28 Jun 2023 10:31:11 +0000 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35S8xh4R015057; Wed, 28 Jun 2023 10:30:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=PEVT2ccVAFCMYWm0TDtQk9WFjV/CqEY2pr7Ru3lw+PQ=; b=35GP3eVVztIBnkSU63DGnSSjC2TWZ+B+67L/VzpGjbCLnt5v9ADWvyAJ2obU2C7dcK5u tswvF+kQ3MdOGrhH97RyclIHheFH/IUtUw7xTY6sVp/02UVyj9Euek8rrvpkkRBiKfQM FTIJssE806itUtZgZMNCPrZl7ORtPtpHB7rW0dWsPJjIvicBDzD9XG3Omfc6qr8hMW+/ hfu9Fx8/Y5I5YEuOO1ESN+oT13bZldYgMiKjSi0c5a8jUnR6y1KPqt20oUsCq7N5P3tw IQGCGMe9q/kORHFBfLCskdtC1tk5gVWUKPtghoQYFNIzSJBeaO95otCgw3/OuXVswfwc 9g== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rds1u73hq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:28 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35S99Hlm008566; Wed, 28 Jun 2023 10:30:27 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rdpx5trjr-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i/xvAVuXu+V53JcZOmNln42gyKBziev+KikGaFRthd/owqArn2smcfYeVNMolazBB42wEFSDDhsRsf9ONWpjm2/lgVbOhYx5CyfpE4ruMh1aQAWwiZtU48n2KVQO3ONkNtxK98HpcWvF5AZLBcJMp2NScXevXe9vplUVIbKimrda1Sxk1AOQ1zPCok3dAo8pg0XU7Oym+JZVO4e6Qewa12N2nT2uE6AK7eSYQi1nh5uMsj6wnxO0l9/YAN4uE81iJdfYgYhyHCc9iASwHHUjKOf1NPkYCZvcy6Eo+AooMG4vGAzgn+d6iGlpw4U72IyUaj9GNGqaYhSLuyHvTGW+oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PEVT2ccVAFCMYWm0TDtQk9WFjV/CqEY2pr7Ru3lw+PQ=; b=PHUQIWJO6IrCNQt4/1dh0PacPVb9Hb1kZdI9jcMBzU+UrvmQYoCkKj4vR69Wqu6bJVftYan/wGfJWFMsTxIB01ru+PtkqNtA+Ywy8zk1WzQVHjYb2hwlrSJh+CMcrhJFbc+ocz3qK3hx05DNyj2s69e2mI7+KnX1ty7jY4UCS3mHTc0qOq3lUp0y7NBpaJlInVaPk82dgEukrmtcNDI6m7Q6vhLx9s1o5M9/c3tZq1SCZI/710JPCcpzU+3yqOKieSomAcP2LQ/v6zlNjt+5CwZeUe8sgvnuDwakoqn5+ilEXbOb2OxmBEzSfAXsqwTxSNQtTqhmx5M9/wDxWiqhkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PEVT2ccVAFCMYWm0TDtQk9WFjV/CqEY2pr7Ru3lw+PQ=; b=OGajmE5oE0CtfKOxdlcH3KTd3mQxOGStLDn3eEBqx3qCJssOM0PrZRLHIG5aK9MyXODeL1B+yyB/ehV4hNfZ2R71iYCZLbwXKyZYIouWrqDxxePz+f96HrgPpej153fG32nwZfBlHaJIRFGvDG6BYTHtDiDpnmyJ1gV+N9unXA4= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SA2PR10MB4715.namprd10.prod.outlook.com (2603:10b6:806:fb::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Wed, 28 Jun 2023 10:30:25 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb%7]) with mapi id 15.20.6521.023; Wed, 28 Jun 2023 10:30:25 +0000 From: John Garry To: acme@kernel.org, irogers@google.com, namhyung@kernel.org, jolsa@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, renyu.zj@linux.alibaba.com, shangxiaojing@huawei.com, zhangshaokun@hisilicon.com, qiangqing.zhang@nxp.com, kjain@linux.ibm.com, kan.liang@linux.intel.com, John Garry Subject: [PATCH RFC 8/9] perf metrics: Stop metricgroup__add_metric_sys_event_iter if already matched Date: Wed, 28 Jun 2023 10:29:48 +0000 Message-Id: <20230628102949.2598096-9-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230628102949.2598096-1-john.g.garry@oracle.com> References: <20230628102949.2598096-1-john.g.garry@oracle.com> X-ClientProxiedBy: SN7PR04CA0014.namprd04.prod.outlook.com (2603:10b6:806:f2::19) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SA2PR10MB4715:EE_ X-MS-Office365-Filtering-Correlation-Id: 7c5bf042-b36b-4087-71e8-08db77c2af98 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fsOgcAAZZ5EiAc+AuA5IDCO2GGx4UTWs455sQqFgAVh4ojBfHdA3qYIkO+4p8Git05Z8a9Ldcw5qoWRG7FZ+eQ/YfCcUfK6bj1wK4BjaJ1jsKTLoj89Do+Ix1AORGMzOA+Eut1m5U/H4R7I2laZP4coIg4NLYiZa3IdpBhBVbPGje+1P8v6MxW9JhfTZbSi7oRCSXiiAGI4QHXnzECtfe7PB45fr8ITGoXXOClBqsOR0JtXV0UWxYhqqD0hUAtyuxWzyeUvsyLguDGeSSSMp6v/uoqHZgoSCiYxEbPQkG8RDVZiMQBE2FNyH+tjoKhqjKyTTPGKLwT4I5hUf24B/TQ1hf2pLST0AEJ1uDDqDV3bFNGe49A5Ajt72h3ir7uqrex7wAql8EL9vUsVcaUGm5D9UDKI7AQqs/6j7xp4SkMp4CO3Jk5dGtu0upiZPe5F36bZrniYRoO2303jroHZ9qQRr7/qkZFh0vAPmtEogHi0g8LT0OJNdcbiU5H/j4qbHPCzswLE2yOpdei379fU+B0e0LzEMt8AMXXbVyJE0zRBz1vKI3QWurWXo7yLfv1lXGCOOnO7vn7Sm43zmd9p3XfO9cRjpYkhuPsH8binnfHgygQfv1Uhe6OaoAp1N2IFe X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(39860400002)(396003)(346002)(376002)(136003)(451199021)(38100700002)(83380400001)(103116003)(36756003)(86362001)(478600001)(6666004)(6486002)(2616005)(8936002)(316002)(66946007)(8676002)(41300700001)(66556008)(4326008)(66476007)(107886003)(1076003)(6512007)(6506007)(26005)(186003)(7416002)(5660300002)(2906002)(101420200003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KDjkATjDLnngiCZNhsunJJKxDzkcA2zdtEf3aCaQs0k/yN4Z+V0xoY/e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q55AdG4jasdYJvIg6Y/bVvwLzWwAj3XUWvkNuYgENbOMlKO+YfFGeX7t7zkV819nNcD4Go/36CGMfobYMiXq/b88OUdkAm4lBNz0VIy1jKvIy9pAE8PEnP4d9uwsIVAekSSS1p+NfhARFmSznjwvjDyU8ReDPYxWModh8iav0W0ctf+5jLxKBTiaGtQu9uYWAZyjDC4rxFJFv5b8XjgwaxZ5Txfokc6nDhRbhww0eZb0XvBDsstxc3NcJprELawe8QC0YS8tBXSfMC3WhxB2OEdI7TUFEYFRW3kwD3SPhfyxRUOnHGpQzqPMJV9h6pQlhhkjp0i9P0qRLqT/Z1+5mYE1szOrqHE+lXxrm8tD48vJDJuOlEZ3OkaA6qZKptz6SIcQMTQb33cK8N620BvDZVrb1bO3o5xH11eL5vHMd4n/rM8f1FFRwL/Mm2h7IylD5Emlfke2pTikjGtihri2UF5ytHkG5bjTcFB/KWr9hIc8GXicWyOP1nuyCYw06S9D/bwcZcdsyrEy/6q+b+Z0k/FhCgzadubPw6zXgsHDcCtInC5Qep/S5jf4Fp1lwkqQlwuDLTVr1ZP59Zw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c5bf042-b36b-4087-71e8-08db77c2af98 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2023 10:30:25.7416 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KF94Hx0OlX+V8qkGSqnZXoxh0kt/zHusGTnSCWtsiy5MYa3sutFvtp4Xf3YoG9d+aGW2nZevc6LxbYZ0jbsADw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4715 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-28_06,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306280092 X-Proofpoint-GUID: sV_MZ5DQjufshANt_ayECoJEMxGxIdbL X-Proofpoint-ORIG-GUID: sV_MZ5DQjufshANt_ayECoJEMxGxIdbL X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230628_033107_839080_ED03FD54 X-CRM114-Status: GOOD ( 17.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Functions like pmu_for_each_sys_event() may be inefficient, as we only stop itering for an error. Often when itering, we may want to stop early as we already found what we're looking for. Return 1 in metricgroup__add_metric_sys_event_iter() when we want to stop. Nobody checks the error code from callers anyway - those are pmu_metrics_table_for_each_metric() -> metricgroup__add_metric_sys_event_iter() and pmu_for_each_sys_metric() -> metricgroup__sys_event_iter() -> metricgroup__add_metric_sys_event_iter(). Signed-off-by: John Garry --- tools/perf/util/metricgroup.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index 111ad4e3eb6b..c045b111db84 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -1130,7 +1130,12 @@ static int metricgroup__add_metric_sys_event_iter(const struct pmu_metric *pm, out: *(d->ret) = ret; - return ret; + /* + * Return 1 as we don't want to iter any more, as either: + * a. We found a match + * b. We tried to add a metric, which errored + */ + return 1; } /** From patchwork Wed Jun 28 10:29:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13295538 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 953CDEB64D7 for ; Wed, 28 Jun 2023 10:32:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kHlFzAcUCasul7UF18ROmxnzVMhlm+LvCsnDmGxPQ9E=; b=epOP3xdIOepL9H bV62Fs8Bfk0mVeLTaZRQ2T+asclWqPUNL204gnyz4d1BsPm5z0zE7hCpyap2bU+FOzhBtamgf3WJ0 MNzzY+jS8H7HNz4P1Z5dY6HY7BezsSOELkB1g6OyXg6ejCEobTtXdwmZCTMVsqo5ou3lnU675ow9f vyHeBJGYNReSWff/lduzr29SZ73HOnGWzGN3aL0Xuybl5+MsrszBDpDMad0rxevJP/xKEMOUDYZ9L 7ttfqMrO/f2B7oASgEsDC7tHrz0nu3rD56wdfhQfiT250WvQQ1ZCZqewnhNmv2k2Em47NKqMYtJN1 4JQDOOo13cgnlRBate7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qESSn-00FMb7-0X; Wed, 28 Jun 2023 10:31:53 +0000 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qESSE-00FMJm-28 for linux-arm-kernel@lists.infradead.org; Wed, 28 Jun 2023 10:31:20 +0000 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35S8xiLk015163; Wed, 28 Jun 2023 10:30:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=JF4w714HqM8EWURE++K7QIfv+iB2N3VL6NmosO6SISQ=; b=jE0JhE5KXncqOcvuUVnCsDfAZWTa9aWsoGyy+cgl2tiArazXbUaLh3x4U6SXyggKBb2X pdPGA9euijdyRSD1GcUdBommo9Rw7iy7HyOqo9To92bQyoYA/VfVrKc8LhEXI0vE16mN kBJZVxv+MlZa67dGQoKXoZp16xqH/l4usYcrRJhE7ML0GlHYV/8+kwDy0EIBfkWTTcx+ zCt3tK4Md6kuf0k3zsdLeWEs3b7r5YXhITjcREGn3FEU6f99mUVH20adE2aD/KgAGmji 49h5R7RnHfeYtEhCG6iFeiTztRLbULuVYq6JEApupRj6KrRaZ/xk3b64frvEopqAJu1S rg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rds1u73ht-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:30 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35S9EXdY008565; Wed, 28 Jun 2023 10:30:30 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2173.outbound.protection.outlook.com [104.47.55.173]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rdpx5trp7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=arN/E4BlkHAQ1l6IqEFmUN8lic4lWS1SCXbxcmGPoxfWVV06chAjtKbh4JnPwYuIQ9TIBldRivhtBA1xzIwlLn2ZktquHR1kuYo1zeGnYJwxg3gO0jE4VgoijCMJPBIeBKkLhAc8XfkFyEz6sHh1oXkR2N497PMjPlKTuTM7anN3S4qPVMXdYHuDA2JTGQyPtECdeBdA3zj6njGo244xfOUg+3WA3r6ZS1TvRN7zOiwgq62sHmgSS53k2eo3A1+lvcno/EwC9BK4dxVd9/vw7wrh+adVY6lVUVFzWWYRif93nGqiJOx8CJiqf8wTsVrthqTgyzi7zu1QbTdHjeOH6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JF4w714HqM8EWURE++K7QIfv+iB2N3VL6NmosO6SISQ=; b=WSmaDcr8pHL3UhAaECfNsy6+hmgwv8L0ZIQesoffpxpaDFBCGMy63enlII3COglPtPgt0ySoXXD5y6NlVX+ALc3vFZ0vpygh/lQeL3DdrPc64VZtwLCAntxPLcvRlfBBChHx3EZpt2Fcopm9Hi1auPbCaoy2P82wiGWBTVdxQjIOTqohNZPE2osrVzuaRrQEOVNTgrAyT8Sr7pC6M66p2axZg7/6x9olCXu19R2X5QCFGrTaRUweA5qplCN2GLpCaHj4OrETtIZxRt9tVqh8TNKj19wCcdqFgCMMNpD75Di5maCcfoHLx2WEgMEzpQy1uF9BjdOzsdt82J5uO9kpmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JF4w714HqM8EWURE++K7QIfv+iB2N3VL6NmosO6SISQ=; b=TMMxFlitdbIPZo+i/bxu9Bwb8VSe13rY9ZvUb7+KJRtFcn3c+xQV8MZeK1PyessJK2b5O+83V3x2EypKpsMMfoY/MPMLuYuQ67+Mtj6FaRkIdmyk75q7HMOFJDYdKNPzIL/sMTUsRZ9/odxp9Q6YoULQp7tEcwl01ggIHrD+qXU= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SA2PR10MB4715.namprd10.prod.outlook.com (2603:10b6:806:fb::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Wed, 28 Jun 2023 10:30:27 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb%7]) with mapi id 15.20.6521.023; Wed, 28 Jun 2023 10:30:27 +0000 From: John Garry To: acme@kernel.org, irogers@google.com, namhyung@kernel.org, jolsa@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, renyu.zj@linux.alibaba.com, shangxiaojing@huawei.com, zhangshaokun@hisilicon.com, qiangqing.zhang@nxp.com, kjain@linux.ibm.com, kan.liang@linux.intel.com, John Garry Subject: [PATCH RFC 9/9] perf vendor events arm64: Remove unnecessary metric Unit and Compat specifiers Date: Wed, 28 Jun 2023 10:29:49 +0000 Message-Id: <20230628102949.2598096-10-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230628102949.2598096-1-john.g.garry@oracle.com> References: <20230628102949.2598096-1-john.g.garry@oracle.com> X-ClientProxiedBy: SA9PR13CA0083.namprd13.prod.outlook.com (2603:10b6:806:23::28) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SA2PR10MB4715:EE_ X-MS-Office365-Filtering-Correlation-Id: 378ab422-77d3-4590-5678-08db77c2b0af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5AG9czf+bbOXWrU83l4H0gYxoIucCvfQXwqEbfuSHyOqFdet4NOSgx4ejICRKe5lCoT4dtRn3fNRXZHg8TWBFO3bDm0fpuFpPeiBklIX/P2oWfhQa+Te8+AiKv2teY02Oq1Y3kNnlmwsGaFa3/LFmkqJjbO7k7tWup2kze5u5Q42/n10J7Pip6ERvEkSYVMckhXdOHp6OTw9TJOkuDOVHYGfEoyYmH2TQ49zNC4/ukkXAO8c5QbGzgqJkTC2DvPbn3c3JQetXIeRtwAJqXJ7cIFqaifS7WlPkt8xSCj5NEy1ERTsqrQdmmkmbC3cTLd7PWWQwDF0OTZO4zp19sgiPIXOsdCK2MEU9rgiAf7tXYcmSsA8pjF7YX/pozIstPMQGdKx0Ctt10sL4GlUmLI0OQtO6KsK8OLrE/za32pd4TGgL1YVa06vEH0kmJ1PAfgsBR0p3kZrqoNKjO+e5M6EIlwNoYfhCGNz9RhsJD1xaJgm+eWVw5Tk3IsZ3WB4Epu7tC9cpmfmFPA35fOxuCPNhWAB4UyKG8B81kzX5mV/asW0w1j2Z9G1jssElxkY7PWk X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(39860400002)(396003)(346002)(376002)(136003)(451199021)(38100700002)(83380400001)(103116003)(36756003)(86362001)(478600001)(6666004)(6486002)(2616005)(8936002)(316002)(66946007)(8676002)(41300700001)(66556008)(4326008)(66476007)(107886003)(1076003)(6512007)(6506007)(26005)(186003)(7416002)(5660300002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZPBkt3Wx0ouDwqQnmMpWmN98s9UVSlWTG6rrNOByiC2N7lrxBGYpMgMiGq2xq6jvgfJK8xsbCiFz7DQL514L3xn/fluxoU49UAHOqERJwWuYOCR6f7xF6n6J5lOpsp/3AG6ffxf/Hexyo5LOPtyNz8qsAB8/gWw1WP/PqgcIU67L7RyQrMDT7gWxynRVIrswkywaY/Jzusw7Py/LURBVz/rG6MqRFlFTgfMJOgOkhwzNHMr1jHEYk65GC4Y2sWK5e/samsIP2QjacfdRAO51WQgMFHdUpFO/HPDWLQ8625KAnuZm/zk+i47DjZcQhB6CFkmDdyKirA2gn9G6LNm4Vd7/9Y0CfBZYcK6Vgm8xTl2ZASO0vMfP0T6K5SBtrYOnlMTUGRI+QuRVQjYMy0JjV1g0bgcqooE8yb8EXwiqNnbFpsH9RRIjMxkmYWsmcJspM29LcXVA2BaofFVC7jE/+znzYSYBz/dAV6pW29/ssFyJzn3goEdVzX3IgHWG3Jw37xJNP8wqqXXtz3AwXfdCoOvBKlGEQS6cES3aHOQGnX6POFn0P8hA69znRU/gPUCxunzwyGywBcG8T31AQAsjMsWvC1Z9W3nZ6UNjlmcv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99uquijkgk26X4BLJNKyVamidZkzg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 378ab422-77d3-4590-5678-08db77c2b0af X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2023 10:30:27.5701 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BrkNyv1iaYY983a1gmXaASB8gA176kDcLciKp4aPyPzeXYL39tUb9AQJga6eUB7lIuFGQFq0IOh6kiKFDYSJLg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4715 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-28_06,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306280092 X-Proofpoint-GUID: TE8CHW-teAqLciJnNRaPf831K1pBNfPw X-Proofpoint-ORIG-GUID: TE8CHW-teAqLciJnNRaPf831K1pBNfPw X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230628_033118_716245_3B95B179 X-CRM114-Status: GOOD ( 15.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It is now not necessary to specify Unit and Compat for metrics which reference events for the same system, so remove them. Signed-off-by: John Garry --- .../pmu-events/arch/arm64/freescale/imx8mm/sys/metrics.json | 4 ---- .../pmu-events/arch/arm64/freescale/imx8mn/sys/metrics.json | 4 ---- .../pmu-events/arch/arm64/freescale/imx8mq/sys/metrics.json | 4 ---- .../pmu-events/arch/arm64/hisilicon/hip09/sys/uncore-cpa.json | 4 ---- 4 files changed, 16 deletions(-) diff --git a/tools/perf/pmu-events/arch/arm64/freescale/imx8mm/sys/metrics.json b/tools/perf/pmu-events/arch/arm64/freescale/imx8mm/sys/metrics.json index f416fa052337..574aeb964efd 100644 --- a/tools/perf/pmu-events/arch/arm64/freescale/imx8mm/sys/metrics.json +++ b/tools/perf/pmu-events/arch/arm64/freescale/imx8mm/sys/metrics.json @@ -4,15 +4,11 @@ "MetricName": "imx8mm_ddr_read.all", "MetricExpr": "imx8mm_ddr.read_cycles * 4 * 4", "ScaleUnit": "9.765625e-4KB", - "Unit": "imx8_ddr", - "Compat": "i.MX8MM" }, { "BriefDescription": "bytes all masters write to ddr based on write-cycles event", "MetricName": "imx8mm_ddr_write.all", "MetricExpr": "imx8mm_ddr.write_cycles * 4 * 4", "ScaleUnit": "9.765625e-4KB", - "Unit": "imx8_ddr", - "Compat": "i.MX8MM" } ] diff --git a/tools/perf/pmu-events/arch/arm64/freescale/imx8mn/sys/metrics.json b/tools/perf/pmu-events/arch/arm64/freescale/imx8mn/sys/metrics.json index 2bbba4d8ea5b..d81e7d562b65 100644 --- a/tools/perf/pmu-events/arch/arm64/freescale/imx8mn/sys/metrics.json +++ b/tools/perf/pmu-events/arch/arm64/freescale/imx8mn/sys/metrics.json @@ -4,15 +4,11 @@ "MetricName": "imx8mn_ddr_read.all", "MetricExpr": "imx8mn_ddr.read_cycles * 4 * 2", "ScaleUnit": "9.765625e-4KB", - "Unit": "imx8_ddr", - "Compat": "i.MX8MN" }, { "BriefDescription": "bytes all masters write to ddr based on write-cycles event", "MetricName": "imx8mn_ddr_write.all", "MetricExpr": "imx8mn_ddr.write_cycles * 4 * 2", "ScaleUnit": "9.765625e-4KB", - "Unit": "imx8_ddr", - "Compat": "i.MX8MN" } ] diff --git a/tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/metrics.json b/tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/metrics.json index 862c98171e0d..d2a71b02ab59 100644 --- a/tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/metrics.json +++ b/tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/metrics.json @@ -4,15 +4,11 @@ "MetricName": "imx8mq_ddr_read.all", "MetricExpr": "imx8mq_ddr.read_cycles * 4 * 4", "ScaleUnit": "9.765625e-4KB", - "Unit": "imx8_ddr", - "Compat": "i.MX8MQ" }, { "BriefDescription": "bytes all masters write to ddr based on write-cycles event", "MetricName": "imx8mq_ddr_write.all", "MetricExpr": "imx8mq_ddr.write_cycles * 4 * 4", "ScaleUnit": "9.765625e-4KB", - "Unit": "imx8_ddr", - "Compat": "i.MX8MQ" } ] diff --git a/tools/perf/pmu-events/arch/arm64/hisilicon/hip09/sys/uncore-cpa.json b/tools/perf/pmu-events/arch/arm64/hisilicon/hip09/sys/uncore-cpa.json index 7bcddec8a84f..c2ff0d85c354 100644 --- a/tools/perf/pmu-events/arch/arm64/hisilicon/hip09/sys/uncore-cpa.json +++ b/tools/perf/pmu-events/arch/arm64/hisilicon/hip09/sys/uncore-cpa.json @@ -67,15 +67,11 @@ "BriefDescription": "Average bandwidth of CPA Port 1", "MetricGroup": "CPA", "MetricName": "cpa_p1_avg_bw", - "Compat": "0x00000030", - "Unit": "hisi_sicl,cpa" }, { "MetricExpr": "(cpa_p0_wr_dat * 64 + cpa_p0_rd_dat_64b * 64 + cpa_p0_rd_dat_32b * 32) / cpa_cycles", "BriefDescription": "Average bandwidth of CPA Port 0", "MetricGroup": "CPA", "MetricName": "cpa_p0_avg_bw", - "Compat": "0x00000030", - "Unit": "hisi_sicl,cpa" } ]