Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp36996562rwd; Tue, 11 Jul 2023 08:11:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlE/8HU9myGvx+KGj6uufB+7X9PpYZnkn5MRSDJYRJg+A8kxardEjWqs/ZnCAEfcJ4QxvP3m X-Received: by 2002:a05:6402:3449:b0:51e:1837:d5be with SMTP id l9-20020a056402344900b0051e1837d5bemr17651049edc.24.1689088303150; Tue, 11 Jul 2023 08:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689088303; cv=none; d=google.com; s=arc-20160816; b=AnoPliEhCSenpYHasK0RcP186x0BugiNONEwXvFdGOeQbDBaAdGfwnBNkFdNOSS1Kg V/uUfyfBcL6ofBGBMH35hnc+xX+gLz2wsrc4ivjw/R47SZqp0BsyTvdICFqDCFi/SsFS /YO2/zcjRWzy5mYjhx7HylIitfVtxkz/g+pmnYvOI5TOwz2jmT+Ayrw0jenVNsxgnJNh hhD26dAab7mNtl+ADCzhHVFMYpUGrZscjyo3rxpdLvoTM6Uodt0Tk5fNi3RnqJOblpTT rpL86xEJWHuBnRLMjEaa2s8bz3svEczZeaKY/2MMDwAJSqCR56VcTuBws2EWj1yXrVbg 3DjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=6chcOJpuz2JqdpKf+UPoqtyGs4qRKNs6kA670FW9dng=; fh=f/pVxM88+ZSgn6zG5v/y1dluY1Sw+La7SoIcGPDrk8o=; b=dAJ2YJb5lZA7OXB8fbD8LwGp4jtMQgTvF/nMyn6qmJ9k7suOpKn+xv6C9qQbhmKqtT d0AYBgotRlKk/0bG5kr6a8Dik7vzekczOkcDlhEHpbUo/5SyvOti2V5zZyaSXdmEcJ8y c8+wp0QfcKC8y6QKH3ix/qQTMKtdt5jl2vzxdIoIRqKLcl77fngPOFmEpTsWY0ClmCg2 KGeS8U/5p1cx76nni+XoiKbe3vajhuZUMt+hBNQbFjpL10DbGrDicK/FQj/pumUOIh/i vatn9EbZxxFugrFAVEO1wIFANXRMaRbiHhmpMpusBK+aObBoWVbtA0MMOtOPSccsrfhU v4/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FYvB+2U2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y6-20020aa7d506000000b0051e0d936760si2283419edq.14.2023.07.11.08.11.18; Tue, 11 Jul 2023 08:11:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FYvB+2U2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232695AbjGKOvd (ORCPT + 99 others); Tue, 11 Jul 2023 10:51:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232262AbjGKOvc (ORCPT ); Tue, 11 Jul 2023 10:51:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 966E81BB; Tue, 11 Jul 2023 07:51:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1B3E161515; Tue, 11 Jul 2023 14:51:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1590DC433C8; Tue, 11 Jul 2023 14:51:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689087090; bh=LDPCX11v0c+dpXVZwPUW42yYc1K3TuG9tgPfht12BYs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FYvB+2U2HPdqCadDwP3nP7YDwijECzeIGkL+aN6kAuknOwKCofyfz3p3NuMnl6tFd 2DV6Ijp6r4WF9J5iWOpBY++sjj3Wcz7+RD6ZuCCaTeD133A2Q6LTUuIcC0bgqh1AkV euZTmpCYNZN2AKcGl+iLQe/UqOdcDFQmwjWJa17oab1qO4VDuV7Jhj3M2aBcVnAKnB MBE9lnU4TGBGa1i4ljWAkSBPU+xakc0ni9Rv0J5/EhZ2zviHu9qh9LLeSFV3ISs8nG FPq3CNPbR1Ci2wjS7bsxkHCvY9Ny/32HR7c4644KKT7CD9t9NLOBnbSCYZPQJ1xzVM KcHtuqK3uypwA== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 78D5B40516; Tue, 11 Jul 2023 11:51:27 -0300 (-03) Date: Tue, 11 Jul 2023 11:51:27 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Sandipan Das , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, adrian.hunter@intel.com, ayush.jain3@amd.com, ananth.narayan@amd.com, ravi.bangoria@amd.com, santosh.shukla@amd.com Subject: Re: [PATCH v2] perf vendor events amd: Fix large metrics Message-ID: References: <20230706063440.54189-1-sandipan.das@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Jul 06, 2023 at 06:49:29AM -0700, Ian Rogers escreveu: > On Wed, Jul 5, 2023 at 11:34 PM Sandipan Das wrote: > > > > There are cases where a metric requires more events than the number of > > available counters. E.g. AMD Zen, Zen 2 and Zen 3 processors have four > > data fabric counters but the "nps1_die_to_dram" metric has eight events. > > By default, the constituent events are placed in a group and since the > > events cannot be scheduled at the same time, the metric is not computed. > > The "all metrics" test also fails because of this. > > > > Use the NO_GROUP_EVENTS constraint for such metrics which anyway expect > > the user to run perf with "--metric-no-group". > > > > E.g. > > > > $ sudo perf test -v 101 > > > > Before: > > > > 101: perf all metrics test : > > --- start --- > > test child forked, pid 37131 > > Testing branch_misprediction_ratio > > Testing all_remote_links_outbound > > Testing nps1_die_to_dram > > Metric 'nps1_die_to_dram' not printed in: > > Error: > > Invalid event (dram_channel_data_controller_4) in per-thread mode, enable system wide with '-a'. > > Testing macro_ops_dispatched > > Testing all_l2_cache_accesses > > Testing all_l2_cache_hits > > Testing all_l2_cache_misses > > Testing ic_fetch_miss_ratio > > Testing l2_cache_accesses_from_l2_hwpf > > Testing l2_cache_misses_from_l2_hwpf > > Testing op_cache_fetch_miss_ratio > > Testing l3_read_miss_latency > > Testing l1_itlb_misses > > test child finished with -1 > > ---- end ---- > > perf all metrics test: FAILED! > > > > After: > > > > 101: perf all metrics test : > > --- start --- > > test child forked, pid 43766 > > Testing branch_misprediction_ratio > > Testing all_remote_links_outbound > > Testing nps1_die_to_dram > > Testing macro_ops_dispatched > > Testing all_l2_cache_accesses > > Testing all_l2_cache_hits > > Testing all_l2_cache_misses > > Testing ic_fetch_miss_ratio > > Testing l2_cache_accesses_from_l2_hwpf > > Testing l2_cache_misses_from_l2_hwpf > > Testing op_cache_fetch_miss_ratio > > Testing l3_read_miss_latency > > Testing l1_itlb_misses > > test child finished with 0 > > ---- end ---- > > perf all metrics test: Ok > > > > Reported-by: Ayush Jain > > Suggested-by: Ian Rogers > > Signed-off-by: Sandipan Das > > Acked-by: Ian Rogers Thanks, applied. - Arnaldo > Will there be a PMU driver fix so that the perf_event_open fails for > the group? That way the weak group would work. > > Thanks, > Ian > > > --- > > > > Previous versions can be found at: > > v1: https://lore.kernel.org/all/20230614090710.680330-1-sandipan.das@amd.com/ > > > > Changes in v2: > > - As suggested by Ian, use the NO_GROUP_EVENTS constraint instead of > > retrying the test scenario with --metric-no-group. > > - Change the commit message accordingly. > > > > tools/perf/pmu-events/arch/x86/amdzen1/recommended.json | 3 ++- > > tools/perf/pmu-events/arch/x86/amdzen2/recommended.json | 3 ++- > > tools/perf/pmu-events/arch/x86/amdzen3/recommended.json | 3 ++- > > 3 files changed, 6 insertions(+), 3 deletions(-) > > > > diff --git a/tools/perf/pmu-events/arch/x86/amdzen1/recommended.json b/tools/perf/pmu-events/arch/x86/amdzen1/recommended.json > > index bf5083c1c260..4d28177325a0 100644 > > --- a/tools/perf/pmu-events/arch/x86/amdzen1/recommended.json > > +++ b/tools/perf/pmu-events/arch/x86/amdzen1/recommended.json > > @@ -169,8 +169,9 @@ > > }, > > { > > "MetricName": "nps1_die_to_dram", > > - "BriefDescription": "Approximate: Combined DRAM B/bytes of all channels on a NPS1 node (die) (may need --metric-no-group)", > > + "BriefDescription": "Approximate: Combined DRAM B/bytes of all channels on a NPS1 node (die)", > > "MetricExpr": "dram_channel_data_controller_0 + dram_channel_data_controller_1 + dram_channel_data_controller_2 + dram_channel_data_controller_3 + dram_channel_data_controller_4 + dram_channel_data_controller_5 + dram_channel_data_controller_6 + dram_channel_data_controller_7", > > + "MetricConstraint": "NO_GROUP_EVENTS", > > "MetricGroup": "data_fabric", > > "PerPkg": "1", > > "ScaleUnit": "6.1e-5MiB" > > diff --git a/tools/perf/pmu-events/arch/x86/amdzen2/recommended.json b/tools/perf/pmu-events/arch/x86/amdzen2/recommended.json > > index a71694a043ba..60e19456d4c8 100644 > > --- a/tools/perf/pmu-events/arch/x86/amdzen2/recommended.json > > +++ b/tools/perf/pmu-events/arch/x86/amdzen2/recommended.json > > @@ -169,8 +169,9 @@ > > }, > > { > > "MetricName": "nps1_die_to_dram", > > - "BriefDescription": "Approximate: Combined DRAM B/bytes of all channels on a NPS1 node (die) (may need --metric-no-group)", > > + "BriefDescription": "Approximate: Combined DRAM B/bytes of all channels on a NPS1 node (die)", > > "MetricExpr": "dram_channel_data_controller_0 + dram_channel_data_controller_1 + dram_channel_data_controller_2 + dram_channel_data_controller_3 + dram_channel_data_controller_4 + dram_channel_data_controller_5 + dram_channel_data_controller_6 + dram_channel_data_controller_7", > > + "MetricConstraint": "NO_GROUP_EVENTS", > > "MetricGroup": "data_fabric", > > "PerPkg": "1", > > "ScaleUnit": "6.1e-5MiB" > > diff --git a/tools/perf/pmu-events/arch/x86/amdzen3/recommended.json b/tools/perf/pmu-events/arch/x86/amdzen3/recommended.json > > index 988cf68ae825..3e9e1781812e 100644 > > --- a/tools/perf/pmu-events/arch/x86/amdzen3/recommended.json > > +++ b/tools/perf/pmu-events/arch/x86/amdzen3/recommended.json > > @@ -205,10 +205,11 @@ > > }, > > { > > "MetricName": "nps1_die_to_dram", > > - "BriefDescription": "Approximate: Combined DRAM B/bytes of all channels on a NPS1 node (die) (may need --metric-no-group)", > > + "BriefDescription": "Approximate: Combined DRAM B/bytes of all channels on a NPS1 node (die)", > > "MetricExpr": "dram_channel_data_controller_0 + dram_channel_data_controller_1 + dram_channel_data_controller_2 + dram_channel_data_controller_3 + dram_channel_data_controller_4 + dram_channel_data_controller_5 + dram_channel_data_controller_6 + dram_channel_data_controller_7", > > "MetricGroup": "data_fabric", > > "PerPkg": "1", > > + "MetricConstraint": "NO_GROUP_EVENTS", > > "ScaleUnit": "6.1e-5MiB" > > } > > ] > > -- > > 2.34.1 > > -- - Arnaldo