add performance reporting support to FPGA DFL drivers
Subsystems (4)
v9 cover add performance reporting support to FPGA DFL drivers
Hi all,
This patchset adds performance reporting support for FPGA DFL drivers. It introduces one pmu to expose userspace interfaces via standard perf API. User could use standard perf tool to access perf events exposed via pmu.
This patchset is generated based on 5.7-rc1.
Main changes from v8:
- rebase against 5.7-rc1.
Main changes from v7:
- rename pmu name from "fme%d" to "dfl_fme%d".
- monitor cpu hotplug for cpumask sysfs and update cpumask sysfs doc.
- add extra read for 64bit counter registers to avoid 2-32bit readl issue.
Main changes from v6:
- add a new ABI/testing/ sysfs documentation in patch #2.
- fix a warning reported by kbuild in patch #2.
Main changes from v5:
- use dev_ext_attribute instead of fme_perf_event_attr.
- use is_visible function to decide which events to expose per hardware capability, and add event_init checking for all events.
Main changes from v4:
- rebase and clean up.
- update Kconfig for PERF_EVENTS dependency.
Main changes from v3:
- add more descriptions in doc, including how to use perf tool for these hardware counters. (patch #1)
- use standard perf API instead of sysfs entries. (patch #2)
Wu Hao (1):
fpga: dfl: fme: add performance reporting support
Xu Yilun (1):
Documentation: fpga: dfl: add description for performance reporting
support
.../testing/sysfs-bus-event_source-devices-dfl_fme | 104 ++ Documentation/fpga/dfl.rst | 84 ++ drivers/fpga/Kconfig | 2 +- drivers/fpga/Makefile | 1 + drivers/fpga/dfl-fme-main.c | 4 + drivers/fpga/dfl-fme-perf.c | 1020 ++++++++++++++++++++ drivers/fpga/dfl-fme.h | 2 + drivers/fpga/dfl.h | 2 + 8 files changed, 1218 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/testing/sysfs-bus-event_source-devices-dfl_fme create mode 100644 drivers/fpga/dfl-fme-perf.c
Signature · 1 line
1.8.3.1
PATCH v9 1/2 Documentation: fpga: dfl: add description for performance reporting support
From: Xu Yilun <[email protected]>
This patch adds description for performance reporting support for Device Feature List (DFL) based FPGA.
--- Documentation/fpga/dfl.rst | 84 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+)
Documentation/fpga/dfl.rst +84 -0
@@ -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,85 @@ The device nodes used for ioctl() or mmap() can be referenced through:: /sys/class/fpga_region/<regionX>/<dfl-port.n>/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/dfl_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 dfl_fme + + dfl_fme0/fab_mmio_read/ [Kernel PMU event] + <...> + dfl_fme0/fab_port_mmio_read,portid=?/ [Kernel PMU event] + <...> + + $# perf stat -a -e dfl_fme0/fab_mmio_read/ <command> + or + $# perf stat -a -e dfl_fme0/event=0x06,evtype=0x02,portid=0xff/ <command> + or + $# perf stat -a -e dfl_fme0/config=0xff2006/ <command> + +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 dfl_fme0/fab_port_mmio_read,portid=0x0/ <command> + or + $# perf stat -a -e dfl_fme0/event=0x06,evtype=0x02,portid=0x0/ <command> + or + $# perf stat -a -e dfl_fme0/config=0x2006/ <command> + +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 dfl_fme0/fab_mmio_read/,dfl_fme0/fab_port_mmio_write,\ + portid=0/ sleep 1 + + Performance counter stats for 'system wide': + + 3 dfl_fme0/fab_mmio_read/ + <not supported> dfl_fme0/fab_port_mmio_write,portid=0x0/ + + 1.001750904 seconds time elapsed + +The driver also provides a "cpumask" sysfs attribute, which contains only one +cpu id used to access these perf events. Counting on multiple CPUs is not +allowed since they are 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
Signature · 1 line
1.8.3.1
Randy Dunlap
reviewerRe: [PATCH v9 1/2] Documentation: fpga: dfl: add description for performance reporting support
Hi--
Here are a few comments for you:
Quoted 20 lines · Wu Hao
From: Xu Yilun <[email protected]>
This patch adds description for performance reporting support for Device Feature List (DFL) based FPGA.
Signed-off-by Xu Yilun <[email protected]>Signed-off-by Wu Hao <[email protected]>--- Documentation/fpga/dfl.rst | 84 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+)Documentation/fpga/dfl.rst +0
-0@@ -378,6 +383,85 @@ The device nodes used for ioctl() or mmap() can be referenced through:: /sys/class/fpga_region/<regionX>/<dfl-port.n>/dev
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through:: · line 395
Quoted 10 lines
Documentation/fpga/dfl.rst +10
-0+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
sets, depending on hardware
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through:: · line 396
Quoted 1 line
Documentation/fpga/dfl.rst +1
-0+implementation. e.g. some discrete FPGA cards don't have any cache. User could
E.g., some
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through:: · line 405
Quoted 9 lines
Documentation/fpga/dfl.rst +9
-0+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/dfl_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
config: "evtype"
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through:: · line 406
Quoted 1 line
Documentation/fpga/dfl.rst +1
-0+the perf event belongs to. "event" is the identity of the event within its
belongs to; "event" is
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through:: · line 407
Quoted 1 line
Documentation/fpga/dfl.rst +1
-0+category. "portid" is introduced to decide counters set to monitor on FPGA
category; "portid" is
Quoted 42 lines
Documentation/fpga/dfl.rst +42
-0+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 dfl_fme + + dfl_fme0/fab_mmio_read/ [Kernel PMU event] + <...> + dfl_fme0/fab_port_mmio_read,portid=?/ [Kernel PMU event] + <...> + + $# perf stat -a -e dfl_fme0/fab_mmio_read/ <command> + or + $# perf stat -a -e dfl_fme0/event=0x06,evtype=0x02,portid=0xff/ <command> + or + $# perf stat -a -e dfl_fme0/config=0xff2006/ <command> + +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 dfl_fme0/fab_port_mmio_read,portid=0x0/ <command> + or + $# perf stat -a -e dfl_fme0/event=0x06,evtype=0x02,portid=0x0/ <command> + or + $# perf stat -a -e dfl_fme0/config=0x2006/ <command> + +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 dfl_fme0/fab_mmio_read/,dfl_fme0/fab_port_mmio_write,\ + portid=0/ sleep 1
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through:: · line 459
Quoted 10 lines
Documentation/fpga/dfl.rst +10
-0+ + Performance counter stats for 'system wide': + + 3 dfl_fme0/fab_mmio_read/ + <not supported> dfl_fme0/fab_port_mmio_write,portid=0x0/ + + 1.001750904 seconds time elapsed + +The driver also provides a "cpumask" sysfs attribute, which contains only one +cpu id used to access these perf events. Counting on multiple CPUs is not
CPU
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through:: · line 467
Quoted 9 lines
Documentation/fpga/dfl.rst +5
-0+allowed since they are 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
thanks.
Signature · 1 line
~Randy
RE: [PATCH v9 1/2] Documentation: fpga: dfl: add description for performance reporting support
Quoted 12 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Randy Dunlap
Sent: Saturday, April 18, 2020 8:08 AM
To: Wu, Hao <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]
Cc: [email protected]; [email protected]; Xu, Yilun <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH v9 1/2] Documentation: fpga: dfl: add description for performance reporting support
Quoted 3 lines
Hi--
Here are a few comments for you:
Thanks a lot for the comments, will fix all of them in the next version. : )
Hao
Quoted 152 lines · Wu Hao
Quoted 9 lines
From: Xu Yilun <[email protected]>
This patch adds description for performance reporting support for Device Feature List (DFL) based FPGA.
Signed-off-by Xu Yilun <[email protected]>Signed-off-by Wu Hao <[email protected]>--- Documentation/fpga/dfl.rst | 84++++++++++++++++++++++++++++++++++++++++++++++
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can
Quoted 8 lines
1 file changed, 84 insertions(+)Documentation/fpga/dfl.rst +0
-0@@ -378,6 +383,85 @@ The device nodes used for ioctl() or mmap() canbe referenced through::
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through::
Quoted 6 lines
Documentation/fpga/dfl.rst +3
-0/sys/class/fpga_region/<regionX>/<dfl-port.n>/dev +Performance Counters +==================== +Performance reporting is one private feature implemented in FME. Itcould
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can · line 389
Quoted 1 line
Documentation/fpga/dfl.rst +1
-0+supports several independent, system-wide, device counter sets inhardware to
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can · line 390
Quoted 1 line
Documentation/fpga/dfl.rst +1
-0+monitor and count for performance events, including "basic", "cache","fabric",
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can · line 391
Quoted 1 line
Documentation/fpga/dfl.rst +1
-0+"vtd" and "vtd_sip" counters. Users could use standard perf tool tomonitor
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can · line 392
Quoted 1 line
Documentation/fpga/dfl.rst +1
-0+FPGA cache hit/miss rate, transaction number, interface clock counter ofAFU
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through::
Quoted 3 lines
Documentation/fpga/dfl.rst +3
-0+and other FPGA performance events. + +Different FPGA devices may have different counter sets, it depends onhardware
sets, depending on hardware
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can · line 396
Quoted 1 line
Documentation/fpga/dfl.rst +1
-0+implementation. e.g. some discrete FPGA cards don't have any cache.User could
E.g., someDocumentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can · line 397
Quoted 1 line
Documentation/fpga/dfl.rst +1
-0+use "perf list" to check which perf events are supported by targethardware.
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can · line 399
Quoted 2 lines
Documentation/fpga/dfl.rst +2
-0+ +In order to allow user to use standard perf API to access theseperformance
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can · line 401
Quoted 2 lines
Documentation/fpga/dfl.rst +2
-0+counters, driver creates a perf PMU, and related sysfs interfaces in +/sys/bus/event_source/devices/dfl_fme* to describe available perf eventsand
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through::
Quoted 4 lines
Documentation/fpga/dfl.rst +4
-0+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 whichtype
config: "evtype"
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through:: · line 406
Quoted 1 line
Documentation/fpga/dfl.rst +1
-0+the perf event belongs to. "event" is the identity of the event within itsbelongs to; "event" is
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through:: · line 407
Quoted 1 line
Documentation/fpga/dfl.rst +1
-0+category. "portid" is introduced to decide counters set to monitor on FPGAcategory; "portid" is
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through::
Quoted 3 lines
Documentation/fpga/dfl.rst +3
-0+overall data or a specific port. + +The "events" directory describes the configuration templates for allavailable
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can · line 411
Quoted 1 line
Documentation/fpga/dfl.rst +1
-0+events which can be used with perf tool directly. For example,
fab_mmio_readDocumentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can · line 412
Quoted 1 line
Documentation/fpga/dfl.rst +1
-0+has the configuration "event=0x06,evtype=0x02,portid=0xff", whichshows this
Quoted 5 lines
Documentation/fpga/dfl.rst +5
-0+event belongs to fabric type (0x02), the local event id is 0x06 and it is for +overall monitoring (portid=0xff). + +Example usage of perf:: +Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through::
Quoted 10 lines
Documentation/fpga/dfl.rst +10
-0+ $# perf list |grep dfl_fme + + dfl_fme0/fab_mmio_read/ [Kernel PMU event] + <...> + dfl_fme0/fab_port_mmio_read,portid=?/ [Kernel PMU event] + <...> + + $# perf stat -a -e dfl_fme0/fab_mmio_read/ <command> + or + $# perf stat -a -e dfl_fme0/event=0x06,evtype=0x02,portid=0xff/<command>
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through::
Quoted 4 lines
Documentation/fpga/dfl.rst +4
-0+ or + $# perf stat -a -e dfl_fme0/config=0xff2006/ <command> + +Another example, fab_port_mmio_read monitors mmio read of a specificport. So
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can · line 432
Quoted 1 line
Documentation/fpga/dfl.rst +1
-0+its configuration template is "event=0x06,evtype=0x01,portid=?". Theportid
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through::
Quoted 7 lines
Documentation/fpga/dfl.rst +7
-0+should be explicitly set. + +Its usage of perf:: + + $# perf stat -a -e dfl_fme0/fab_port_mmio_read,portid=0x0/ <command> + or + $# perf stat -a -e dfl_fme0/event=0x06,evtype=0x02,portid=0x0/<command>
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through::
Quoted 5 lines
Documentation/fpga/dfl.rst +5
-0+ or + $# perf stat -a -e dfl_fme0/config=0x2006/ <command> + +Please note for fabric counters, overall perf events (fab_*) and port perf +events (fab_port_*) actually share one set of counters in hardware, so itcan't
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can · line 445
Quoted 1 line
Documentation/fpga/dfl.rst +1
-0+monitor both at the same time. If this set of counters is configured tomonitor
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through::
Quoted 3 lines
Documentation/fpga/dfl.rst +3
-0+overall data, then per port perf data is not supported. See below example:: + + $# perf stat -edfl_fme0/fab_mmio_read/,dfl_fme0/fab_port_mmio_write,\
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through::
Quoted 10 lines
Documentation/fpga/dfl.rst +10
-0+ portid=0/ sleep 1 + + Performance counter stats for 'system wide': + + 3 dfl_fme0/fab_mmio_read/ + <not supported> dfl_fme0/fab_port_mmio_write,portid=0x0/ + + 1.001750904 seconds time elapsed + +The driver also provides a "cpumask" sysfs attribute, which contains onlyone
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through:: · line 459
Quoted 1 line
Documentation/fpga/dfl.rst +1
-0+cpu id used to access these perf events. Counting on multiple CPUs is notCPU
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through::
Quoted 3 lines
Documentation/fpga/dfl.rst +3
-0+allowed since they are system-wide counters on FPGA device. + +The current driver does not support sampling. So "perf record" isunsupported.
Documentation/fpga/dfl.rst The device nodes used for ioctl() or mmap() can be referenced through::
Quoted 5 lines
Documentation/fpga/dfl.rst +2
-0+ + Add new FIUs support ==================== It's possible that developers made some new function blocks (FIUs) underthis
Quoted 1 line
thanks.
--
~Randy
PATCH v9 2/2 fpga: dfl: fme: add performance reporting support
In reply to Wu HaoThis patch adds support for performance reporting private feature for FPGA Management Engine (FME). Now it supports several different performance counters, including 'basic', 'cache', 'fabric', 'vtd' and 'vtd_sip'. It allows user to use standard linux tools to access these performance counters.
e.g. List all events by "perf list"
perf list | grep fme
dfl_fme0/cache_read_hit/ [Kernel PMU event]
dfl_fme0/cache_read_miss/ [Kernel PMU event]
...
dfl_fme0/fab_mmio_read/ [Kernel PMU event]
dfl_fme0/fab_mmio_write/ [Kernel PMU event]
...
dfl_fme0/fab_port_mmio_read,portid=?/ [Kernel PMU event]
dfl_fme0/fab_port_mmio_write,portid=?/ [Kernel PMU event]
...
dfl_fme0/vtd_port_devtlb_1g_fill,portid=?/ [Kernel PMU event]
dfl_fme0/vtd_port_devtlb_2m_fill,portid=?/ [Kernel PMU event]
...
dfl_fme0/vtd_sip_iotlb_1g_hit/ [Kernel PMU event]
dfl_fme0/vtd_sip_iotlb_1g_miss/ [Kernel PMU event]
...
dfl_fme0/clock [Kernel PMU event]
...
e.g. check increased counter value after run one application using "perf stat" command.
perf stat -e dfl_fme0/fab_mmio_read/,dfl_fme0/fab_mmio_write/ ./test
Performance counter stats for './test':
1 dfl_fme0/fab_mmio_read/
2 dfl_fme0/fab_mmio_write/
1.009496520 seconds time elapsedPlease note that fabric counters support both fab_* and fab_port_*, but actually they are sharing one set of performance counters in hardware. If user wants to monitor overall data events on fab_* then fab_port_* can't be supported at the same time, see example below:
perf stat -e dfl_fme0/fab_mmio_read/,dfl_fme0/fab_port_mmio_write,portid=0/
Performance counter stats for 'system wide':
0 dfl_fme0/fab_mmio_read/
<not supported> dfl_fme0/fab_port_mmio_write,portid=0/
2.141064085 seconds time elapsed
--- .../testing/sysfs-bus-event_source-devices-dfl_fme | 104 ++ drivers/fpga/Kconfig | 2 +- drivers/fpga/Makefile | 1 + drivers/fpga/dfl-fme-main.c | 4 + drivers/fpga/dfl-fme-perf.c | 1020 ++++++++++++++++++++ drivers/fpga/dfl-fme.h | 2 + drivers/fpga/dfl.h | 2 + 7 files changed, 1134 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/testing/sysfs-bus-event_source-devices-dfl_fme create mode 100644 drivers/fpga/dfl-fme-perf.c
Documentation/ABI/testing/sysfs-bus-event_source-devices-dfl_fme new file +104 -0
@@ -0,0 +1,104 @@ +What: /sys/bus/event_source/devices/dfl_fmeX/format +Date: April 2020 +KernelVersion: 5.8 +Contact: Wu Hao <[email protected]> +Description: Read-only. Attribute group to describe the magic bits + that go into perf_event_attr.config for a particular pmu. + (See ABI/testing/sysfs-bus-event_source-devices-format). + + Each attribute under this group defines a bit range of the + perf_event_attr.config. All supported attributes are listed + below. + + event = "config:0-11" - event ID + evtype = "config:12-15" - event type + portid = "config:16-23" - event source + + For example, + + fab_mmio_read = "event=0x06,evtype=0x02,portid=0xff" + + It shows this fab_mmio_read is a fabric type (0x02) event with + 0x06 local event id for overall monitoring (portid=0xff). + +What: /sys/bus/event_source/devices/dfl_fmeX/cpumask +Date: April 2020 +KernelVersion: 5.8 +Contact: Wu Hao <[email protected]> +Description: Read-only. This file always returns cpu which the PMU is bound + for access to all fme pmu performance monitoring events. + +What: /sys/bus/event_source/devices/dfl_fmeX/events +Date: April 2020 +KernelVersion: 5.8 +Contact: Wu Hao <[email protected]> +Description: Read-only. Attribute group to describe performance monitoring + events specific to fme. Each attribute in this group describes + a single performance monitoring event supported by this fme pmu. + The name of the file is the name of the event. + (See ABI/testing/sysfs-bus-event_source-devices-events). + + All supported performance monitoring events are listed below. + + Basic events (evtype=0x00) + + clock = "event=0x00,evtype=0x00,portid=0xff" + + Cache events (evtype=0x01) + + cache_read_hit = "event=0x00,evtype=0x01,portid=0xff" + cache_read_miss = "event=0x01,evtype=0x01,portid=0xff" + cache_write_hit = "event=0x02,evtype=0x01,portid=0xff" + cache_write_miss = "event=0x03,evtype=0x01,portid=0xff" + cache_hold_request = "event=0x05,evtype=0x01,portid=0xff" + cache_data_write_port_contention = + "event=0x06,evtype=0x01,portid=0xff" + cache_tag_write_port_contention = + "event=0x07,evtype=0x01,portid=0xff" + cache_tx_req_stall = "event=0x08,evtype=0x01,portid=0xff" + cache_rx_req_stall = "event=0x09,evtype=0x01,portid=0xff" + cache_eviction = "event=0x0a,evtype=0x01,portid=0xff" + + Fabric events (evtype=0x02) + + fab_pcie0_read = "event=0x00,evtype=0x02,portid=0xff" + fab_pcie0_write = "event=0x01,evtype=0x02,portid=0xff" + fab_pcie1_read = "event=0x02,evtype=0x02,portid=0xff" + fab_pcie1_write = "event=0x03,evtype=0x02,portid=0xff" + fab_upi_read = "event=0x04,evtype=0x02,portid=0xff" + fab_upi_write = "event=0x05,evtype=0x02,portid=0xff" + fab_mmio_read = "event=0x06,evtype=0x02,portid=0xff" + fab_mmio_write = "event=0x07,evtype=0x02,portid=0xff" + fab_port_pcie0_read = "event=0x00,evtype=0x02,portid=?" + fab_port_pcie0_write = "event=0x01,evtype=0x02,portid=?" + fab_port_pcie1_read = "event=0x02,evtype=0x02,portid=?" + fab_port_pcie1_write = "event=0x03,evtype=0x02,portid=?" + fab_port_upi_read = "event=0x04,evtype=0x02,portid=?" + fab_port_upi_write = "event=0x05,evtype=0x02,portid=?" + fab_port_mmio_read = "event=0x06,evtype=0x02,portid=?" + fab_port_mmio_write = "event=0x07,evtype=0x02,portid=?" + + VTD events (evtype=0x03) + + vtd_port_read_transaction = "event=0x00,evtype=0x03,portid=?" + vtd_port_write_transaction = "event=0x01,evtype=0x03,portid=?" + vtd_port_devtlb_read_hit = "event=0x02,evtype=0x03,portid=?" + vtd_port_devtlb_write_hit = "event=0x03,evtype=0x03,portid=?" + vtd_port_devtlb_4k_fill = "event=0x04,evtype=0x03,portid=?" + vtd_port_devtlb_2m_fill = "event=0x05,evtype=0x03,portid=?" + vtd_port_devtlb_1g_fill = "event=0x06,evtype=0x03,portid=?" + + VTD SIP events (evtype=0x04) + + vtd_sip_iotlb_4k_hit = "event=0x00,evtype=0x04,portid=0xff" + vtd_sip_iotlb_2m_hit = "event=0x01,evtype=0x04,portid=0xff" + vtd_sip_iotlb_1g_hit = "event=0x02,evtype=0x04,portid=0xff" + vtd_sip_slpwc_l3_hit = "event=0x03,evtype=0x04,portid=0xff" + vtd_sip_slpwc_l4_hit = "event=0x04,evtype=0x04,portid=0xff" + vtd_sip_rcc_hit = "event=0x05,evtype=0x04,portid=0xff" + vtd_sip_iotlb_4k_miss = "event=0x06,evtype=0x04,portid=0xff" + vtd_sip_iotlb_2m_miss = "event=0x07,evtype=0x04,portid=0xff" + vtd_sip_iotlb_1g_miss = "event=0x08,evtype=0x04,portid=0xff" + vtd_sip_slpwc_l3_miss = "event=0x09,evtype=0x04,portid=0xff" + vtd_sip_slpwc_l4_miss = "event=0x0a,evtype=0x04,portid=0xff" + vtd_sip_rcc_miss = "event=0x0b,evtype=0x04,portid=0xff"
drivers/fpga/Kconfig +1 -1
@@ -156,7 +156,7 @@ config FPGA_DFL config FPGA_DFL_FME tristate "FPGA DFL FME Driver" - depends on FPGA_DFL && HWMON + depends on FPGA_DFL && HWMON && PERF_EVENTS help The FPGA Management Engine (FME) is a feature device implemented under Device Feature List (DFL) framework. Select this option to
drivers/fpga/Makefile +1 -0
@@ -40,6 +40,7 @@ obj-$(CONFIG_FPGA_DFL_FME_REGION) += dfl-fme-region.o obj-$(CONFIG_FPGA_DFL_AFU) += dfl-afu.o dfl-fme-objs := dfl-fme-main.o dfl-fme-pr.o dfl-fme-error.o +dfl-fme-objs += dfl-fme-perf.o dfl-afu-objs := dfl-afu-main.o dfl-afu-region.o dfl-afu-dma-region.o dfl-afu-objs += dfl-afu-error.o
drivers/fpga/dfl-fme-main.c +4 -0
@@ -580,6 +580,10 @@ static int fme_power_mgmt_init(struct platform_device *pdev, .ops = &fme_power_mgmt_ops, }, { + .id_table = fme_perf_id_table, + .ops = &fme_perf_ops, + }, + { .ops = NULL, }, };
drivers/fpga/dfl-fme-perf.c new file +1020 -0
1,020 lines not on this page · raw message
drivers/fpga/dfl-fme.h +2 -0
@@ -38,5 +38,7 @@ struct dfl_fme {extern const struct dfl_feature_ops fme_global_err_ops;extern const struct dfl_feature_id fme_global_err_id_table[];extern const struct attribute_group fme_global_err_group; +extern const struct dfl_feature_ops fme_perf_ops; +extern const struct dfl_feature_id fme_perf_id_table[];#endif /* __DFL_FME_H */
drivers/fpga/dfl.h +2 -0
@@ -197,12 +197,14 @@ struct dfl_feature_driver {* feature dev (platform device)'s reources. * @ioaddr: mapped mmio resource address. * @ops: ops of this sub feature. +* @priv: priv data of this feature. */ struct dfl_feature {u64 id;int resource_index;void __iomem *ioaddr;const struct dfl_feature_ops *ops; +void *priv; };#define DEV_STATUS_IN_USE 0
Signature · 1 line
1.8.3.1