From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4BE947D936; Sat, 28 Feb 2026 17:33:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300013; cv=none; b=s0NW72qSeCjfOSDWCbJd10IkdlL6eam66dNQM9RgiGmIc+K9gOijMD3Iw4e1QF7u7izsLzqBTU+AD9wdQOeWAB+/8wAu2dTx2LIrSSFDTaUDvOfI1yUhxIFeZaxf/Xg4mhINX2vZQrfAM+gTL7bujuiJS15tLdnIP6ZDBFLyjKc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300013; c=relaxed/simple; bh=MYr2c1J4ADOsnfOTVMpeAwnhXCKn5YEPLHCPJdyqI2g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DLSUJb6Pyfi6CWS7DGRA/em14XA8R/zqkWAz8c55Hx4lJtdlPtUaHlFoLGvrUlolkLabT+x9yKVxCNvRdzm5JWPusS0zn47Q7LFOXSC6liSXCwO8Suk4DZm4OeMAbvlxcA1mELiGAIjOBQj4sG2rnq5+PpUEcgqlSpdFiLM4mwg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=s47DDAEL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="s47DDAEL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F838C116D0; Sat, 28 Feb 2026 17:33:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772300013; bh=MYr2c1J4ADOsnfOTVMpeAwnhXCKn5YEPLHCPJdyqI2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s47DDAELBfTi33vNHmnCnBHei7rS8CcENBF4HsMUQeajIzST7CyDauWp0roqvcrvh fd8jDl+VcWpZAFeWkkBxKoXU9nLyhdS8geYLwkdaAK7YlRS5uQi7ct31WhQeaLZimR 3HmR3ESgBk1VHE2PhGJ5+8+GlcT55W4/dDG6My8DwyzSZ0AG/AXQlm32+Mc6UHkycW kbvxCc8L/iGnCvTGgZRAb1JH7iuJS0YE2zQiutE9bxtKxBv7flTVhAsLZJt1fOItUs 3Ec/RaxudiQjeVYSX/ssy4SoePz62nKCDqMTcQE9SSRFHKFuHH5NSuS99nBSAIh9Sh 6Ae8B1e9Y+nsA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ian Rogers , Leo Yan , Adrian Hunter , Alexander Shishkin , Ingo Molnar , James Clark , Jiri Olsa , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 6.19 027/844] perf metricgroup: Don't early exit if no CPUID table exists Date: Sat, 28 Feb 2026 12:19:00 -0500 Message-ID: <20260228173244.1509663-28-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260228173244.1509663-1-sashal@kernel.org> References: <20260228173244.1509663-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Ian Rogers [ Upstream commit cee275edcdb1acfdc8270f80e96f30750b633220 ] The failure to find a table of metrics with a CPUID shouldn't early exit as the metric code will now also consider the default table. When searching for a metric or metric group, pmu_metrics_table__for_each_metric() considers all tables and so the caller doesn't need to switch the table to do this. Fixes: c7adeb0974f18da4 ("perf jevents: Add set of common metrics based on default ones") Reviewed-by: Leo Yan Signed-off-by: Ian Rogers Tested-by: Leo Yan Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Ian Rogers Cc: Ingo Molnar Cc: James Clark Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/metricgroup.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index 25c75fdbfc525..a21f2d4969c5c 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -1563,8 +1563,6 @@ int metricgroup__parse_groups(struct evlist *perf_evlist, { const struct pmu_metrics_table *table = pmu_metrics_table__find(); - if (!table) - return -EINVAL; if (hardware_aware_grouping) pr_debug("Use hardware aware grouping instead of traditional metric grouping method\n"); @@ -1602,22 +1600,16 @@ static int metricgroup__has_metric_or_groups_callback(const struct pmu_metric *p bool metricgroup__has_metric_or_groups(const char *pmu, const char *metric_or_groups) { - const struct pmu_metrics_table *tables[2] = { - pmu_metrics_table__find(), - pmu_metrics_table__default(), - }; + const struct pmu_metrics_table *table = pmu_metrics_table__find(); struct metricgroup__has_metric_data data = { .pmu = pmu, .metric_or_groups = metric_or_groups, }; - for (size_t i = 0; i < ARRAY_SIZE(tables); i++) { - if (pmu_metrics_table__for_each_metric(tables[i], - metricgroup__has_metric_or_groups_callback, - &data)) - return true; - } - return false; + return pmu_metrics_table__for_each_metric(table, + metricgroup__has_metric_or_groups_callback, + &data) + ? true : false; } static int metricgroup__topdown_max_level_callback(const struct pmu_metric *pm, -- 2.51.0