Message ID | 20230517145803.559429-9-irogers@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 C4550C7EE2A for <linux-arm-kernel@archiver.kernel.org>; Wed, 17 May 2023 15:40: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:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FS27bJ7Cj8v+w4i8HishofrhD0f8GVDSrrwlvRZb5C4=; b=4NEZ8tAO98uNuZ qDY/MKSVFDizAA9ucEnQj7pB4k0PuCuLAYKXG6hxg6Ryq3RdSsxVnsocDe/f/Mz4UGIzIxkHA3vm6 TdzJ8jWgqWAfOlQzKpmt7FV5c+YrwOpy01IbEL0HyR+yP4STp3fnKG2cudivv0aODCCNm2J0QQ0gA TzVFSh2ZUt3rPJwLAhhLAjkEqX7v55oAfaFmaR16QSTxZvKKjaWOA2q5MEXJixnRq6HAlWxCMP4/h tZBxYceP7maeBrMLdUfjWcvqIf+rF66OUgNLjFUJ+bZSsMenZ0rBqlIi9tuyacMbo+E8oFkY9z/9C rLFvtpSqAWg1Bx+Uzq5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzJGE-00AKIY-14; Wed, 17 May 2023 15:40:18 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzJGA-00AKHE-0Y for linux-arm-kernel@bombadil.infradead.org; Wed, 17 May 2023 15:40:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:To:From:Subject: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=CJew5c6+Wqs3H0xvybKSYHiC9UyD346jsUjXmSkm68Q=; b=Byc19E6YwUZ1ab3jvsolXQXfmx GL9LgIMTRIbvumLykSOfxzpiY5+S3ClfOFPFbMVkv+OE0NbRaKxGgMx0E1yAHrGWjZMCCDOYZtyno b7hhykWElbY3DvlDpLQcFtc9UHYgLDGBfiZgHSo1d2yIO0gWxLA3PXD/Y3vA/v64R6zn9bnnaVpAg wOsKnSneQAFwzn9Hh5KhFTOHFGaCiH5X4cG+b0+I2wAPt54F6KyiUahQrpuuiarEf5Ijm1eTF5+PU 5K0KQK9T+fvGsXwW+zhz3e/v5MqhowDbaQd1cfvtZG39ezb25CnVuj1Bpv5L1KcFDn3Y3w721/CkS adLzqS9Q==; Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzIcB-00DFqZ-0C for linux-arm-kernel@lists.infradead.org; Wed, 17 May 2023 14:58:56 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-b9963a72fd9so1637306276.0 for <linux-arm-kernel@lists.infradead.org>; Wed, 17 May 2023 07:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684335533; x=1686927533; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=CJew5c6+Wqs3H0xvybKSYHiC9UyD346jsUjXmSkm68Q=; b=E8lhndMhmlxnQknUI5Dvjo+mrBhFisWj9VZveazhd506WZHGDpEpNTAA4Yddkqsl7k jfJyBqIDjPc4Peu1Z7l2PLIpT2OlwLN7k0yil0b3L0Xc6ftQVuWqwQVvJ927+frXyQsj il0XlcJNxtqmGmmJdQRikIaxVYSOSKzWndKRmHzkJ69L03cnjBBiarQPneD4eDyD0TCM zjVeMG3cFTWRp6JoHxnm7w1C4ofoTabe5R7ibfucFb4zvMJKtbsuhDGR54Ka+tvGrVNf rnr2fcH7a6n/tfx+ZH/tH/9efv5MVq39uvTuw1pr0TAIBTs2xJA1FPulheWN0xhen8jk XmXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684335533; x=1686927533; 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=CJew5c6+Wqs3H0xvybKSYHiC9UyD346jsUjXmSkm68Q=; b=GhqvbDsy3PRZAc3Iy6n2TeX+S+5HKvKJ1kc/XV2j0PHRgYB6LOwdKAkaSTX/M3O9jW JKQ2UZ/l1CO7C/jUTXhG8DDj+ju4Kkx9nvnnaGmIMy950g69CdboFrCMLwO+E1Frc7Mw Pkdg6pzyD4BPntwedr9YQh5wmHbKGWB4gLth5GFCFPkN3osn6DjGX+iv139xb+1K8PBF xjheVee+AclzU7zKNiyE/C+4+3AQxIc1Em6eL13E2XeFesdXxpt3EEF5+0LxczNW7LUo REdlfcOayYTenaaq00J+emkZkXrlN1fWNPnWwJBGomUmXyex/CCw+Dd6oIbQE7qFTtMG bMYQ== X-Gm-Message-State: AC+VfDyIeIYTvSNLY2JiC0Fhmo2WtBBbIpR7lxuab9oZbdgHLW4Oqzyf IUL/4BECwWOiQ3L7fLhu+ef09F60lD4a X-Google-Smtp-Source: ACHHUZ56HXknOGNqzw7/nwItcz7tOnm7evTpjMpIUjxB0+elX8F+7fCvpauDoNX6mFTOCbcf1NkWmM7mzMNu X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:628b:7e78:d09b:39b]) (user=irogers job=sendgmr) by 2002:a25:6542:0:b0:b95:4128:bff6 with SMTP id z63-20020a256542000000b00b954128bff6mr24731255ybb.1.1684335533487; Wed, 17 May 2023 07:58:53 -0700 (PDT) Date: Wed, 17 May 2023 07:57:48 -0700 In-Reply-To: <20230517145803.559429-1-irogers@google.com> Message-Id: <20230517145803.559429-9-irogers@google.com> Mime-Version: 1.0 References: <20230517145803.559429-1-irogers@google.com> X-Mailer: git-send-email 2.40.1.606.ga4b1b128d6-goog Subject: [PATCH v1 08/23] perf pmu: Rewrite perf_pmu__has_hybrid to avoid list From: Ian Rogers <irogers@google.com> To: Suzuki K Poulose <suzuki.poulose@arm.com>, Mike Leach <mike.leach@linaro.org>, Leo Yan <leo.yan@linaro.org>, John Garry <john.g.garry@oracle.com>, Will Deacon <will@kernel.org>, James Clark <james.clark@arm.com>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, Kajol Jain <kjain@linux.ibm.com>, Jing Zhang <renyu.zj@linux.alibaba.com>, Kan Liang <kan.liang@linux.intel.com>, Zhengjun Xing <zhengjun.xing@linux.intel.com>, Ravi Bangoria <ravi.bangoria@amd.com>, Madhavan Srinivasan <maddy@linux.ibm.com>, Athira Rajeev <atrajeev@linux.vnet.ibm.com>, Ming Wang <wangming01@loongson.cn>, Huacai Chen <chenhuacai@kernel.org>, Sandipan Das <sandipan.das@amd.com>, Dmitrii Dolgov <9erthalion6@gmail.com>, Sean Christopherson <seanjc@google.com>, Raul Silvera <rsilvera@google.com>, Ali Saidi <alisaidi@amazon.com>, Rob Herring <robh@kernel.org>, Thomas Richter <tmricht@linux.ibm.com>, Kang Minchul <tegongkang@gmail.com>, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230517_155855_347870_217D298E X-CRM114-Status: GOOD ( 14.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
PMU refactoring and improvements
|
expand
|
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 930ec3786964..2da28739e0d3 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -60,8 +60,6 @@ struct perf_pmu_format { struct list_head list; }; -static bool hybrid_scanned; - static struct perf_pmu *perf_pmu__find2(int dirfd, const char *name); /* @@ -2026,12 +2024,20 @@ void perf_pmu__warn_invalid_config(struct perf_pmu *pmu, __u64 config, bool perf_pmu__has_hybrid(void) { + static bool hybrid_scanned, has_hybrid; + if (!hybrid_scanned) { + struct perf_pmu *pmu = NULL; + + while ((pmu = perf_pmu__scan(pmu)) != NULL) { + if (pmu->is_core && is_pmu_hybrid(pmu->name)) { + has_hybrid = true; + break; + } + } hybrid_scanned = true; - perf_pmu__scan(NULL); } - - return !list_empty(&perf_pmu__hybrid_pmus); + return has_hybrid; } int perf_pmu__match(char *pattern, char *name, char *tok)
Rather than list empty on perf_pmu__hybrid_pmus, detect if any core PMUs match the hybrid name. Computed values held in statics to avoid recomputation. Signed-off-by: Ian Rogers <irogers@google.com> --- tools/perf/util/pmu.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)