Message ID | 20230526215410.2435674-33-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 4CE61C77B7C for <linux-arm-kernel@archiver.kernel.org>; Fri, 26 May 2023 21:56:44 +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=UlrA6jK9SyfzHlmAWlomz7HxBBlrE3hxf0OzkL+dMYY=; b=VvBYBztfQw7WRI F5JEMsGmkL+XCw82X986nMTWzulDIGWGfg9BhZTZEwg67QGo0H0+6I/q7JZ6ceJzTyDAzmb3f325E LRRV1fU7N54XU/3GLx0C3ZqKEMrcABPPl3ioyDet6kHWTWpcY37BKF1/WG3yns1oei01BewxFD/l6 VuNidp75YKR7Eac1+atxApuFlWZdcwKNXTR8hIWOiZv+dyyEtf5qwsTgFWcNIiADM2hxLqzS7T+7r d5h/ri4mJGQ35cAc6nU1WUrmV/1hFP62cYXo0rusaMVZqIUe013ywWtHYxdg+v9AKlIA0eWsqwso4 rMX8Ng/mB1I15padwYvA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q2fPy-0043Yg-1Z; Fri, 26 May 2023 21:56:14 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q2fPL-0043Q6-1A for linux-arm-kernel@bombadil.infradead.org; Fri, 26 May 2023 21:55:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=WOjxsGu2+B4s1nXlsSxqdUIWzY+WQ/eQBroudZlXVAc=; b=WW+WvVkrHsWhlfKHNoLrdQGYmZ +zlEoM13T/++ybxcaOydJzioIXoGgOg0qmSv6uWQBppIybKd0HkhPIcFdCoetAGUZre+BtFt8hAk6 KiM34B1d2hlh0rbnnB5LJBWomfDmZzGmCxEdVJ81cR/hcn9FnKFruQEjjmbU8EfG3g1Lo/HgBCsMG Tl2QUVK5zWdnzqxJ/eOAtexb0qceae+9XDs6PJRHFMvcJ+n+1y8ImUwMpiTbpNHXkThG58+bC0+B4 mJB249QXeeb5JLnAc25PbkeFoqoEBfxur8UiJW0qk9OhilpJPVjL6ohlSQQri5zQ3NIzUGmFnmVTp qx/XsA+g==; Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by casper.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1q2fPE-003AI7-Mu for linux-arm-kernel@lists.infradead.org; Fri, 26 May 2023 21:55:33 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-ba82ed6e450so2612610276.2 for <linux-arm-kernel@lists.infradead.org>; Fri, 26 May 2023 14:55:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685138125; x=1687730125; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=WOjxsGu2+B4s1nXlsSxqdUIWzY+WQ/eQBroudZlXVAc=; b=3heuIJcivna50pM+nhJIiF6g54QHYqLhnoOYTDWRfe/uGH0H7OuM0NUlGBfdIEbEvc rBhz0+plkzaxpfydo4SF5XQwTGgZGU+UDzrIO2nTY0OIxyVc5QodUaYo9YSQNTezXEUk uTEJ3kDf04So354A/p1dvASNE3iPhQvUTNUBgI2kNdoxMIhaKt3Pkf01ZgeX8GOlVatJ R6S8oP0+OfCgY/LfTnJJyTlzBlxKwuHTdF56hV1rjOU+nsTWH31ictUoTby/cP2z0dP1 IrwgBOkzMERCjdOUhhUYHerSGNvf6qOJxYgNVJzjinJNyF15C1insSO5x9hNu7S/2oLQ QVkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685138125; x=1687730125; 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=WOjxsGu2+B4s1nXlsSxqdUIWzY+WQ/eQBroudZlXVAc=; b=ZLX55pGEXIz3DPFPtCeLvFklnNoPaiaLxM5xIS1tEPlndffPoN9gNRdXLh2vRYZD6e UUljlENe8aPdg1/yFZIU6EE0aOZ/xFJcNgMwajsXxncDgZwFHf+ugRM2SnfFhVIAS0d7 nuIPJR+v7h5sdxAk2RxhwKXTI3lq3dbfdLMktMvPn5y/MahcywPgYx2Akxaf7xPyNW1K bdaamEf980FwWEZBu54NXaVa5Zhb/PNWbbgkgitRYyeQi/643LpCp/PUSpGfPUUbtorb kMMWbjs6b2b9g3bpiTsJ60rPqLuk0S2Is1/a/nzOfL+VOsRCBtlpBvccy9GPP0gBNNvn +6Og== X-Gm-Message-State: AC+VfDyx8ZD6hksbUzpotWmr+NuOpLgPPmAYvaLSPMrKXz+FvyaZx6vx NFDA7mFPQiwIGTHynHqmGzG3AlUuyCmz X-Google-Smtp-Source: ACHHUZ6P7LZw8PLm0hOntGTBJwTABtv2oXXPc9NN7Hx0EtYByo5ppbaUNCOqwaYLvt4xnyMTAIuUqp9sxHtf X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:3b4e:312c:644:a642]) (user=irogers job=sendgmr) by 2002:a25:8046:0:b0:ba8:8ec4:db50 with SMTP id a6-20020a258046000000b00ba88ec4db50mr1241672ybn.1.1685138125618; Fri, 26 May 2023 14:55:25 -0700 (PDT) Date: Fri, 26 May 2023 14:54:07 -0700 In-Reply-To: <20230526215410.2435674-1-irogers@google.com> Message-Id: <20230526215410.2435674-33-irogers@google.com> Mime-Version: 1.0 References: <20230526215410.2435674-1-irogers@google.com> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog Subject: [PATCH v4 32/35] perf pmus: Ensure all PMUs are read for find_by_type 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>, 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-20230526_225529_114032_CBD2CCF5 X-CRM114-Status: GOOD ( 14.23 ) 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/pmus.c b/tools/perf/util/pmus.c index 2c512345191d..6ecccb5ad03e 100644 --- a/tools/perf/util/pmus.c +++ b/tools/perf/util/pmus.c @@ -142,7 +142,7 @@ static void pmu_read_sysfs(bool core_only) } } -struct perf_pmu *perf_pmus__find_by_type(unsigned int type) +static struct perf_pmu *__perf_pmus__find_by_type(unsigned int type) { struct perf_pmu *pmu; @@ -150,6 +150,7 @@ struct perf_pmu *perf_pmus__find_by_type(unsigned int type) if (pmu->type == type) return pmu; } + list_for_each_entry(pmu, &other_pmus, list) { if (pmu->type == type) return pmu; @@ -157,6 +158,18 @@ struct perf_pmu *perf_pmus__find_by_type(unsigned int type) return NULL; } +struct perf_pmu *perf_pmus__find_by_type(unsigned int type) +{ + struct perf_pmu *pmu = __perf_pmus__find_by_type(type); + + if (pmu || read_sysfs_all_pmus) + return pmu; + + pmu_read_sysfs(/*core_only=*/false); + pmu = __perf_pmus__find_by_type(type); + return pmu; +} + /* * pmu iterator: If pmu is NULL, we start at the begin, otherwise return the * next pmu. Returns NULL on end.