Message ID | 20230517145803.559429-24-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 161BCC77B7D for <linux-arm-kernel@archiver.kernel.org>; Wed, 17 May 2023 15:29:56 +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=T/XgCa1eXFcbQLeaDxWKW/rCDlGyIjg3cZD1dAdRJ2E=; b=gMQAy67lNagK+I fRLkjHWXzBnKd8RuWk3xmf7G7E4OXzbjMkfmwP04PJxaJIEnLGbG+wSSQltcWSnOlmLDi9LDY89NS CCb1nY3TkZ415yXrMH8ia9PpbYJWTJfavuzvX+RG3MM/JtcBdT7BemaxSGnUUJy3SnGeTOW93xHOa aR5aeBru+GTlnvlaFXGQehsfa338tUiDM//0ioBAKiN1Wy+1z7Y4NNxKeVF4JDskXWiVizr/bULLj HBx5bKsESRKEZr+BIZjK4LH72F/Zf9m3fP/pZGb+v2myqYashNSoCHaJ7vwKLCS23ZN/XlCpb/qsl Z6MAxIv6qYXyG4RvX/tA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzJ5r-00AJ8l-0F; Wed, 17 May 2023 15:29:35 +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 1pzJ5p-00AJ8I-1Q for linux-arm-kernel@bombadil.infradead.org; Wed, 17 May 2023 15:29:33 +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=u+zByxDvprri5VQ4rcxngDxyCTv45SqKQxUVZ6WFAl8=; b=Quro78kpHRMKbH7QAA+WS3nq+r dk1DkYqfoPDRKogjp6sJnP4Ie+NTlSuFAho6cI5eewpR4jCDTl13Il/hSFXw57FtoDAQ7pYb3zEJc EfXJU3wGUE9qquUNHdfO08me1cab08BxlRk9cqZeoNHle4ycubPFXD1h/fmx1XqKmAGY18IqzwDJW AMOKYXqiXBtHCux1jfzKa3/xd2y9/N8WMo5CxHG5yOGnibwGi3HZv8gSAKymBHEYeiYrGINnXkcba LGCyXIKNopz2bT774JgHqkpm2Qqk241NWw9OfU4KSZPW9ygp7yya3idT9McL1N79B23RSU//utO/5 Y7j3ImTw==; 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 1pzIcl-00DFwL-0L for linux-arm-kernel@lists.infradead.org; Wed, 17 May 2023 14:59:32 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-ba22ced2e95so901453276.1 for <linux-arm-kernel@lists.infradead.org>; Wed, 17 May 2023 07:59:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684335569; x=1686927569; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=u+zByxDvprri5VQ4rcxngDxyCTv45SqKQxUVZ6WFAl8=; b=X27m8yXNS7YV6hq/JvFNnMmsSFMgnEtC0lHw1MpIym8Oz6c4Uh3/VSQ674EJwhKX7y g+ShkfWDEvRemUvxzBBmHg3vE/oiulZ1PfCfm0aNIA1PzEJ16JjSsnB6OknUaX7SB6jO kl2dZgmmym+4sLYku6InDRWz/dDVbcjO3tCyB4wdjMLhTRT/jytO8BxlSVIt0dV5LqVT NDx2fLsz+IW0JLs18pk67UwQGZ/P02WShE/iW/ACZ/PzGR/Io89p2vdQKS2FDV4ya1p0 6w0mL+5iwwsh9PrtZf49Kaf3pCE/s6M95xtyuKHcXiVB8LQ9HqEntp8wL/I4uTp66pc1 m/0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684335569; x=1686927569; 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=u+zByxDvprri5VQ4rcxngDxyCTv45SqKQxUVZ6WFAl8=; b=WbJXeFOfSedrW1eJ6kpg44pTxGziSrmrr3guKR8J1uTejZzvtf1O6HZeCbusEWg9II ofrLyfByAbxxvw6ZPUL4wjq9Tx24s6ch7iwOgsu7sF29jhGkOaJKCI2jjql8rMz9dag3 pcRPIr+kW8PsZEnP1cKuDuY91h5Ho9gmfe/yMp1pay2uTpvGEmdDi2uJYNdBR/6bqqc3 IfhS5qzyq06TuoLNjld6AU6R6SQPpx3PShIYTprbEJwztum0bbCvCqL5kGvCknav+rJ/ wZITGNX/V4j/HJXdfg7arnLP+rgmMxVpZ0LvQ3szlf7TafOkRJDC9CQVp4oAgNsH9feW oGHw== X-Gm-Message-State: AC+VfDy8UDBcfKZ6sFqD9Nk4yPDtsJMVeH0hfGUM3RJB2W3j5AVFhIqb enS/ri2izzMsyyq0PVXAv1+JKVMBikTm X-Google-Smtp-Source: ACHHUZ7UAVxBOYG/LDa6oMf6ainre+wvdt+4UDdQcxKK96Oxl+o3GriG5mOavr8wBDR/SEMUEAtw4PpK7pvH X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:628b:7e78:d09b:39b]) (user=irogers job=sendgmr) by 2002:a05:6902:1890:b0:b96:7676:db4a with SMTP id cj16-20020a056902189000b00b967676db4amr26507169ybb.0.1684335569499; Wed, 17 May 2023 07:59:29 -0700 (PDT) Date: Wed, 17 May 2023 07:58:03 -0700 In-Reply-To: <20230517145803.559429-1-irogers@google.com> Message-Id: <20230517145803.559429-24-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 23/23] 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>, 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_155931_275178_D003A798 X-CRM114-Status: GOOD ( 15.27 ) 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 331c6ad40504..bfb659fa7274 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, &uncore_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(-)