Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1727259pxj; Wed, 19 May 2021 12:26:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5V9PV5770tp77um0tXqoSooEP0ujzPR+ea0Oy28YRC3/0IVJRMBrXnVSOByh31Vq6fK8m X-Received: by 2002:a05:6402:1115:: with SMTP id u21mr620325edv.383.1621452402251; Wed, 19 May 2021 12:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621452402; cv=none; d=google.com; s=arc-20160816; b=FUXbkwvJsBU07twI4omcxWL2BoqrOj1SxKDuqZ1o+2VFnPs/Gpu0COVj6vsJEN6ZqQ YlPf1ZfDOLyNdoy48c0uvxH2gxEaDweixBB/sHrT7e8il00Ttjz4q/SElOHmeJTHG5sd 92bHv8N3XZaP8CKgHcpH48b7Qm3ba5FoziJhTVV5DSaJ9s22/Uh2SzQaM9VlakORUijr t8v2P3zAjKI0HHZic/UZTKAWWaU/7nSFHMf7WpTYeLWw2RWmzmElQhF/XDQKeNX3ha0F qpsb8mM7/4VYu6hJUPUleojZ87koCgiVBLqw3Z/5CP6D2oB0Jne49Bm08cQV9+oKwlz+ Lk1w== 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=aiEWD1QZUSWIlUhr4yMk2Tbj3cq8JeSCxhyDuP+iB/Q=; b=ccwZFqY/KW3tVeMsdbGcAofea7et9CkrWDxRkHkVEoFyvPDpeqqqIYSkIkOj4aMtOs guSev4/Hyuo78RARteIlfr1Oj77+gcafhZxRbngMBhgleh+zBr3C5Fc1zHqOCDkJS5d7 fDwSyOXAaRcpXxrvLaeoQgrE1TY0ssMl32NEwMTfTuyvUG8vJVnprbqZT/7lrJomMC9d 8Uf3kGemm4pGmJZVy4Hz3q0oPTfVMW3tmapW27aJlIqdzwXkyf0ORpKkZxd+eZT0MMWr ZtuoIiJ17bMKzpjlQLeeuv6kqsvuc9cSvIvhus4UBvcDgaNHIMknYcI9IhZwhocl7jhS 4MTA== 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 u7si78210eda.389.2021.05.19.12.26.16; Wed, 19 May 2021 12:26:42 -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 S233829AbhESJvO (ORCPT + 99 others); Wed, 19 May 2021 05:51:14 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:4681 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232281AbhESJvJ (ORCPT ); Wed, 19 May 2021 05:51:09 -0400 Received: from dggems702-chm.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FlSh655hKz1BP9t; Wed, 19 May 2021 17:47:02 +0800 (CST) Received: from dggema757-chm.china.huawei.com (10.1.198.199) by dggems702-chm.china.huawei.com (10.3.19.179) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Wed, 19 May 2021 17:49:47 +0800 Received: from localhost.localdomain (10.69.192.56) 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, 19 May 2021 17:49:47 +0800 From: Qi Liu To: , , CC: , , , , Subject: [PATCH v4 1/2] docs: perf: Add description for HiSilicon PCIe PMU driver Date: Wed, 19 May 2021 17:49:00 +0800 Message-ID: <1621417741-5229-2-git-send-email-liuqi115@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1621417741-5229-1-git-send-email-liuqi115@huawei.com> References: <1621417741-5229-1-git-send-email-liuqi115@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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. Signed-off-by: Qi Liu --- Documentation/admin-guide/perf/hisi-pcie-pmu.rst | 104 +++++++++++++++++++++++ 1 file changed, 104 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 0000000..2084b53 --- /dev/null +++ b/Documentation/admin-guide/perf/hisi-pcie-pmu.rst @@ -0,0 +1,104 @@ +================================================ +HiSilicon PCIe Performance Monitoring Unit (PMU) +================================================ + +HiSilicon PCIe Performance Monitoring Unit (PMU) is a PCIe Root Complex +integrated End Point (RCiEP) device. On Hip09, each PCIe Core has a PMU RCiEP +to monitor multi Root Ports and all Endpoints downstream these Root Ports. + +HiSilicon PCIe PMU is supported to collect performance data of PCIe bus, such +as: bandwidth, latency etc. + + +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_ + +PMU driver provides description of available events and filter options in sysfs, +see /sys/bus/event_source/devices/hisi_pcie_. + +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_0/bw_rx/ [kernel PMU event] + ------------------------------------------ + + $# perf stat -e hisi_pcie0_0/bw_rx/ sleep 5 + +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_0/bw_rx,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_0/bw_rx,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_0/bw_rx,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_0/bw_rx,thr_len=0x4,thr_mode=1/ sleep 5 -- 2.7.4