Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8580331ybl; Thu, 16 Jan 2020 20:07:01 -0800 (PST) X-Google-Smtp-Source: APXvYqyMf7bHtZq6O1CoPGw9P40aFbkTpcuaIMs0iSE0LkbNOVRgqreq8dSRDDKBRmT4td3HEleU X-Received: by 2002:a05:6830:44e:: with SMTP id d14mr4537305otc.228.1579234021068; Thu, 16 Jan 2020 20:07:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579234021; cv=none; d=google.com; s=arc-20160816; b=S8ehlAZOg0blwWT0EjvM8j1t4r2IQBZVjkGDX7VlYHOjl09FapYO3JX6sznd5H6d/S eY6KSbGAHsUW+H6yIqsahlaUhxsCeEsWiH8Qh5wpd0wSarwD+nHE+WgaXT7i8hcW6mu8 nNXgMRi1MCSLaOP5QiH+/YeS6ME7MKSb2AiX3MEuusAOS8WngSaJrUJo4yKz4liYgrY0 jQhX4WS6tnEJieq8r3cQXt15CguB/Ai2xCz2vJxDT28qQU9Kq+E2jYdoGNF+ec9cPVTT 1S6WMHBplBffCZs9izcazGt5okkY5D2EITVle9899DMxTDwEEQiU8XGwTyousHm1IIwX sN0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=6YR1/GePSE8lGAwkpsi3qsC6ykTDH0dSeNYyxoS4Trw=; b=cME1ymu/JRg0JmTfB0m191EvqUXDc5OWv5BkxzZv3mb/XQ5FrCk/ZrOqbfd4vKeVPL ak6/bCspxLxHSjWvnBpFu3ED1FWxqADgauyz/JFH3iqpVBZ3AFi1U5y2W47ZqzZKa/lb jnzb78nlOAyY6F0GXruT+iVxFmXKwDl2d/wvnnFSVBYfKklHlF9Ui8eLySrqsfkynyWx hjX/DnwPHjnBLBEz7wH6fBE/RTea0YyQfOtz/KNlVkIgVRthJnxuiSoAjCLfg0M6+iYR 5AjwQdmHm9w61cbMSVCHLSepJuOGx2MOa/0qOKPAWNXbEEtrwwRH9pXVghWbHZAANBa7 F98w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j24si14310076otn.110.2020.01.16.20.06.49; Thu, 16 Jan 2020 20:07:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729673AbgAQDbO (ORCPT + 99 others); Thu, 16 Jan 2020 22:31:14 -0500 Received: from mga14.intel.com ([192.55.52.115]:1832 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728925AbgAQDbK (ORCPT ); Thu, 16 Jan 2020 22:31:10 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jan 2020 19:31:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,328,1574150400"; d="scan'208";a="306100496" Received: from hao-dev.bj.intel.com ([10.238.157.65]) by orsmga001.jf.intel.com with ESMTP; 16 Jan 2020 19:31:07 -0800 From: Wu Hao To: will@kernel.org, mdf@kernel.org, mark.rutland@arm.com, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org Cc: linux-api@vger.kernel.org, atull@kernel.org, gregkh@linuxfoundation.org, Xu Yilun , Wu Hao Subject: [RESEND Patch v6 1/2] Documentation: fpga: dfl: add description for performance reporting support Date: Fri, 17 Jan 2020 11:10:27 +0800 Message-Id: <1579230628-22243-2-git-send-email-hao.wu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1579230628-22243-1-git-send-email-hao.wu@intel.com> References: <1579230628-22243-1-git-send-email-hao.wu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xu Yilun This patch adds description for performance reporting support for Device Feature List (DFL) based FPGA. Signed-off-by: Xu Yilun Signed-off-by: Wu Hao --- v5: rebase due to format change (txt->rst). --- Documentation/fpga/dfl.rst | 83 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/Documentation/fpga/dfl.rst b/Documentation/fpga/dfl.rst index 094fc8a..85b137b 100644 --- a/Documentation/fpga/dfl.rst +++ b/Documentation/fpga/dfl.rst @@ -118,6 +118,11 @@ More functions are exposed through sysfs management information (current temperature, thresholds, threshold status, etc.). + Performance reporting + performance counters are exposed through perf PMU APIs. Standard perf tool + can be used to monitor all available perf events. Please see performance + counter section below for more detailed information. + FIU - PORT ========== @@ -378,6 +383,84 @@ The device nodes used for ioctl() or mmap() can be referenced through:: /sys/class/fpga_region///dev +Performance Counters +==================== +Performance reporting is one private feature implemented in FME. It could +supports several independent, system-wide, device counter sets in hardware to +monitor and count for performance events, including "basic", "cache", "fabric", +"vtd" and "vtd_sip" counters. Users could use standard perf tool to monitor +FPGA cache hit/miss rate, transaction number, interface clock counter of AFU +and other FPGA performance events. + +Different FPGA devices may have different counter sets, it depends on hardware +implementation. e.g. some discrete FPGA cards don't have any cache. User could +use "perf list" to check which perf events are supported by target hardware. + +In order to allow user to use standard perf API to access these performance +counters, driver creates a perf PMU, and related sysfs interfaces in +/sys/bus/event_source/devices/fme* to describe available perf events and +configuration options. + +The "format" directory describes the format of the config field of struct +perf_event_attr. There are 3 bitfields for config, "evtype" defines which type +the perf event belongs to. "event" is the identity of the event within its +category. "portid" is introduced to decide counters set to monitor on FPGA +overall data or a specific port. + +The "events" directory describes the configuration templates for all available +events which can be used with perf tool directly. For example, fab_mmio_read +has the configuration "event=0x06,evtype=0x02,portid=0xff", which shows this +event belongs to fabric type (0x02), the local event id is 0x06 and it is for +overall monitoring (portid=0xff). + +Example usage of perf:: + + $# perf list |grep fme + + fme0/fab_mmio_read/ [Kernel PMU event] + <...> + fme0/fab_port_mmio_read,portid=?/ [Kernel PMU event] + <...> + + $# perf stat -a -e fme0/fab_mmio_read/ + or + $# perf stat -a -e fme0/event=0x06,evtype=0x02,portid=0xff/ + or + $# perf stat -a -e fme0/config=0xff2006/ + +Another example, fab_port_mmio_read monitors mmio read of a specific port. So +its configuration template is "event=0x06,evtype=0x01,portid=?". The portid +should be explicitly set. + +Its usage of perf:: + + $# perf stat -a -e fme0/fab_port_mmio_read,portid=0x0/ + or + $# perf stat -a -e fme0/event=0x06,evtype=0x02,portid=0x0/ + or + $# perf stat -a -e fme0/config=0x2006/ + +Please note for fabric counters, overall perf events (fab_*) and port perf +events (fab_port_*) actually share one set of counters in hardware, so it can't +monitor both at the same time. If this set of counters is configured to monitor +overall data, then per port perf data is not supported. See below example:: + + $# perf stat -e fme0/fab_mmio_read/,fme0/fab_port_mmio_write,\ + portid=0/ sleep 1 + + Performance counter stats for 'system wide': + + 3 fme0/fab_mmio_read/ + fme0/fab_port_mmio_write,portid=0x0/ + + 1.001750904 seconds time elapsed + +The driver also provides a "cpumask" sysfs attribute, which always shows fixed +value cpu0 as all perf events are from system-wide counters on FPGA device. + +The current driver does not support sampling. So "perf record" is unsupported. + + Add new FIUs support ==================== It's possible that developers made some new function blocks (FIUs) under this -- 1.8.3.1