Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1460523rdh; Mon, 25 Sep 2023 13:34:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHabaIspnZjsav+8zfvLOeuVZDyCXbmw+GM+tlt9ra/UPAdo3PE2K/KEuVp1zaNUgxK68Nt X-Received: by 2002:a17:902:e882:b0:1b9:e241:ad26 with SMTP id w2-20020a170902e88200b001b9e241ad26mr9456941plg.9.1695674083845; Mon, 25 Sep 2023 13:34:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695674083; cv=none; d=google.com; s=arc-20160816; b=BRAE+5tNegk5ca4okIO7H7V4kyVhHMdUXC59FfAgY5Ag2J9tRZfy1JlU0SOXe7WJWK GCvLi6YV3UKdn+k7V/EWDodZnxqcw4n8gdPam9wdh4j1ScFQHoY8mFR6c9ANA9go54F6 83imbjtinTWDmm8QSUZ7dk2tLYE1JwahOzKQGDFT2mARA5gevVx9lEB4Y1h5XCoDTNOz wx8CoKNfA5X3wpJ9jVxv8qxVA0M6ocDyVACAtrULjIcwPR5KMosdDhnfLvVoETgNSvNP 31lIZGUypmqwuaibIOvcNWtFXhvtiyf5ofHfltqaaAFnvdZfs0IfkGMC5t60tNkX911l yK+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ols0ppH6UI74dFSn0ghrTaKGz0KxOTQspiG0HPvEG7k=; fh=aicQXd2sVDKynU70/92qv+8AnsPgYK5pq7fTzS41MP4=; b=ZZKv0kzPS1OBLgowDzLcHWkxidq4CgCgct0AsdisnLzsday77gVGpmxs8jatXgXFJc BIQnBKbhSBy+/wfpo9kViPD1sGUXZW8LACwTLbmCFfrLT22swq3ixCpxKyLbiWn2bxeH IqGWspOVk6FXbVmaqgRxBcvy8hluGDruZBndhaFQnXXqULt0NnRbfA8JWtE5Y946drgU hw+tOSt4e82oUMQAmiWdUkL1ThyffiecP2GulmfFyHFcc/trcQ3k4tSHVSEAvjzUp4B5 5jkQD8HPX7VAKItEzm4BjcHZWCRJyKG0yAF/ebklwaQlCp4hK1aQBgUoKR4muYAXIRw0 xIJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=myA9M9qg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id b1-20020a1709027e0100b001c60d6a620bsi4388022plm.95.2023.09.25.13.34.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 13:34:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=myA9M9qg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id B2102805363B; Sun, 24 Sep 2023 23:21:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232106AbjIYGVM (ORCPT + 99 others); Mon, 25 Sep 2023 02:21:12 -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: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sun, 24 Sep 2023 23:21:18 -0700 (PDT) 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 = malloc(NR_COUNTERS); - //TODO: for each new core group, we should consider to add events that uses fixed counters + //TODO: for each new core group, we could consider to add events that uses 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]=%s, [counters]=%s, [taken_alone]=%d\n", @@ -2573,13 +2573,15 @@ int metricgroup__parse_groups(struct evlist *perf_evlist, if (!table) return -EINVAL; if (hardware_aware_grouping) { + int ret; pr_debug("Use hardware aware grouping instead of traditional metric grouping method\n"); - return hw_aware_parse_groups(perf_evlist, pmu, str, + ret = hw_aware_parse_groups(perf_evlist, pmu, str, metric_no_threshold, user_requested_cpu_list, system_wide, /*fake_pmu=*/NULL, metric_events, table); + if (!ret) + return 0; } - return parse_groups(perf_evlist, pmu, str, metric_no_group, metric_no_merge, metric_no_threshold, user_requested_cpu_list, system_wide, /*fake_pmu=*/NULL, metric_events, table); -- 2.39.3