From patchwork Fri Apr 9 09:05:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "liuqi (BA)" X-Patchwork-Id: 12193433 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15219C433B4 for ; Fri, 9 Apr 2021 09:10:49 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 95503610D0 for ; Fri, 9 Apr 2021 09:10:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95503610D0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KVYMQmbgXTrK8qNOfROpVfYhTiKkC5b5czlLzTe+ciw=; b=oNbTwQ/aRJY+CNgHQzJxmds9d 7Ek2DdOVXL3DRyVxWDNXDQAAX5fydWAh6rGRyznRbYm29/NNswhTEOAmVvga01OJ807OOqPTwdN4P jREy+hwnnCQRyD3ChDwVatk5OJCO9es0K7phOIurgXqdxrBAAGvDNeczjZacCr0Q6mPighb2EieuH 3sypNnmRCrpoa1Tk2iKWs7iAQkBlhdap4OmcGC+9MBDuF/vcs+6OnQovKGG2Tt0JrCGtJe3w+T+Ic R9D83lEJDOyrWltaZsf23tVWE2QGHXYCUTYPKFMdplDpBe1ZaJ3JNEFEAfTmeZyD61xvBmO78P8zW QofTKWs3Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lUn8L-000B3F-1E; Fri, 09 Apr 2021 09:08:57 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUn8H-000B23-HJ for linux-arm-kernel@desiato.infradead.org; Fri, 09 Apr 2021 09:08:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=XKLJVk2IjVQ96MjvwDB3gO3yBVGOpP0VI9IBl8YaAn4=; b=0dPgI/db5iF5pWL7MToeDlkdTw FzlUQbJ8bPX1SopbbqryIuSNlKCBU8tktp/hGEGeEKP9SB/1RmLOngDhcgEXrX/o/CtV8HZZHdMm3 cj/UGkJNkhEXH5lJEIQs0mUexHwMQcrXpqnnZbjsAoxc+LWQCeir9QpC8CcIyXZst7PojJcizHoUu EYsrXRgdwNEgf0zJ4WnWVqYghWi7qW6XB5SrOsNx/rykkJQk7Tp8PduPfJsw481Ug8X8Oy9v+v7tv ePmENj52I2bWc6DMWFkJiPgFMOm0qbMtDuoNbvX1TFA5zw3JYbOSTG7bqgaE+wJb+hnzlhfq1WIDD 9QuQBPDw==; Received: from szxga05-in.huawei.com ([45.249.212.191]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUn8E-003ppN-Er for linux-arm-kernel@lists.infradead.org; Fri, 09 Apr 2021 09:08:52 +0000 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FGsg719SdzPnx8; Fri, 9 Apr 2021 17:05:55 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.498.0; Fri, 9 Apr 2021 17:08:33 +0800 From: Qi Liu To: , , CC: , , , , Subject: [PATCH v2 2/2] docs: perf: Add description for HiSilicon PCIe PMU driver Date: Fri, 9 Apr 2021 17:05:57 +0800 Message-ID: <1617959157-22956-3-git-send-email-liuqi115@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1617959157-22956-1-git-send-email-liuqi115@huawei.com> References: <1617959157-22956-1-git-send-email-liuqi115@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210409_020850_884367_3DECA130 X-CRM114-Status: GOOD ( 15.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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