Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4478167imw; Tue, 19 Jul 2022 07:21:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1taUcLA8qo7rUVx9FGRLU+Rg1tWvlsZintB4WX0cNwQ1w195SwuT6giu5VM+18bc37adgM/ X-Received: by 2002:a17:90b:4d07:b0:1ef:521c:f051 with SMTP id mw7-20020a17090b4d0700b001ef521cf051mr45189925pjb.164.1658240497975; Tue, 19 Jul 2022 07:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658240497; cv=none; d=google.com; s=arc-20160816; b=PT3aN7auxiY0S0ZXkUrzlG5isKtKax5fSHDdXXJDaoUrgSCrffeXgYEoNjUvA0ESpF 5CeMjGunZlt+GqspL8L+8uD+AdqIfbHV1OK8oN5PMClc3aI6CetmNrfbfRluEfNrlmDb MR1L0ioOZDPeoV9Eey1I27s+NaW4UZPBYKkWRxXcTYG6/hWVHg0tr8Z3gw0Xv9EsczZ7 NVv90hayTGMY4lzyMkpF5tWmPot/rInvlgMeC/3lmtO1WMZGVLFbB7+yz/Sb4Z/bAdIQ u9RwKKWAZVf749ZQKEL/730UIu3xyxZ22Pa0KlBxYEHPBybBpC+WyMIC40ARGGytKrPr PdWQ== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=hC6zWReE+Ftgexgsy37Pg7rHLwGjhSmuwvVjW5MbtRg=; b=zcbIAYC87OJNmWxKf3VemIQIWC+PEsqo0kYFHi2UePC/MXG6cLhSc7bexv4Nm8KNYR tE/m3Y8xoCWrs/T9PJYlq43C59vW2pZzM8tJyG2ZIBix5ihFBFuEe7CLtA5s4d0iP7Ns dGl1VOy1IhE0DNeVJsSMDyeWtX9gnCxEh/xZR7Rc+lZRP4MKk7NtPwyBWzdqz9Q2M7IZ aGfWqRrYVglAHVKlAobn6v+/KQKhOFz7YeheyFCZCAaEtdiLWN9W/TDoV7cUnfMlm0VW OYdli7Fb660KNkXfZ37Ht51Zvqvt5lhit1sAPTIq+d4NqfGvecIbQ/g9DQ1btT/QmsF8 1y9A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l187-20020a6391c4000000b0041a4f434cecsi1732890pge.798.2022.07.19.07.21.22; Tue, 19 Jul 2022 07:21:37 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243548AbiGSNS2 (ORCPT + 99 others); Tue, 19 Jul 2022 09:18:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239896AbiGSNSF (ORCPT ); Tue, 19 Jul 2022 09:18:05 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B38541A833 for ; Tue, 19 Jul 2022 05:35:14 -0700 (PDT) Received: from fraeml736-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LnJ9d5MjBz67VCj; Tue, 19 Jul 2022 20:31:49 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml736-chm.china.huawei.com (10.206.15.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 19 Jul 2022 14:35:12 +0200 Received: from localhost (10.81.209.49) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 19 Jul 2022 13:35:11 +0100 Date: Tue, 19 Jul 2022 13:35:09 +0100 From: Jonathan Cameron To: Shuai Xue CC: , , , , , , , Subject: Re: [RESEND PATCH v2 1/3] docs: perf: Add description for Alibaba's T-Head PMU driver Message-ID: <20220719133509.00006ee9@Huawei.com> In-Reply-To: <20220715151310.90091-2-xueshuai@linux.alibaba.com> References: <20220617111825.92911-1-xueshuai@linux.alibaba.com> <20220715151310.90091-2-xueshuai@linux.alibaba.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.81.209.49] X-ClientProxiedBy: lhreml749-chm.china.huawei.com (10.201.108.199) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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 On Fri, 15 Jul 2022 23:13:08 +0800 Shuai Xue wrote: > Alibaba's T-Head SoC implements uncore PMU for performance and functional > debugging to facilitate system maintenance. Document it to provide guidance > on how to use it. > > Signed-off-by: Shuai Xue I'm far from an expert on this, but looks good to me. Reviewed-by: Jonathan Cameron > --- > .../admin-guide/perf/alibaba_pmu.rst | 100 ++++++++++++++++++ > Documentation/admin-guide/perf/index.rst | 1 + > 2 files changed, 101 insertions(+) > create mode 100644 Documentation/admin-guide/perf/alibaba_pmu.rst > > diff --git a/Documentation/admin-guide/perf/alibaba_pmu.rst b/Documentation/admin-guide/perf/alibaba_pmu.rst > new file mode 100644 > index 000000000000..11de998bb480 > --- /dev/null > +++ b/Documentation/admin-guide/perf/alibaba_pmu.rst > @@ -0,0 +1,100 @@ > +============================================================= > +Alibaba's T-Head SoC Uncore Performance Monitoring Unit (PMU) > +============================================================= > + > +The Yitian 710, custom-built by Alibaba Group's chip development business, > +T-Head, implements uncore PMU for performance and functional debugging to > +facilitate system maintenance. > + > +DDR Sub-System Driveway (DRW) PMU Driver > +========================================= > + > +Yitian 710 employs eight DDR5/4 channels, four on each die. Each DDR5 channel > +is independent of others to service system memory requests. And one DDR5 > +channel is split into two independent sub-channels. The DDR Sub-System Driveway > +implements separate PMUs for each sub-channel to monitor various performance > +metrics. > + > +The Driveway PMU devices are named as ali_drw_ with perf. > +For example, ali_drw_21000 and ali_drw_21080 are two PMU devices for two > +sub-channels of the same channel in die 0. And the PMU device of die 1 is > +prefixed with ali_drw_400XXXXX, e.g. ali_drw_40021000. > + > +Each sub-channel has 36 PMU counters in total, which is classified into > +four groups: > + > +- Group 0: PMU Cycle Counter. This group has one pair of counters > + pmu_cycle_cnt_low and pmu_cycle_cnt_high, that is used as the cycle count > + based on DDRC core clock. > + > +- Group 1: PMU Bandwidth Counters. This group has 8 counters that are used > + to count the total access number of either the eight bank groups in a > + selected rank, or four ranks separately in the first 4 counters. The base > + transfer unit is 64B. > + > +- Group 2: PMU Retry Counters. This group has 10 counters, that intend to > + count the total retry number of each type of uncorrectable error. > + > +- Group 3: PMU Common Counters. This group has 16 counters, that are used > + to count the common events. > + > +For now, the Driveway PMU driver only uses counters in group 0 and group 3. > + > +The DDR Controller (DDRCTL) and DDR PHY combine to create a complete solution > +for connecting an SoC application bus to DDR memory devices. The DDRCTL > +receives transactions Host Interface (HIF) which is custom-defined by Synopsys. > +These transactions are queued internally and scheduled for access while > +satisfying the SDRAM protocol timing requirements, transaction priorities, and > +dependencies between the transactions. The DDRCTL in turn issues commands on > +the DDR PHY Interface (DFI) to the PHY module, which launches and captures data > +to and from the SDRAM. The driveway PMUs have hardware logic to gather > +statistics and performance logging signals on HIF, DFI, etc. > + > +By counting the READ, WRITE and RMW commands sent to the DDRC through the HIF > +interface, we could calculate the bandwidth. Example usage of counting memory > +data bandwidth:: > + > + perf stat \ > + -e ali_drw_21000/hif_wr/ \ > + -e ali_drw_21000/hif_rd/ \ > + -e ali_drw_21000/hif_rmw/ \ > + -e ali_drw_21000/cycle/ \ > + -e ali_drw_21080/hif_wr/ \ > + -e ali_drw_21080/hif_rd/ \ > + -e ali_drw_21080/hif_rmw/ \ > + -e ali_drw_21080/cycle/ \ > + -e ali_drw_23000/hif_wr/ \ > + -e ali_drw_23000/hif_rd/ \ > + -e ali_drw_23000/hif_rmw/ \ > + -e ali_drw_23000/cycle/ \ > + -e ali_drw_23080/hif_wr/ \ > + -e ali_drw_23080/hif_rd/ \ > + -e ali_drw_23080/hif_rmw/ \ > + -e ali_drw_23080/cycle/ \ > + -e ali_drw_25000/hif_wr/ \ > + -e ali_drw_25000/hif_rd/ \ > + -e ali_drw_25000/hif_rmw/ \ > + -e ali_drw_25000/cycle/ \ > + -e ali_drw_25080/hif_wr/ \ > + -e ali_drw_25080/hif_rd/ \ > + -e ali_drw_25080/hif_rmw/ \ > + -e ali_drw_25080/cycle/ \ > + -e ali_drw_27000/hif_wr/ \ > + -e ali_drw_27000/hif_rd/ \ > + -e ali_drw_27000/hif_rmw/ \ > + -e ali_drw_27000/cycle/ \ > + -e ali_drw_27080/hif_wr/ \ > + -e ali_drw_27080/hif_rd/ \ > + -e ali_drw_27080/hif_rmw/ \ > + -e ali_drw_27080/cycle/ -- sleep 10 > + > +The average DRAM bandwidth can be calculated as follows: > + > +- Read Bandwidth = perf_hif_rd * DDRC_WIDTH * DDRC_Freq / DDRC_Cycle > +- Write Bandwidth = (perf_hif_wr + perf_hif_rmw) * DDRC_WIDTH * DDRC_Freq / DDRC_Cycle > + > +Here, DDRC_WIDTH = 64 bytes. > + > +The current driver does not support sampling. So "perf record" is > +unsupported. Also attach to a task is unsupported as the events are all > +uncore. > diff --git a/Documentation/admin-guide/perf/index.rst b/Documentation/admin-guide/perf/index.rst > index 69b23f087c05..823db08863db 100644 > --- a/Documentation/admin-guide/perf/index.rst > +++ b/Documentation/admin-guide/perf/index.rst > @@ -17,3 +17,4 @@ Performance monitor support > xgene-pmu > arm_dsu_pmu > thunderx2-pmu > + alibaba_pmu