Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2544145rwd; Sun, 21 May 2023 23:56:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5K/lAj3uDuB2PLekdEXCfoOppOX6wG+eNyHf9kLqn9PQJeYV4/EWm6I7W8EWUO6xLDFM05 X-Received: by 2002:a05:6a20:e68e:b0:104:41a0:c51a with SMTP id mz14-20020a056a20e68e00b0010441a0c51amr9087819pzb.38.1684738591191; Sun, 21 May 2023 23:56:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684738591; cv=none; d=google.com; s=arc-20160816; b=a7aKqG/ouu/nOyaFYnncDjYQUUTk64CF/LBYL9xF82mQ4LDMWgBpwA2Qm0pn+2NJ7N TgoqhrJWNhaQGEJSx1AEjwpzbEcR94nYvDuNZHtOAr4N3QWJF10yX2lyaRN86MbKBJ5e YZh2x/TUPiZX9aTrvxfQmEivBl6hzEePOYlQ+gZRusT27lZ/ETNN6TIkj6GPN8qez48k xY08/h4lTj8D5QDqgCJziod8nD+pP1qp+UNdEL40F+L+SyjNIaZl605XWlBZUTGLvI73 IgyexbYThbCScoZBVzWtIDFMtkikdNbVMDsEYAG/RD/+GvelDfAOi+ZuJ0NXi6LKTOwq tBpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=2FXlJjlrAGttKZp5HRCBcxE0XLHUZdESbTdmHXPLxLA=; b=vO5bf/U3awRCCN/8dgRdUZnrhK+KEDv9heBArJxosywHnANyXQ9NjorQJBHL7fQpqk F/Gns7xBggfbZPi0Lqzn4bJKoQJMfxg2t19WiBRmL8vMDwWVEaLB1PGDSaocam/N1fEr aKRwcDx2XE3zMpvgd6jKuhyiJYoMDC1BZm2RaNAWprULhw5W8GIv2kCfxWxW0ZlPowS1 Krzjpn3qqGmEbjzsNacU1POSQYz43yAqCjTSlW1+lbFiy490ELy1TlLab4lOSM4DfLLR +ohQMylno5qET3+LuiQxCKu1C3N5m2fjBtlIVJOjr/DlqKVnR1QTIZ/30m7kI2ypsUJW tJiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=uQtwox96; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h25-20020a633859000000b0053476d7248bsi4474909pgn.547.2023.05.21.23.56.17; Sun, 21 May 2023 23:56:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=uQtwox96; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232013AbjEVGp3 (ORCPT + 99 others); Mon, 22 May 2023 02:45:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232042AbjEVGoc (ORCPT ); Mon, 22 May 2023 02:44:32 -0400 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5102E77 for ; Sun, 21 May 2023 23:44:03 -0700 (PDT) Received: by mail-pl1-x649.google.com with SMTP id d9443c01a7336-1ae4c498f0cso57154805ad.2 for ; Sun, 21 May 2023 23:44:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684737843; x=1687329843; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=2FXlJjlrAGttKZp5HRCBcxE0XLHUZdESbTdmHXPLxLA=; b=uQtwox96BxP135Bg+/OnbOh3t08WB231lF5dBoWs7XQck3bMUZTrhASU7PKQAgggKP jSpsuc5XfKDqSPJHqPONlBMeCiCuAYxyq9G13gocGHbCjwrVKS8GQeoPc2GKmmE8Tx1C NRfTkZIEXeREFqZkO4pPRJOEYBVsDEHzQ7odWrerf1XOVIWDvBKpEIqp8oa3ghLjEz7r AXgpmpnzyuu/aPMZidML9SMkQTKmt7mO0sJFG22Q3FSry6nzENTgDrmFt7B97wbsyw70 6sXgYPTuRLxVZlDUpldlsI8ciPex4R9nYB55AxN8N0WAGBn+9wScSF40AGy1FM5W+EXe FCNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684737843; x=1687329843; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2FXlJjlrAGttKZp5HRCBcxE0XLHUZdESbTdmHXPLxLA=; b=Wl8Drtu3vEdvkoBzn6QAY/Lw13ISLYrmFR3VQiFkyskc3OG7qkWQIP8vYGlGM+8x9u NMvddM/BlA4CtUvyCx0JNbK65Aqv7ve86BpTDShqvNQVeXHcsJtq7wuroPl2xQgn4ong wv29VEjrTrqKy6zf8OWo2hpfsCQ7zLET1wfxly+DjbBajicgNgnm/HdL9oOnOYRm4RiG +8vlDJzyR6foJeyeDqfz53hEId+LC9dY80Qvj4UeC09/L/+sm9U5k35a8r0pNve7X7Qy 0F40dxwzWBKPo9fEo/NuRLUikzl2QH35+WlDhKCWW9zjs4HfsNEoYigkREyJBgBsStu8 hG0Q== X-Gm-Message-State: AC+VfDyNLTQE1UXGbmmArwX9HnfDvXnjsQTa9fmhlvId375nPhnhaVB9 J+dHbeh4wfr6ay7s3riOAUPkU0mQZlNL X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:48d9:8c21:e099:7301]) (user=irogers job=sendgmr) by 2002:a17:902:f152:b0:1a6:c58e:9b9e with SMTP id d18-20020a170902f15200b001a6c58e9b9emr2177250plb.7.1684737843278; Sun, 21 May 2023 23:44:03 -0700 (PDT) Date: Sun, 21 May 2023 23:43:19 -0700 In-Reply-To: <20230522064330.189127-1-irogers@google.com> Message-Id: <20230522064330.189127-13-irogers@google.com> Mime-Version: 1.0 References: <20230522064330.189127-1-irogers@google.com> X-Mailer: git-send-email 2.40.1.698.g37aff9b760-goog Subject: [PATCH v2 12/23] perf header: Avoid hybrid PMU list in write_pmu_caps From: Ian Rogers To: Suzuki K Poulose , Mike Leach , Leo Yan , John Garry , Will Deacon , James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Kajol Jain , Jing Zhang , Kan Liang , Zhengjun Xing , Ravi Bangoria , Madhavan Srinivasan , Athira Rajeev , Ming Wang , Huacai Chen , Sandipan Das , Dmitrii Dolgov <9erthalion6@gmail.com>, Sean Christopherson , Ali Saidi , Rob Herring , Thomas Richter , Kang Minchul , linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Avoid perf_pmu__for_each_hybrid_pmu by iterating all PMUs are dumping the core ones. This will eventually allow removal of the hybrid PMU list. Signed-off-by: Ian Rogers --- tools/perf/util/header.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 276870221ce0..e24cc8f316cd 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -51,7 +51,6 @@ #include "bpf-event.h" #include "bpf-utils.h" #include "clockid.h" -#include "pmu-hybrid.h" #include #include @@ -1589,17 +1588,21 @@ static int write_pmu_caps(struct feat_fd *ff, * Write hybrid pmu caps first to maintain compatibility with * older perf tool. */ - pmu = NULL; - perf_pmu__for_each_hybrid_pmu(pmu) { - ret = __write_pmu_caps(ff, pmu, true); - if (ret < 0) - return ret; + if (perf_pmu__has_hybrid()) { + pmu = NULL; + while ((pmu = perf_pmu__scan(pmu))) { + if (!pmu->is_core) + continue; + + ret = __write_pmu_caps(ff, pmu, true); + if (ret < 0) + return ret; + } } pmu = NULL; while ((pmu = perf_pmu__scan(pmu))) { - if (!pmu->name || !strcmp(pmu->name, "cpu") || - !pmu->nr_caps || perf_pmu__is_hybrid(pmu->name)) + if (pmu->is_core || !pmu->nr_caps) continue; ret = __write_pmu_caps(ff, pmu, true); -- 2.40.1.698.g37aff9b760-goog