Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1013917rwb; Fri, 23 Sep 2022 07:11:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fS95CpVd+K2JAqpw8lVqHdjorkPz8mvAKfQ3rjB7BUluzlBCSfcyKOEcqhCy0TOphNm74 X-Received: by 2002:a05:6402:14cb:b0:452:f1b4:7e52 with SMTP id f11-20020a05640214cb00b00452f1b47e52mr8422872edx.177.1663942296932; Fri, 23 Sep 2022 07:11:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663942296; cv=none; d=google.com; s=arc-20160816; b=QIPR7jybG1u0psN3EPfApLnOjnynNS1qiatSua8wdr4yK6uDUCIsGjEI5hW1po5JqV K8MSnbAtb4rcFeQ/a7BT0/YpkD0oyPoAWcY0k1I0ulMNTxV4/dytRl44LWdv/A6jj+Wg SVlmBX019OI87XEPuuenFWkuiPpSFHRSaaZhBo0FNvvKmj1emLjCWOL7mOcCXRcG/BBN ClCqHxdMsBs0mGu2TzNFtTVr/uzW1+cnLug39fsfmtLd5SL1n1mwZNVynsjgUar2yvqA YXfN/HqJ5/UTg1/hR4wMCjIGXSITKKW6PVzQzELxkyrt3JvmkM3uyBooGkHX54GvZiuX Iwxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id; bh=xQE06RPalfeDf1lHBEIJRMAHqZgu6Nfm248nUg7q9e8=; b=HUzJ3TXvL/wHxJ7AU0xvzm7UImu1mY/JFXtnOaLcrj/iV2Op0KAEmfSCBkHvQW6wYI PhCBB2sCTjsJpyxR1WxZClqX8JoUMONPiTIa4cccza16gbaN9hHupmq2PdbCQuC0YWZy 0MjzirWTz/E6jmset/DWFubcJdVRJiSXSXQhJeEiFu8LsGeRFus7b3jCOCXkIsICaFCz Ib7wuT8P2Eigg7bBYtUAsadl1QXQE6IPjxc4Z9PR4iWrgTuM8tW42y5P2cZiDMlKmBPT ifzVOMvhMDQJJrLsPjvMm3erXj2Inr1OAe+MkEBL5FtOMjIj2W/uhOVJxonDlE5t/Fhh ms/A== 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=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a0564021e9100b004511d552be3si9574962edf.4.2022.09.23.07.11.11; Fri, 23 Sep 2022 07:11:36 -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=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231756AbiIWNvu (ORCPT + 99 others); Fri, 23 Sep 2022 09:51:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230328AbiIWNvr (ORCPT ); Fri, 23 Sep 2022 09:51:47 -0400 Received: from out30-42.freemail.mail.aliyun.com (out30-42.freemail.mail.aliyun.com [115.124.30.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1A84128894 for ; Fri, 23 Sep 2022 06:51:45 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0VQXAnA7_1663941100; Received: from 30.240.121.51(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0VQXAnA7_1663941100) by smtp.aliyun-inc.com; Fri, 23 Sep 2022 21:51:41 +0800 Message-ID: Date: Fri, 23 Sep 2022 21:51:40 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 From: Shuai Xue Subject: Re: [PATCH v1 1/3] docs: perf: Add description for Synopsys DesignWare PCIe PMU driver To: Will Deacon Cc: Jonathan.Cameron@Huawei.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, rdunlap@infradead.org, robin.murphy@arm.com, mark.rutland@arm.com, baolin.wang@linux.alibaba.com, zhuo.song@linux.alibaba.com References: <20220917121036.14864-1-xueshuai@linux.alibaba.com> <20220917121036.14864-2-xueshuai@linux.alibaba.com> <20220922132543.GA12095@willie-the-truck> Content-Language: en-US In-Reply-To: <20220922132543.GA12095@willie-the-truck> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL 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 在 2022/9/22 PM9:25, Will Deacon 写道: > On Sat, Sep 17, 2022 at 08:10:34PM +0800, Shuai Xue wrote: >> Alibaba's T-Head Yitan 710 SoC is built on Synopsys' widely deployed and >> silicon-proven DesignWare Core PCIe controller which implements 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 >> --- >> .../admin-guide/perf/dwc_pcie_pmu.rst | 61 +++++++++++++++++++ >> Documentation/admin-guide/perf/index.rst | 1 + >> 2 files changed, 62 insertions(+) >> create mode 100644 Documentation/admin-guide/perf/dwc_pcie_pmu.rst >> >> diff --git a/Documentation/admin-guide/perf/dwc_pcie_pmu.rst b/Documentation/admin-guide/perf/dwc_pcie_pmu.rst >> new file mode 100644 >> index 000000000000..fbcbf10b23b7 >> --- /dev/null >> +++ b/Documentation/admin-guide/perf/dwc_pcie_pmu.rst >> @@ -0,0 +1,61 @@ >> +====================================================================== >> +Synopsys DesignWare Cores (DWC) PCIe Performance Monitoring Unit (PMU) >> +====================================================================== >> + >> +DesignWare Cores (DWC) PCIe PMU >> +=============================== >> + >> +To facilitate collection of statistics, Synopsys DesignWare Cores PCIe >> +controller provides the following two features: >> + >> +- Time Based Analysis (RX/TX data throughput and time spent in each >> + low-power LTSSM state) >> +- Lane Event counters (Error and Non-Error for lanes) >> + >> +The PMU is not a PCIe Root Complex integrated End Point (RCiEP) device but >> +only register counters provided by each PCIe Root Port. >> + >> +Time Based Analysis >> +------------------- >> + >> +Using this feature you can obtain information regarding RX/TX data >> +throughput and time spent in each low-power LTSSM state by the controller. >> + >> +The counters are 64-bit width and measure data in two categories, >> + >> +- percentage of time does the controller stay in LTSSM state in a >> + configurable duration. The measurement range of each Event in Group#0. >> +- amount of data processed (Units of 16 bytes). The measurement range of >> + each Event in Group#1. >> + >> +Lane Event counters >> +------------------- >> + >> +Using this feature you can obtain Error and Non-Error information in >> +specific lane by the controller. >> + >> +The counters are 32-bit width and the measured event is select by: >> + >> +- Group i >> +- Event j within the Group i >> +- and Lank k >> + >> +Some of the event counters only exist for specific configurations. >> + >> +DesignWare Cores (DWC) PCIe PMU Driver >> +======================================= >> + >> +This driver add PMU devices for each PCIe Root Port. And the PMU device is >> +named based the BDF of Root Port. For example, >> + >> + 10:00.0 PCI bridge: Device 1ded:8000 (rev 01) >> + >> +the PMU device name for this Root Port is pcie_bdf_100000. >> + >> +Example usage of counting PCIe RX TLP data payload (Units of 16 bytes):: >> + >> + $# perf stat -a -e pcie_bdf_200/Rx_PCIe_TLP_Data_Payload/ > > Do you really need to expose a separate PMU instance to userspace for each > BDF? I think it would be much cleaner if you could follow the approach used > by hisilicon/hisi_pcie_pmu.c and hide these details in the driver, exposing > a `bdf=' selector to userspace instead. Thank you for your valuable comments. It's a good idea to encode bdf in bitmap and exposing a `bdf=' selector to userspace. The problem of bdf selector is that the user need to compute bdf from lanes, do you think it is user friendly? I'm worried about increasing the burden of users. Best Regards Shuai