From nobody Fri Feb 13 14:09:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBE8FCE7A89 for ; Mon, 25 Sep 2023 06:21:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232287AbjIYGVN (ORCPT ); Mon, 25 Sep 2023 02:21:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232182AbjIYGUQ (ORCPT ); Mon, 25 Sep 2023 02:20:16 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EE6B10B; Sun, 24 Sep 2023 23:20:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695622806; x=1727158806; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=muM7uZMr//PCO+KA31xv1iKaa858JTpwH1cfwEAPiCk=; b=myA9M9qgT0WJBsYnhbnF7BUne/embUOsnXniwvC7JcSUrNwdipL87QGZ /2C6nfYvMMkiJhuzlFeOdBjdE3mDTKK3QEhsD98qYFNGga+kt3Djdstos nJ2QTfwLUwaQCTH2+by/cmGX5M0gN/t3SICKS0wUu5rYOxaEgQ8CkATpl nuG0XbODIrv72e8ZRoiWNVST7zjGiIEQgU34bnGlB2FtsuFM4MFIwq96u Q4xxTdRA0B79VLY8PhD7eGyoUoXVjCoKkdEGVMCmiGYV+uYc8k48qdHtX evqYU/QvD0NPQplUq6GQilCA89AIbxl0CEJG//zFXUzvXeoWyVxE2MSF1 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="445279540" X-IronPort-AV: E=Sophos;i="6.03,174,1694761200"; d="scan'208";a="445279540" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2023 23:19:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="818494410" X-IronPort-AV: E=Sophos;i="6.03,174,1694761200"; d="scan'208";a="818494410" Received: from b49691a75598.jf.intel.com ([10.54.34.22]) by fmsmga004.fm.intel.com with ESMTP; 24 Sep 2023 23:19:22 -0700 From: weilin.wang@intel.com To: weilin.wang@intel.com, Ian Rogers , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Kan Liang Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Perry Taylor , Samantha Alt , Caleb Biggers , Mark Rutland Subject: [RFC PATCH 19/25] perf stat: Handle grouping method fall back in hardware-grouping Date: Sun, 24 Sep 2023 23:18:18 -0700 Message-Id: <20230925061824.3818631-20-weilin.wang@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230925061824.3818631-1-weilin.wang@intel.com> References: <20230925061824.3818631-1-weilin.wang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Weilin Wang Add fall back to normal grouping when hardware aware grouping return with err so that perf stat still executes and returns with correct result. Signed-off-by: Weilin Wang --- tools/perf/util/metricgroup.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index 1086da84c..c027c0351 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -2054,7 +2054,7 @@ static int create_grouping(struct list_head *pmu_info= _list, LIST_HEAD(groups); char *bit_buf =3D malloc(NR_COUNTERS); =20 - //TODO: for each new core group, we should consider to add events that us= es fixed counters + //TODO: for each new core group, we could consider to add events that use= s fixed counters list_for_each_entry(e, event_info_list, nd) { bitmap_scnprintf(e->counters, NR_COUNTERS, bit_buf, NR_COUNTERS); pr_debug("Event name %s, [pmu]=3D%s, [counters]=3D%s, [taken_alone]=3D%d= \n", @@ -2573,13 +2573,15 @@ int metricgroup__parse_groups(struct evlist *perf_e= vlist, if (!table) return -EINVAL; if (hardware_aware_grouping) { + int ret; pr_debug("Use hardware aware grouping instead of traditional metric grou= ping method\n"); - return hw_aware_parse_groups(perf_evlist, pmu, str, + ret =3D hw_aware_parse_groups(perf_evlist, pmu, str, metric_no_threshold, user_requested_cpu_list, system_wide, /*fake_pmu=3D*/NULL, metric_events, table); + if (!ret) + return 0; } =20 - return parse_groups(perf_evlist, pmu, str, metric_no_group, metric_no_mer= ge, metric_no_threshold, user_requested_cpu_list, system_wide, /*fake_pmu=3D*/NULL, metric_events, table); --=20 2.39.3