Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp264809pxb; Wed, 18 Aug 2021 01:37:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQCITLvQD4A7DhKk715Sq3dtAckb/72x1mfA2a4lEhUcBGa9tQ5Rnz/yGPgvQ7C/EkN+Tb X-Received: by 2002:a5d:8e11:: with SMTP id e17mr6326029iod.138.1629275859691; Wed, 18 Aug 2021 01:37:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629275859; cv=none; d=google.com; s=arc-20160816; b=Ei0GnPaxC1nf8u9QNncXN7HINtI6sgMadDQb3OU0oSpplONe/BxEuDCFMonpZ4N5gQ K9koznuHqiMhFX8bKjSlSb87m0A5Bhy0AH46R3AVJMyynTw2FTFn1dVY1fyOOsaLgYle aBveO5evdqsLVx0HaFGl1OCL/TXZhVveY5uWN+3A6x4S3+UNX2BCCdzR2zbM+xzDQ1b/ webNdn3httVcqEZsmfO/THCRV71X9mabBxxbCc5Hw2wQfMUqw09eWq6h0GDWUJ7mZaIH SAAXTErBvcX5p+Ff9ZIDa9FbYvVGhkS/lU83zHCKiyIe2SAaCHQmybXwd7DiIttCnLBc P7rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=yeDM1UEW0v0PCexf5hd+tdtN5r4u47rdnZ1KKkan31c=; b=R5EcY8tEAbUYq78MR8xrukcIrCAxwmJTYlvmnfo1IWopoj1Y6cLnm9jL6kERe84lEF tVkbartG1s0Kfr1KbLBegLc9FVSBQbzYIuArBPWN769z7y/lC7kXcztVFFP4CH8p4HiI Q0RDD9MsPXTSUBAYlWve3paQHtnJ7M89mxFKU2PerCCAbDbTAJp/KXlEfhu/MGKzozjf a23sRl2FuUn5Sm/yr4DB1gdjSKlLcxdbErBAv9kQHNVU99/Dlo8TZtScm7D7PDdT7Srk wWlGvVM7fPTWgemGJslZew0bZrGuHSsSpjFfOVyzzpQtAoo19Hh427NcrFm/CNPJIybw h7AA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u26si5289587jam.6.2021.08.18.01.37.29; Wed, 18 Aug 2021 01:37:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239424AbhHRIhQ (ORCPT + 99 others); Wed, 18 Aug 2021 04:37:16 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:8876 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238865AbhHRIhP (ORCPT ); Wed, 18 Aug 2021 04:37:15 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4GqLkD5SQrz8sZG; Wed, 18 Aug 2021 16:32:36 +0800 (CST) Received: from dggema757-chm.china.huawei.com (10.1.198.199) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Wed, 18 Aug 2021 16:36:39 +0800 Received: from localhost.localdomain (10.67.165.2) by dggema757-chm.china.huawei.com (10.1.198.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 18 Aug 2021 16:36:39 +0800 From: Qi Liu To: , , CC: , , , , Subject: [PATCH v9 1/2] docs: perf: Add description for HiSilicon PCIe PMU driver Date: Wed, 18 Aug 2021 13:12:45 +0800 Message-ID: <20210818051246.29545-2-liuqi115@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210818051246.29545-1-liuqi115@huawei.com> References: <20210818051246.29545-1-liuqi115@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggema757-chm.china.huawei.com (10.1.198.199) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PCIe PMU Root Complex Integrated End Point(RCiEP) device is supported on HiSilicon HIP09 platform. Document it to provide guidance on how to use it. Reviewed-by: John Garry Signed-off-by: Qi Liu --- .../admin-guide/perf/hisi-pcie-pmu.rst | 106 ++++++++++++++++++ Documentation/admin-guide/perf/index.rst | 1 + 2 files changed, 107 insertions(+) create mode 100644 Documentation/admin-guide/perf/hisi-pcie-pmu.rst diff --git a/Documentation/admin-guide/perf/hisi-pcie-pmu.rst b/Documentation/admin-guide/perf/hisi-pcie-pmu.rst new file mode 100644 index 000000000000..bbe66480ff85 --- /dev/null +++ b/Documentation/admin-guide/perf/hisi-pcie-pmu.rst @@ -0,0 +1,106 @@ +================================================ +HiSilicon PCIe Performance Monitoring Unit (PMU) +================================================ + +On Hip09, HiSilicon PCIe Performance Monitoring Unit (PMU) could monitor +bandwidth, latency, bus utilization and buffer occupancy data of PCIe. + +Each PCIe Core has a PMU to monitor multi Root Ports of this PCIe Core and +all Endpoints downstream these Root Ports. + + +HiSilicon PCIe PMU driver +========================= + +The PCIe PMU driver registers a perf PMU with the name of its sicl-id and PCIe +Core id.:: + + /sys/bus/event_source/hisi_pcie_core + +PMU driver provides description of available events and filter options in sysfs, +see /sys/bus/event_source/devices/hisi_pcie_core. + +The "format" directory describes all formats of the config (events) and config1 +(filter options) fields of the perf_event_attr structure. The "events" directory +describes all documented events shown in perf list. + +The "identifier" sysfs file allows users to identify the version of the +PMU hardware device. + +The "bus" sysfs file allows users to get the bus number of Root Ports +monitored by PMU. + +Example usage of perf:: + + $# perf list + hisi_pcie0_core0/rx_mwr_latency/ [kernel PMU event] + hisi_pcie0_core0/rx_mwr_cnt/ [kernel PMU event] + ------------------------------------------ + + $# perf stat -e hisi_pcie0_core0/rx_mwr_latency/ + $# perf stat -e hisi_pcie0_core0/rx_mwr_cnt/ + $# perf stat -g -e hisi_pcie0_core0/rx_mwr_latency/ -e hisi_pcie0_core0/rx_mwr_cnt/ + +The current driver does not support sampling. So "perf record" is unsupported. +Also attach to a task is unsupported for PCIe PMU. + +Filter options +-------------- + +1. Target filter +PMU could only monitor the performance of traffic downstream target Root Ports +or downstream target Endpoint. PCIe PMU driver support "port" and "bdf" +interfaces for users, and these two interfaces aren't supported at the same +time. + +-port +"port" filter can be used in all PCIe PMU events, target Root Port can be +selected by configuring the 16-bits-bitmap "port". Multi ports can be selected +for AP-layer-events, and only one port can be selected for TL/DL-layer-events. + +For example, if target Root Port is 0000:00:00.0 (x8 lanes), bit0 of bitmap +should be set, port=0x1; if target Root Port is 0000:00:04.0 (x4 lanes), +bit8 is set, port=0x100; if these two Root Ports are both monitored, port=0x101. + +Example usage of perf:: + + $# perf stat -e hisi_pcie0_core0/rx_mwr_latency,port=0x1/ sleep 5 + +-bdf + +"bdf" filter can only be used in bandwidth events, target Endpoint is selected +by configuring BDF to "bdf". Counter only counts the bandwidth of message +requested by target Endpoint. + +For example, "bdf=0x3900" means BDF of target Endpoint is 0000:39:00.0. + +Example usage of perf:: + + $# perf stat -e hisi_pcie0_core0/rx_mrd_flux,bdf=0x3900/ sleep 5 + +2. Trigger filter +Event statistics start when the first time TLP length is greater/smaller +than trigger condition. You can set the trigger condition by writing "trig_len", +and set the trigger mode by writing "trig_mode". This filter can only be used +in bandwidth events. + +For example, "trig_len=4" means trigger condition is 2^4 DW, "trig_mode=0" +means statistics start when TLP length > trigger condition, "trig_mode=1" +means start when TLP length < condition. + +Example usage of perf:: + + $# perf stat -e hisi_pcie0_core0/rx_mrd_flux,trig_len=0x4,trig_mode=1/ sleep 5 + +3. Threshold filter +Counter counts when TLP length within the specified range. You can set the +threshold by writing "thr_len", and set the threshold mode by writing +"thr_mode". This filter can only be used in bandwidth events. + +For example, "thr_len=4" means threshold is 2^4 DW, "thr_mode=0" means +counter counts when TLP length >= threshold, and "thr_mode=1" means counts +when TLP length < threshold. + +Example usage of perf:: + + $# perf stat -e hisi_pcie0_core0/rx_mrd_flux,thr_len=0x4,thr_mode=1/ sleep 5 diff --git a/Documentation/admin-guide/perf/index.rst b/Documentation/admin-guide/perf/index.rst index 5a8f2529a033..9d1e5e90277b 100644 --- a/Documentation/admin-guide/perf/index.rst +++ b/Documentation/admin-guide/perf/index.rst @@ -7,6 +7,7 @@ Performance monitor support .. toctree:: :maxdepth: 1 + hisi-pcie-pmu hisi-pmu imx-ddr qcom_l2_pmu -- 2.17.1