Message ID | 20230524221831.1741381-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 60AACC7EE2E for <linux-arm-kernel@archiver.kernel.org>; Wed, 24 May 2023 22:20:51 +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=Bds9HM8DDypVFAifb9O6Er8uOGFPeGgpuIip3Tr6uE4=; b=BUMU5FnZZ0Epwm MD7sCKkkpPpt80krpx0poVNbp0wvm0gcTDjBMTD7IjZ1hvT3vJCZI45hzj358oSgnv7luTbNXRCYd PnoY+m2n9+Zq7DMn4ebcnYeQhTXhZSfbyKK4RxB0o9X7BY+b4OO8y/+6nNfwVphvxDcTrLbsYk7ho oc47qd/2uNBVcV0IUWFg4ptfHh8MlmCYGuw3TU1OR9y2JRFrQfZ75g4UBxB/M77mAy44+vLmvR64e 4Y5sqZX/pVUO2HMTw+MpAvnULx26JY+WMN+rGnmYUaGwzwbTAU85XHlS+WwZ+vAsFku0cHf7VUE5L CJeGxO5ivDTRr8zmelpA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1wqG-00En7E-2Y; Wed, 24 May 2023 22:20:24 +0000 Received: from mail-yb1-f201.google.com ([209.85.219.201]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1wpk-00En1t-0a for linux-arm-kernel@lists.infradead.org; Wed, 24 May 2023 22:19:53 +0000 Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-ba82ed6e450so2686642276.2 for <linux-arm-kernel@lists.infradead.org>; Wed, 24 May 2023 15:19:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684966789; x=1687558789; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=Yt6BXRhpcaagH+Rv9t2cYW9/1vlblP5mhKX6P/6LKqg=; b=dJbzSZQQie8CHjExrHF45ZUOMtyCX1iCnt44dhP0OcA5CdcTLww+elNVsvkuol2Vqo 6SAtAw+mNF64uiMUukV3FIbXgscnC1H8RCedPPxT5kIPawwbC1Azu8buOB18bZXd+OBh K3tOIFrGyS9Dw+tYYATG1AYjKwtz4qN4zHHTljemHMmZIW5OkZgdqresjHxIHakHZCzR EmD55LBaK2EO2bV3CAnhi+0njGSbHSFnrYT/+5aU0DvPHHsrzXclbobUBLfZRGF2mCZj 7JM5COM39iCmu26T0JCSACrCzOLBe9AmUPWFHwldn/SzoFkfA1BoWDjl8nwEoAD3lIb5 CapA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684966789; x=1687558789; 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=Yt6BXRhpcaagH+Rv9t2cYW9/1vlblP5mhKX6P/6LKqg=; b=YSfh8scODl5tehRMM4HR0DzGG2VWzLO2WqWUp0MFexIq0XS76+7GR2/fJJVG9br55L sM8DyYuhBGx0MXCFnAu5GFRLJPJbKJqFOd8tGuUwlcLnM+knyPCeyYKF0ea74zdbWB/x QBozpZO0xWNC7oxAGJZYZVmQcOiUipaPpaHnv8N2FZ3cD06KVq9k/zUhCId9bR3269x4 9I6Lt1WpBFd93fMJdGLYiSlPY/HhUR1idqonVdZ0GIgd14h256thby59fEJOdBYFSgHG gO9UEupNm2QgGb42XNK/hO48RCy2rkvmN3+NqYl5JaFvcFH3qcnCedXYckmHIvPt4u75 f7Ow== X-Gm-Message-State: AC+VfDzB3bL3eWJyB9OPjlmhy/7FdoPSllnZ2DcHsolLgaFxvR9zCbUK L5hz/iUhyQ1PZUjohHKnu5sfLcJz4PCQ X-Google-Smtp-Source: ACHHUZ5oTxfW0VyTQCXsS1bjQIoxiAPiAEQHOJqrX6Swyr52eRMCYLy2UrYgwc4t82Dkyrnr017L3WqUUqX6 X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:7aa7:3d2d:76ae:8e96]) (user=irogers job=sendgmr) by 2002:a25:2414:0:b0:ba7:68ff:a441 with SMTP id k20-20020a252414000000b00ba768ffa441mr605861ybk.0.1684966789477; Wed, 24 May 2023 15:19:49 -0700 (PDT) Date: Wed, 24 May 2023 15:18:28 -0700 In-Reply-To: <20230524221831.1741381-1-irogers@google.com> Message-Id: <20230524221831.1741381-33-irogers@google.com> Mime-Version: 1.0 References: <20230524221831.1741381-1-irogers@google.com> X-Mailer: git-send-email 2.40.1.698.g37aff9b760-goog Subject: [PATCH v3 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-20230524_151952_223932_85FE1DC0 X-CRM114-Status: GOOD ( 15.43 ) 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.
perf_pmus__find_by_type may be called for something like a raw event, in which case the PMU isn't guaranteed to have been looked up. Add a second check to make sure all PMUs are loaded. Signed-off-by: Ian Rogers <irogers@google.com> --- tools/perf/util/pmus.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)