Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4979366rdb; Tue, 12 Dec 2023 15:27:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IGYxz81ZEL8hu3kCHE+1+qJaob7fmg0MALgQNXmSinm+6yWh8SEd/kyp8fhMTnNnu+PfZur X-Received: by 2002:a05:6a21:328b:b0:184:da23:76b2 with SMTP id yt11-20020a056a21328b00b00184da2376b2mr9352801pzb.28.1702423624760; Tue, 12 Dec 2023 15:27:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702423624; cv=none; d=google.com; s=arc-20160816; b=te0VnNfsGgqzeJi508G342yXtQkkpBLrAgN0Ps3SMmFkLyilGdOErat70BIA3K7gnQ 0w6MreIsCXj8y5euF1m+Lk4UfKN2Ha23uiaQbaMMnizO4d78h45bDI3tAfol4bWKOuHp +jj74l1BO7PSf2dDQZCuQsnEIIEhVKiGqKlXMlWKn8LkU5rchepJx2Lt89w8UHT4oGzx ul3RLEca+JZcZoUjMQTxejV1sW8tjYo7e71pwTwfcEUTMDGNQM70NfB5Ikm/ZafncVyX amCn3f5fiKUfz+z47pboAuNcjhT9nisIqM5ZCQSzJYI2WLG7YANMhxdzl1wmHUhgrspj //Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=qrt2s01oMZVD4mhR15uTSmxZTKdPalmcYJucqtImqko=; fh=ZWraEf5Qm7BHJeckG5Ereq4+e7KUVKfmTPl2jlKE6rw=; b=rqTCpYS9u9PD3raAik9TS6fWbiK0dE248WNmwLcsvK5layeiyqkSJqeSSq4cTyM9Rd Sf9Kld+dGib9A4HxBAebBWHzEP97ZglbBg51s5zwe/3KeX0lxmh6/ASvVImqsFMJhqsd f0HEazRcELWCfFwdhQMG2y1VTlwZwpO8ML614u0HLMB2IFyV3gs0U9HRu+q8Euxfc3jq W9HB1qv/sG4zQmajvKAKWAHD4DFIMFclwaSGNv23h/J8eK86zcJApcNVd5PeSQwz3yV2 tBGGGxfMyQHUUv2kFuo9rWUNBt7QVJcqIu/3l5hG6yEsDaS49cT8A6EW7rAsm/qpKoeF qFGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XN+XxYf3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id f20-20020a631014000000b005c68d9545b9si8242657pgl.619.2023.12.12.15.27.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 15:27:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XN+XxYf3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id E1A9D80A9E20; Tue, 12 Dec 2023 15:26:51 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232633AbjLLX0g (ORCPT + 99 others); Tue, 12 Dec 2023 18:26:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231461AbjLLX0e (ORCPT ); Tue, 12 Dec 2023 18:26:34 -0500 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB2A09B for ; Tue, 12 Dec 2023 15:26:40 -0800 (PST) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-50beed2a46eso1497e87.0 for ; Tue, 12 Dec 2023 15:26:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1702423599; x=1703028399; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=qrt2s01oMZVD4mhR15uTSmxZTKdPalmcYJucqtImqko=; b=XN+XxYf31SslepDApLBoMqqnVxyZIchqVOjOoP0ufTpTIHCjfRoRmCxIvcocJkDyNn 26EHQaMb95eOPy0VN5g5TnjitrXuemhFU9FDULXohLuj0eaF6EVQ/AO8bvZAiunE8bN4 AMg/TAhFyRwOlfWGuT9LW3+E8GvcsPjVwfMmyoPKjg/cZScoEoWWe7KIEy15NaKrdQ8G TA4o6JzgSd+VpQfMV2jsYUhhFCXP1r4eKt0FSLSpESEDRtbsFHsg4YnyjiIsY2ex3hpu M9Kjgep6QLnDq+jLmDZTLOd7P1KH09QgWbJE48oG6K5KMOcSTpeUv7IN2vvjGHKIhMkV 5xSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702423599; x=1703028399; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qrt2s01oMZVD4mhR15uTSmxZTKdPalmcYJucqtImqko=; b=ACXGXl4sPPn6CmMkHFuXafHcsj2j+vK3kEEYt8poiQ6SEoCo94C4jOPArvTnzfwZzZ VK3k6NSPZiQwy+q4vObRA02QJ75NzjWuk8VDru74KLXDCMmOP9cz60n+GUhHzGdaVJZG RBcZNmoQ4zoYjtR1w8nCOvTJ5NYTuSJ1AC2OZhOk91Rdn1ArVb2WyHZUO8b9k2YyF6J2 QmxZER14G+JTjTa2+PxHG1lVDwe/MRp9jBQsaRGYZuvqnGy+Q6H/1dKMnlPiuEJGh8l+ LXsrrI1L+H9//WFeJImjiYrcF9+cHDowGEz7N4WHTMUSDlbnPz3tqgcSHYHef9+4dGif 1h0w== X-Gm-Message-State: AOJu0YwzX6+GVxTJJ7klbxw+ydptTs3p+fiiKO82B8I0sZqOfQyA4XUi z9aYpqAZnR8ZY5lvjpf91lJATOw75vZ6Jba4mEQ+bg== X-Received: by 2002:a05:6512:6c9:b0:50d:1a0e:ce06 with SMTP id u9-20020a05651206c900b0050d1a0ece06mr226121lff.5.1702423598909; Tue, 12 Dec 2023 15:26:38 -0800 (PST) MIME-Version: 1.0 References: <20231212230224.1473300-1-weilin.wang@intel.com> <20231212230224.1473300-2-weilin.wang@intel.com> In-Reply-To: <20231212230224.1473300-2-weilin.wang@intel.com> From: Ian Rogers Date: Tue, 12 Dec 2023 15:26:27 -0800 Message-ID: Subject: Re: [RFC PATCH v3 01/18] perf stat: Add new field in stat_config to enable hardware aware grouping. To: weilin.wang@intel.com Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Perry Taylor , Samantha Alt , Caleb Biggers , Mark Rutland , Yang Jihong Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Tue, 12 Dec 2023 15:26:52 -0800 (PST) On Tue, Dec 12, 2023 at 3:02=E2=80=AFPM wrote: > > From: Weilin Wang > > Hardware counter and event information could be used to help creating eve= nt > groups that better utilize hardware counters and improve multiplexing. > > Signed-off-by: Weilin Wang Reviewed-by: Ian Rogers > --- > tools/perf/builtin-stat.c | 8 ++++++++ > tools/perf/util/metricgroup.c | 5 +++++ > tools/perf/util/metricgroup.h | 1 + > tools/perf/util/stat.h | 1 + > 4 files changed, 15 insertions(+) > > diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c > index d8e5d6f7a87a..a7a8018c3511 100644 > --- a/tools/perf/builtin-stat.c > +++ b/tools/perf/builtin-stat.c > @@ -2061,6 +2061,7 @@ static int add_default_attributes(void) > stat_config.metric_no_thr= eshold, > stat_config.user_requeste= d_cpu_list, > stat_config.system_wide, > + stat_config.hardware_awar= e_grouping, > &stat_config.metric_event= s); > } > > @@ -2094,6 +2095,7 @@ static int add_default_attributes(void) > stat_config.metric_no_thr= eshold, > stat_config.user_requeste= d_cpu_list, > stat_config.system_wide, > + stat_config.hardware_awar= e_grouping, > &stat_config.metric_event= s); > } > > @@ -2128,6 +2130,7 @@ static int add_default_attributes(void) > /*metric_no_threshold=3D*= /true, > stat_config.user_requeste= d_cpu_list, > stat_config.system_wide, > + stat_config.hardware_awar= e_grouping, > &stat_config.metric_event= s) < 0) > return -1; > } > @@ -2169,6 +2172,7 @@ static int add_default_attributes(void) > /*metric_no_thres= hold=3D*/true, > stat_config.user_= requested_cpu_list, > stat_config.syste= m_wide, > + stat_config.hardw= are_aware_grouping, > &stat_config.metr= ic_events) < 0) > return -1; > > @@ -2502,6 +2506,9 @@ int cmd_stat(int argc, const char **argv) > (const char **) stat_usage, > PARSE_OPT_STOP_AT_NON_OPTION); > > + /* Set hardware_aware_grouping to false on default before complet= ely enable it.*/ > + stat_config.hardware_aware_grouping =3D false; nit: we don't normally zero values like this as the curly brace initializer will implicitly zero all non named values being initialized. Thanks, Ian > + > if (stat_config.csv_sep) { > stat_config.csv_output =3D true; > if (!strcmp(stat_config.csv_sep, "\\t")) > @@ -2702,6 +2709,7 @@ int cmd_stat(int argc, const char **argv) > stat_config.metric_no_threshold, > stat_config.user_requested_cpu_li= st, > stat_config.system_wide, > + stat_config.hardware_aware_groupi= ng, > &stat_config.metric_events); > zfree(&metrics); > } > diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.= c > index 0484736d9fe4..dfbcdb517b78 100644 > --- a/tools/perf/util/metricgroup.c > +++ b/tools/perf/util/metricgroup.c > @@ -1690,12 +1690,17 @@ int metricgroup__parse_groups(struct evlist *perf= _evlist, > bool metric_no_threshold, > const char *user_requested_cpu_list, > bool system_wide, > + bool hardware_aware_grouping, > struct rblist *metric_events) > { > const struct pmu_metrics_table *table =3D pmu_metrics_table__find= (); > > if (!table) > return -EINVAL; > + if (hardware_aware_grouping) { > + pr_debug("Use hardware aware grouping instead of traditio= nal metric grouping method\n"); > + } > + > > return parse_groups(perf_evlist, pmu, str, metric_no_group, metri= c_no_merge, > metric_no_threshold, user_requested_cpu_list,= system_wide, > diff --git a/tools/perf/util/metricgroup.h b/tools/perf/util/metricgroup.= h > index d5325c6ec8e1..779f6ede1b51 100644 > --- a/tools/perf/util/metricgroup.h > +++ b/tools/perf/util/metricgroup.h > @@ -77,6 +77,7 @@ int metricgroup__parse_groups(struct evlist *perf_evlis= t, > bool metric_no_threshold, > const char *user_requested_cpu_list, > bool system_wide, > + bool hardware_aware_grouping, > struct rblist *metric_events); > int metricgroup__parse_groups_test(struct evlist *evlist, > const struct pmu_metrics_table *table, > diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h > index 325d0fad1842..f97d6282ba3d 100644 > --- a/tools/perf/util/stat.h > +++ b/tools/perf/util/stat.h > @@ -87,6 +87,7 @@ struct perf_stat_config { > bool metric_no_group; > bool metric_no_merge; > bool metric_no_threshold; > + bool hardware_aware_grouping; > bool stop_read_counter; > bool iostat_run; > char *user_requested_cpu_list; > -- > 2.39.3 >