Skip to contentSkip to conversation

add performance reporting support to FPGA DFL drivers

PATCH RESEND Superseded Wu Hao 3 participants 8 messages Jan 17, 2020 – Jan 23, 2020

Subsystems (4)

v6 of 10 Superseded Latest is v10 →

lore
Share & tools
lore

Wu Hao

author
#0 lore raw

v6 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 latest fpga/for-next branch.

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

 Documentation/fpga/dfl.rst  |  83 ++++
 drivers/fpga/Makefile       |   1 +
 drivers/fpga/dfl-fme-main.c |   4 +
 drivers/fpga/dfl-fme-perf.c | 943 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/fpga/dfl-fme.h      |   2 +
 drivers/fpga/dfl.h          |   2 +
 6 files changed, 1035 insertions(+)
 create mode 100644 drivers/fpga/dfl-fme-perf.c
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH RESEND v6 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.

---
v5: rebase due to format change (txt->rst).

---
 Documentation/fpga/dfl.rst | 83 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)
Documentation/fpga/dfl.rst +83 -0
index 094fc8a..85b137b 100644
@@ -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/<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/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/ <command>
+  or
+  $# perf stat -a -e fme0/event=0x06,evtype=0x02,portid=0xff/ <command>
+  or
+  $# perf stat -a -e 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 fme0/fab_port_mmio_read,portid=0x0/ <command>
+  or
+  $# perf stat -a -e fme0/event=0x06,evtype=0x02,portid=0x0/ <command>
+  or
+  $# perf stat -a -e 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 fme0/fab_mmio_read/,fme0/fab_port_mmio_write,\
+                                                    portid=0/ sleep 1
+
+  Performance counter stats for 'system wide':
+
+                 3      fme0/fab_mmio_read/
+   <not supported>      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
Signature · 1 line
1.8.3.1
author
#2 lore raw

PATCH RESEND v6 2/2 fpga: dfl: fme: add performance reporting support

In reply to Wu Hao

This 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

fme0/cache_read_hit/ [Kernel PMU event]
fme0/cache_read_miss/ [Kernel PMU event]
...

fme0/fab_mmio_read/ [Kernel PMU event]
fme0/fab_mmio_write/ [Kernel PMU event]
...

fme0/fab_port_mmio_read,portid=?/ [Kernel PMU event]
fme0/fab_port_mmio_write,portid=?/ [Kernel PMU event]
...

fme0/vtd_port_devtlb_1g_fill,portid=?/ [Kernel PMU event]
fme0/vtd_port_devtlb_2m_fill,portid=?/ [Kernel PMU event]
...

fme0/vtd_sip_iotlb_1g_hit/ [Kernel PMU event]
fme0/vtd_sip_iotlb_1g_miss/ [Kernel PMU event]
...

fme0/clock [Kernel PMU event]
...

e.g. check increased counter value after run one application using "perf stat" command.

perf stat -e fme0/fab_mmio_read/,fme0/fab_mmio_write/ ./test

Performance counter stats for './test':

                 1      fme0/fab_mmio_read/
                 2      fme0/fab_mmio_write/

       1.009496520 seconds time elapsed

Please 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 fme0/fab_mmio_read/,fme0/fab_port_mmio_write,portid=0/

Performance counter stats for 'system wide':

0 fme0/fab_mmio_read/
<not supported> fme0/fab_port_mmio_write,portid=0/

       2.141064085 seconds time elapsed

---
v3: replace scnprintf with sprintf in sysfs interfaces.
update sysfs doc kernel version and date.
fix sysfs doc issue for fabric counter.
refine PERF_OBJ_ATTR_* macro, doesn't count on __ATTR anymore. introduce PERF_OBJ_ATTR_F_* macro, as it needs to use different filenames for some of the sysfs attributes.
remove kobject_del when destroy kobject, kobject_put is enough. do sysfs_remove_groups first when destroying perf_obj. WARN_ON_ONCE in case internal parms are wrong in read_*_count().
v4: rework this patch to use standard perf API as user interfaces.
v5: rebase and clean up.
v6: use dev_ext_attribute instead of creating new fme_perf_attribute
use is_visible function to decide which events to expose per hardware capability, and add event_init checking for all events.

---
 drivers/fpga/Makefile       |   1 +
 drivers/fpga/dfl-fme-main.c |   4 +
 drivers/fpga/dfl-fme-perf.c | 943 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/fpga/dfl-fme.h      |   2 +
 drivers/fpga/dfl.h          |   2 +
 5 files changed, 952 insertions(+)
 create mode 100644 drivers/fpga/dfl-fme-perf.c
drivers/fpga/Makefile +1 -0
index 4865b74..d8e21df 100644
@@ -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
index 7c930e6..53a1447 100644
@@ -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 +943 -0

943 lines not on this page · raw message

drivers/fpga/dfl-fme.h +2 -0
index 6685c8e..4195dd6 100644
@@ -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
index 9f0e656..d312678 100644
@@ -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
#3 lore raw

Re: [RESEND Patch v6 2/2] fpga: dfl: fme: add performance reporting support

I love your patch! Yet something to improve:

Hi Wu,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.5-rc6 next-20200117]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Wu-Hao/add-performance-reporting-support-to-FPGA-DFL-drivers/20200118-043806
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 13b2668d6fc95dcecd11e4f86f47be24fda7da1f
config: mips-randconfig-a001-20200118 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 5.5.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=5.5.0 make.cross ARCH=mips

If you fix the issue, kindly add following tag

All errors (new ones prefixed by >>):

drivers//fpga/dfl-fme-perf.c:169:32: note: in expansion of macro 'container_of'

    #define to_fme_perf_priv(_pmu) container_of(_pmu, struct fme_perf_priv, pmu)
                                   ^
   drivers//fpga/dfl-fme-perf.c:755:31: note: in expansion of macro 'to_fme_perf_priv'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                  ^
   drivers//fpga/dfl-fme-perf.c:758:33: error: 'struct perf_event' has no member named 'hw'
      ops->event_destroy(priv, event->hw.idx, event->hw.config_base);
                                    ^
   drivers//fpga/dfl-fme-perf.c:758:48: error: 'struct perf_event' has no member named 'hw'
      ops->event_destroy(priv, event->hw.idx, event->hw.config_base);
                                                   ^
   In file included from include/asm-generic/bug.h:19:0,
                    from arch/mips/include/asm/bug.h:42,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:12,
                    from include/asm-generic/current.h:5,
                    from ./arch/mips/include/generated/asm/current.h:1,
                    from include/linux/sched.h:12,
                    from include/linux/ptrace.h:6,
                    from include/uapi/asm-generic/bpf_perf_event.h:4,
                    from ./arch/mips/include/generated/uapi/asm/bpf_perf_event.h:1,
                    from include/uapi/linux/bpf_perf_event.h:11,
                    from include/linux/perf_event.h:18,
                    from drivers//fpga/dfl-fme-perf.c:19:
   drivers//fpga/dfl-fme-perf.c: In function 'fme_perf_event_init':
   drivers//fpga/dfl-fme-perf.c:763:53: error: 'struct perf_event' has no member named 'pmu'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                                        ^
   include/linux/kernel.h:986:26: note: in definition of macro 'container_of'
     void *__mptr = (void *)(ptr);     \
                             ^
   drivers//fpga/dfl-fme-perf.c:763:31: note: in expansion of macro 'to_fme_perf_priv'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                  ^
   In file included from include/uapi/linux/swab.h:6:0,
                    from include/linux/swab.h:5,
                    from include/uapi/linux/byteorder/little_endian.h:13,
                    from include/linux/byteorder/little_endian.h:5,
                    from arch/mips/include/uapi/asm/byteorder.h:15,
                    from include/uapi/linux/perf_event.h:20,
                    from include/linux/perf_event.h:17,
                    from drivers//fpga/dfl-fme-perf.c:19:
   drivers//fpga/dfl-fme-perf.c:763:53: error: 'struct perf_event' has no member named 'pmu'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                                        ^
   include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
      if (!(condition))     \
            ^
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^
   include/linux/kernel.h:987:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
     ^
   include/linux/kernel.h:987:20: note: in expansion of macro '__same_type'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                       ^
   drivers//fpga/dfl-fme-perf.c:169:32: note: in expansion of macro 'container_of'
    #define to_fme_perf_priv(_pmu) container_of(_pmu, struct fme_perf_priv, pmu)
                                   ^
   drivers//fpga/dfl-fme-perf.c:763:31: note: in expansion of macro 'to_fme_perf_priv'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                  ^
   drivers//fpga/dfl-fme-perf.c:763:53: error: 'struct perf_event' has no member named 'pmu'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                                        ^
   include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
      if (!(condition))     \
            ^
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^
   include/linux/kernel.h:987:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
     ^
   include/linux/kernel.h:988:6: note: in expansion of macro '__same_type'
        !__same_type(*(ptr), void),   \
         ^
   drivers//fpga/dfl-fme-perf.c:169:32: note: in expansion of macro 'container_of'
    #define to_fme_perf_priv(_pmu) container_of(_pmu, struct fme_perf_priv, pmu)
                                   ^
   drivers//fpga/dfl-fme-perf.c:763:31: note: in expansion of macro 'to_fme_perf_priv'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                  ^
   drivers//fpga/dfl-fme-perf.c:764:36: error: 'struct perf_event' has no member named 'hw'
     struct hw_perf_event *hwc = &event->hw;
                                       ^
   drivers//fpga/dfl-fme-perf.c:769:11: error: 'struct perf_event' has no member named 'attr'
     if (event->attr.type != event->pmu->type)
              ^
   drivers//fpga/dfl-fme-perf.c:769:31: error: 'struct perf_event' has no member named 'pmu'
     if (event->attr.type != event->pmu->type)
                                  ^
>> drivers//fpga/dfl-fme-perf.c:777:6: error: implicit declaration of function 'is_sampling_event' [-Werror=implicit-function-declaration]
     if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
         ^
   drivers//fpga/dfl-fme-perf.c:777:39: error: 'struct perf_event' has no member named 'attach_state'
     if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
                                          ^
   drivers//fpga/dfl-fme-perf.c:780:11: error: 'struct perf_event' has no member named 'cpu'
     if (event->cpu < 0)
              ^
   In file included from include/uapi/linux/swab.h:6:0,
                    from include/linux/swab.h:5,
                    from include/uapi/linux/byteorder/little_endian.h:13,
                    from include/linux/byteorder/little_endian.h:5,
                    from arch/mips/include/uapi/asm/byteorder.h:15,
                    from include/uapi/linux/perf_event.h:20,
                    from include/linux/perf_event.h:17,
                    from drivers//fpga/dfl-fme-perf.c:19:
   drivers//fpga/dfl-fme-perf.c:783:27: error: 'struct perf_event' has no member named 'attr'
     eventid = get_event(event->attr.config);
                              ^
   include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
      if (!(condition))     \
            ^
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^
   include/linux/bitfield.h:52:3: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull,  \
      ^
   include/linux/bitfield.h:95:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
      ^
   drivers//fpga/dfl-fme-perf.c:203:28: note: in expansion of macro 'FIELD_GET'
    #define get_event(_config) FIELD_GET(FME_EVENT_MASK, _config)
                               ^
   drivers//fpga/dfl-fme-perf.c:783:12: note: in expansion of macro 'get_event'
     eventid = get_event(event->attr.config);
               ^
   In file included from drivers//fpga/dfl.h:17:0,
                    from drivers//fpga/dfl-fme-perf.c:20:
   drivers//fpga/dfl-fme-perf.c:783:27: error: 'struct perf_event' has no member named 'attr'
     eventid = get_event(event->attr.config);
                              ^
   include/linux/bitfield.h:96:21: note: in definition of macro 'FIELD_GET'
      (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
                        ^
   drivers//fpga/dfl-fme-perf.c:783:12: note: in expansion of macro 'get_event'
     eventid = get_event(event->attr.config);
               ^
   In file included from include/uapi/linux/swab.h:6:0,
                    from include/linux/swab.h:5,
                    from include/uapi/linux/byteorder/little_endian.h:13,
                    from include/linux/byteorder/little_endian.h:5,
                    from arch/mips/include/uapi/asm/byteorder.h:15,
                    from include/uapi/linux/perf_event.h:20,
                    from include/linux/perf_event.h:17,
                    from drivers//fpga/dfl-fme-perf.c:19:
   drivers//fpga/dfl-fme-perf.c:784:27: error: 'struct perf_event' has no member named 'attr'
     portid = get_portid(event->attr.config);
                              ^
   include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
      if (!(condition))     \
            ^
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^
   include/linux/bitfield.h:52:3: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull,  \
      ^
   include/linux/bitfield.h:95:3: note: in expansion of macro '__BF_FIELD_CHECK'
      __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
      ^
   drivers//fpga/dfl-fme-perf.c:205:29: note: in expansion of macro 'FIELD_GET'
    #define get_portid(_config) FIELD_GET(FME_PORTID_MASK, _config)
                                ^
   drivers//fpga/dfl-fme-perf.c:784:11: note: in expansion of macro 'get_portid'
     portid = get_portid(event->attr.config);
              ^
   In file included from drivers//fpga/dfl.h:17:0,
                    from drivers//fpga/dfl-fme-perf.c:20:
   drivers//fpga/dfl-fme-perf.c:784:27: error: 'struct perf_event' has no member named 'attr'
     portid = get_portid(event->attr.config);
                              ^
   include/linux/bitfield.h:96:21: note: in definition of macro 'FIELD_GET'
      (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
                        ^
   drivers//fpga/dfl-fme-perf.c:784:11: note: in expansion of macro 'get_portid'
     portid = get_portid(event->attr.config);
              ^

In file included from include/uapi/linux/swab.h:6:0,
from include/linux/swab.h:5,
from include/uapi/linux/byteorder/little_endian.h:13,
from include/linux/byteorder/little_endian.h:5,
from arch/mips/include/uapi/asm/byteorder.h:15,
from include/uapi/linux/perf_event.h:20,
--
drivers//fpga/dfl-fme-perf.c:790:5: error: 'struct hw_perf_event' has no member named 'idx'

     hwc->idx = (int)eventid;
        ^
   drivers//fpga/dfl-fme-perf.c:791:5: error: 'struct hw_perf_event' has no member named 'config_base'
     hwc->config_base = portid;
        ^
   drivers//fpga/dfl-fme-perf.c:793:7: error: 'struct perf_event' has no member named 'destroy'
     event->destroy = fme_perf_event_destroy;
          ^
   drivers//fpga/dfl-fme-perf.c: In function 'fme_perf_event_update':
   drivers//fpga/dfl-fme-perf.c:807:54: error: 'struct perf_event' has no member named 'hw'
     struct fme_perf_event_ops *ops = get_event_ops(event->hw.event_base);
                                                         ^
   In file included from include/asm-generic/bug.h:19:0,
                    from arch/mips/include/asm/bug.h:42,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:12,
                    from include/asm-generic/current.h:5,
                    from ./arch/mips/include/generated/asm/current.h:1,
                    from include/linux/sched.h:12,
                    from include/linux/ptrace.h:6,
                    from include/uapi/asm-generic/bpf_perf_event.h:4,
                    from ./arch/mips/include/generated/uapi/asm/bpf_perf_event.h:1,
                    from include/uapi/linux/bpf_perf_event.h:11,
                    from include/linux/perf_event.h:18,
                    from drivers//fpga/dfl-fme-perf.c:19:
   drivers//fpga/dfl-fme-perf.c:808:53: error: 'struct perf_event' has no member named 'pmu'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                                        ^
   include/linux/kernel.h:986:26: note: in definition of macro 'container_of'
     void *__mptr = (void *)(ptr);     \
                             ^
   drivers//fpga/dfl-fme-perf.c:808:31: note: in expansion of macro 'to_fme_perf_priv'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                  ^
   In file included from include/uapi/linux/swab.h:6:0,
                    from include/linux/swab.h:5,
                    from include/uapi/linux/byteorder/little_endian.h:13,
                    from include/linux/byteorder/little_endian.h:5,
                    from arch/mips/include/uapi/asm/byteorder.h:15,
                    from include/uapi/linux/perf_event.h:20,
                    from include/linux/perf_event.h:17,
                    from drivers//fpga/dfl-fme-perf.c:19:
   drivers//fpga/dfl-fme-perf.c:808:53: error: 'struct perf_event' has no member named 'pmu'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                                        ^
   include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
      if (!(condition))     \
            ^
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^
   include/linux/kernel.h:987:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
     ^
   include/linux/kernel.h:987:20: note: in expansion of macro '__same_type'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                       ^
   drivers//fpga/dfl-fme-perf.c:169:32: note: in expansion of macro 'container_of'
    #define to_fme_perf_priv(_pmu) container_of(_pmu, struct fme_perf_priv, pmu)
                                   ^
   drivers//fpga/dfl-fme-perf.c:808:31: note: in expansion of macro 'to_fme_perf_priv'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                  ^
   drivers//fpga/dfl-fme-perf.c:808:53: error: 'struct perf_event' has no member named 'pmu'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                                        ^
   include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
      if (!(condition))     \
            ^
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^
   include/linux/kernel.h:987:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
     ^
   include/linux/kernel.h:988:6: note: in expansion of macro '__same_type'
        !__same_type(*(ptr), void),   \
         ^
   drivers//fpga/dfl-fme-perf.c:169:32: note: in expansion of macro 'container_of'
    #define to_fme_perf_priv(_pmu) container_of(_pmu, struct fme_perf_priv, pmu)
                                   ^
   drivers//fpga/dfl-fme-perf.c:808:31: note: in expansion of macro 'to_fme_perf_priv'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                  ^
   drivers//fpga/dfl-fme-perf.c:809:36: error: 'struct perf_event' has no member named 'hw'
     struct hw_perf_event *hwc = &event->hw;
                                       ^
   drivers//fpga/dfl-fme-perf.c:812:40: error: 'struct hw_perf_event' has no member named 'idx'
     now = ops->read_counter(priv, (u32)hwc->idx, hwc->config_base);
                                           ^
   drivers//fpga/dfl-fme-perf.c:812:50: error: 'struct hw_perf_event' has no member named 'config_base'
     now = ops->read_counter(priv, (u32)hwc->idx, hwc->config_base);
                                                     ^
>> drivers//fpga/dfl-fme-perf.c:813:9: error: implicit declaration of function 'local64_read' [-Werror=implicit-function-declaration]
     prev = local64_read(&hwc->prev_count);
            ^
   drivers//fpga/dfl-fme-perf.c:813:26: error: 'struct hw_perf_event' has no member named 'prev_count'
     prev = local64_read(&hwc->prev_count);
                             ^
>> drivers//fpga/dfl-fme-perf.c:816:2: error: implicit declaration of function 'local64_add' [-Werror=implicit-function-declaration]
     local64_add(delta, &event->count);
     ^
   drivers//fpga/dfl-fme-perf.c:816:27: error: 'struct perf_event' has no member named 'count'
     local64_add(delta, &event->count);
                              ^
   drivers//fpga/dfl-fme-perf.c: In function 'fme_perf_event_start':
   drivers//fpga/dfl-fme-perf.c:821:54: error: 'struct perf_event' has no member named 'hw'
     struct fme_perf_event_ops *ops = get_event_ops(event->hw.event_base);
                                                         ^
   In file included from include/asm-generic/bug.h:19:0,
                    from arch/mips/include/asm/bug.h:42,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:12,
                    from include/asm-generic/current.h:5,
                    from ./arch/mips/include/generated/asm/current.h:1,
                    from include/linux/sched.h:12,
                    from include/linux/ptrace.h:6,
                    from include/uapi/asm-generic/bpf_perf_event.h:4,
                    from ./arch/mips/include/generated/uapi/asm/bpf_perf_event.h:1,
                    from include/uapi/linux/bpf_perf_event.h:11,
                    from include/linux/perf_event.h:18,
                    from drivers//fpga/dfl-fme-perf.c:19:
   drivers//fpga/dfl-fme-perf.c:822:53: error: 'struct perf_event' has no member named 'pmu'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                                        ^
   include/linux/kernel.h:986:26: note: in definition of macro 'container_of'
     void *__mptr = (void *)(ptr);     \
                             ^
   drivers//fpga/dfl-fme-perf.c:822:31: note: in expansion of macro 'to_fme_perf_priv'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                  ^
   In file included from include/uapi/linux/swab.h:6:0,
                    from include/linux/swab.h:5,
                    from include/uapi/linux/byteorder/little_endian.h:13,
                    from include/linux/byteorder/little_endian.h:5,
                    from arch/mips/include/uapi/asm/byteorder.h:15,
                    from include/uapi/linux/perf_event.h:20,
                    from include/linux/perf_event.h:17,
                    from drivers//fpga/dfl-fme-perf.c:19:
   drivers//fpga/dfl-fme-perf.c:822:53: error: 'struct perf_event' has no member named 'pmu'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                                        ^
   include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
      if (!(condition))     \
            ^
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^
   include/linux/kernel.h:987:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
     ^
   include/linux/kernel.h:987:20: note: in expansion of macro '__same_type'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                       ^
   drivers//fpga/dfl-fme-perf.c:169:32: note: in expansion of macro 'container_of'
    #define to_fme_perf_priv(_pmu) container_of(_pmu, struct fme_perf_priv, pmu)
                                   ^
   drivers//fpga/dfl-fme-perf.c:822:31: note: in expansion of macro 'to_fme_perf_priv'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                  ^
   drivers//fpga/dfl-fme-perf.c:822:53: error: 'struct perf_event' has no member named 'pmu'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                                        ^
   include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
      if (!(condition))     \
            ^
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^
   include/linux/kernel.h:987:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
     ^
   include/linux/kernel.h:988:6: note: in expansion of macro '__same_type'
        !__same_type(*(ptr), void),   \
         ^
   drivers//fpga/dfl-fme-perf.c:169:32: note: in expansion of macro 'container_of'
    #define to_fme_perf_priv(_pmu) container_of(_pmu, struct fme_perf_priv, pmu)
                                   ^
   drivers//fpga/dfl-fme-perf.c:822:31: note: in expansion of macro 'to_fme_perf_priv'
     struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
                                  ^
   drivers//fpga/dfl-fme-perf.c:823:36: error: 'struct perf_event' has no member named 'hw'
     struct hw_perf_event *hwc = &event->hw;
                                       ^
   drivers//fpga/dfl-fme-perf.c:826:42: error: 'struct hw_perf_event' has no member named 'idx'
     count = ops->read_counter(priv, (u32)hwc->idx, hwc->config_base);
                                             ^
   drivers//fpga/dfl-fme-perf.c:826:52: error: 'struct hw_perf_event' has no member named 'config_base'
     count = ops->read_counter(priv, (u32)hwc->idx, hwc->config_base);
                                                       ^
>> drivers//fpga/dfl-fme-perf.c:827:2: error: implicit declaration of function 'local64_set' [-Werror=implicit-function-declaration]
     local64_set(&hwc->prev_count, count);
     ^
   drivers//fpga/dfl-fme-perf.c:827:18: error: 'struct hw_perf_event' has no member named 'prev_count'
     local64_set(&hwc->prev_count, count);
                     ^
   drivers//fpga/dfl-fme-perf.c: In function 'fme_perf_pmu_register':
>> drivers//fpga/dfl-fme-perf.c:892:8: error: implicit declaration of function 'perf_pmu_register' [-Werror=implicit-function-declaration]
     ret = perf_pmu_register(pmu, name, -1);
           ^
   drivers//fpga/dfl-fme-perf.c: In function 'fme_perf_pmu_unregister':
>> drivers//fpga/dfl-fme-perf.c:901:2: error: implicit declaration of function 'perf_pmu_unregister' [-Werror=implicit-function-declaration]
     perf_pmu_unregister(&priv->pmu);
     ^

cc1: some warnings being treated as errors

vim +/is_sampling_event +777 drivers//fpga/dfl-fme-perf.c

760
761 static int fme_perf_event_init(struct perf_event *event)
762 {
763 struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
764 struct hw_perf_event *hwc = &event->hw;
765 struct fme_perf_event_ops *ops;
766 u32 eventid, evtype, portid;
767
768 /* test the event attr type check for PMU enumeration */
769 if (event->attr.type != event->pmu->type)
770 return -ENOENT;
771
772 /*
773 * fme counters are shared across all cores.
774 * Therefore, it does not support per-process mode.
775 * Also, it does not support event sampling mode.
776 */

 > 777		if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
   778			return -EINVAL;
   779	
   780		if (event->cpu < 0)
   781			return -EINVAL;
   782	
   783		eventid = get_event(event->attr.config);
   784		portid = get_portid(event->attr.config);
   785		evtype = get_evtype(event->attr.config);
   786		if (evtype > FME_EVTYPE_MAX)
   787			return -EINVAL;
   788	
   789		hwc->event_base = evtype;
   790		hwc->idx = (int)eventid;
   791		hwc->config_base = portid;
   792	
   793		event->destroy = fme_perf_event_destroy;
   794	
   795		dev_dbg(priv->dev, "%s event=0x%x, evtype=0x%x, portid=0x%x,\n",
   796			__func__, eventid, evtype, portid);
   797	
   798		ops = get_event_ops(evtype);
   799		if (ops->event_init)
   800			return ops->event_init(priv, eventid, portid);
   801	
   802		return 0;
   803	}
   804	
   805	static void fme_perf_event_update(struct perf_event *event)
   806	{
   807		struct fme_perf_event_ops *ops = get_event_ops(event->hw.event_base);
   808		struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
   809		struct hw_perf_event *hwc = &event->hw;
   810		u64 now, prev, delta;
   811	
   812		now = ops->read_counter(priv, (u32)hwc->idx, hwc->config_base);
 > 813		prev = local64_read(&hwc->prev_count);
   814		delta = now - prev;
   815	
 > 816		local64_add(delta, &event->count);
   817	}
   818	
   819	static void fme_perf_event_start(struct perf_event *event, int flags)
   820	{
   821		struct fme_perf_event_ops *ops = get_event_ops(event->hw.event_base);
   822		struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
   823		struct hw_perf_event *hwc = &event->hw;
   824		u64 count;
   825	
   826		count = ops->read_counter(priv, (u32)hwc->idx, hwc->config_base);
 > 827		local64_set(&hwc->prev_count, count);
   828	}
   829	
   830	static void fme_perf_event_stop(struct perf_event *event, int flags)
   831	{
   832		fme_perf_event_update(event);
   833	}
   834	
   835	static int fme_perf_event_add(struct perf_event *event, int flags)
   836	{
   837		if (flags & PERF_EF_START)
   838			fme_perf_event_start(event, flags);
   839	
   840		return 0;
   841	}
   842	
   843	static void fme_perf_event_del(struct perf_event *event, int flags)
   844	{
   845		fme_perf_event_stop(event, PERF_EF_UPDATE);
   846	}
   847	
   848	static void fme_perf_event_read(struct perf_event *event)
   849	{
   850		fme_perf_event_update(event);
   851	}
   852	
   853	static void fme_perf_setup_hardware(struct fme_perf_priv *priv)
   854	{
   855		void __iomem *base = priv->ioaddr;
   856		u64 v;
   857	
   858		/* read and save current working mode for fabric counters */
   859		v = readq(base + FAB_CTRL);
   860	
   861		if (FIELD_GET(FAB_PORT_FILTER, v) == FAB_PORT_FILTER_DISABLE)
   862			priv->fab_port_id = FME_PORTID_ROOT;
   863		else
   864			priv->fab_port_id = FIELD_GET(FAB_PORT_ID, v);
   865	}
   866	
   867	static int fme_perf_pmu_register(struct platform_device *pdev,
   868					 struct fme_perf_priv *priv)
   869	{
   870		struct pmu *pmu = &priv->pmu;
   871		char *name;
   872		int ret;
   873	
   874		spin_lock_init(&priv->fab_lock);
   875	
   876		fme_perf_setup_hardware(priv);
   877	
   878		pmu->task_ctx_nr =	perf_invalid_context;
   879		pmu->attr_groups =	fme_perf_groups;
   880		pmu->attr_update =	fme_perf_events_groups;
   881		pmu->event_init =	fme_perf_event_init;
   882		pmu->add =		fme_perf_event_add;
   883		pmu->del =		fme_perf_event_del;
   884		pmu->start =		fme_perf_event_start;
   885		pmu->stop =		fme_perf_event_stop;
   886		pmu->read =		fme_perf_event_read;
   887		pmu->capabilities =	PERF_PMU_CAP_NO_INTERRUPT |
   888					PERF_PMU_CAP_NO_EXCLUDE;
   889	
   890		name = devm_kasprintf(priv->dev, GFP_KERNEL, "fme%d", pdev->id);
   891	
 > 892		ret = perf_pmu_register(pmu, name, -1);
   893		if (ret)
   894			return ret;
   895	
   896		return 0;
   897	}
   898	
   899	static void fme_perf_pmu_unregister(struct fme_perf_priv *priv)
   900	{
 > 901		perf_pmu_unregister(&priv->pmu);

902 }
903

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

#4 lore raw

Re: [RESEND Patch v6 2/2] fpga: dfl: fme: add performance reporting support

In reply to Wu Hao
I love your patch! Perhaps something to improve:

Hi Wu,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.5-rc6 next-20200117]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Wu-Hao/add-performance-reporting-support-to-FPGA-DFL-drivers/20200118-043806
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 13b2668d6fc95dcecd11e4f86f47be24fda7da1f
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 7.5.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=sh

If you fix the issue, kindly add following tag

All warnings (new ones prefixed by >>):

drivers//fpga/dfl-fme-perf.c: In function 'fme_perf_fabric_events_visible':

>> drivers//fpga/dfl-fme-perf.c:600:8: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     var = (u64)eattr->var;
           ^

vim +600 drivers//fpga/dfl-fme-perf.c

590
591 static umode_t fme_perf_fabric_events_visible(struct kobject *kobj,
592 struct attribute *attr, int n)
593 {
594 struct pmu *pmu = dev_get_drvdata(kobj_to_dev(kobj));
595 struct fme_perf_priv *priv = to_fme_perf_priv(pmu);
596 struct dev_ext_attribute *eattr;
597 u64 var;
598
599 eattr = container_of(attr, struct dev_ext_attribute, attr.attr);

 > 600		var = (u64)eattr->var;

601
602 if (is_fabric_event_supported(priv, get_event(var), get_portid(var)))
603 return attr->mode;
604
605 return 0;
606 }
607

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

#5 lore raw

Re: [RESEND Patch v6 2/2] fpga: dfl: fme: add performance reporting support

In reply to Wu Hao

drivers/fpga/dfl-fme-perf.c line 613

Quoted 6 lines · Wu Hao
drivers/fpga/dfl-fme-perf.c new file +6 -0
+static const struct attribute_group fme_perf_fabric_events_group = {
+	.name = "events",
+	.attrs = fme_perf_fabric_events_attrs,
+	.is_visible = fme_perf_fabric_events_visible,
+};
+

I don't see any Documentation/ABI/ entries for all of these new files. Please properly document them so we know how to review this.

thanks,

greg k-h

author
#6 lore raw

Re: [RESEND Patch v6 2/2] fpga: dfl: fme: add performance reporting support

Quoted 10 lines · Greg KH

drivers/fpga/dfl-fme-perf.c line 613

Quoted 6 lines · Wu Hao
drivers/fpga/dfl-fme-perf.c new file +6 -0
+static const struct attribute_group fme_perf_fabric_events_group = {
+	.name = "events",
+	.attrs = fme_perf_fabric_events_attrs,
+	.is_visible = fme_perf_fabric_events_visible,
+};
+

I don't see any Documentation/ABI/ entries for all of these new files. Please properly document them so we know how to review this.

Hi Greg,

Thanks a lot for the review. Actually all the sysfs entries under events are perf monitoring events following the same format documented in "Documentation/ABI/testing/sysfs-bus-event_source-devices-events" and we added some description in our fpga documentation in patch #1.

Yes, I can add something in ABI directly as well in the next version. I pasted related descriptions below. I hope this won't block review.

Thank you very much!
Hao

Quoted 1 line

From Documentation/ABI/testing/sysfs-bus-event_source-devices-events

What: /sys/bus/event_source/devices/<pmu>/events/<event>
Date: 2014/02/24
Contact:        Linux kernel mailing list <[email protected]>
Description:    Per-pmu performance monitoring events specific to the running system

Each file (except for some of those with a '.' in them, '.unit' and '.scale') in the 'events' directory describes a single performance monitoring event supported by the <pmu>. The name of the file is the name of the event.

File contents:

<term>[=<value>][,<term>[=<value>]]...

Where <term> is one of the terms listed under /sys/bus/event_source/devices/<pmu>/format/ and <value> is a number is base-16 format with a '0x' prefix (lowercase only). If a <term> is specified alone (without an assigned value), it is implied that 0x1 is assigned to that <term>.

Examples (each of these lines would be in a seperate file):

event=0x2abc event=0x423,inv,cmask=0x3 domain=0x1,offset=0x8,starting_index=0xffff domain=0x1,offset=0x8,core=?

Each of the assignments indicates a value to be assigned to a particular set of bits (as defined by the format file corresponding to the <term>) in the perf_event structure passed to the perf_open syscall.

In the case of the last example, a value replacing "?" would need to be provided by the user selecting the particular event. This is referred to as "event parameterization". Event parameters have the format 'param=?'.

Quoted 1 line

From Documentation/fpga/dfl.rst added by patch #1.

"
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).
"

Quoted 4 lines

thanks,

greg k-h

author
#7 lore raw
In reply to Wu Hao

Hi Will

I resend this patch per suggestion from Greg.

Actually this is one important feature for users, but was blocked by code review for quite a long time (no comments since last November).

We really need your help on code review from perf, please help us..

Many Thanks!

Hao

Quoted 40 lines · Wu Hao

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 latest fpga/for-next branch.

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

 Documentation/fpga/dfl.rst  |  83 ++++
 drivers/fpga/Makefile       |   1 +
 drivers/fpga/dfl-fme-main.c |   4 +
 drivers/fpga/dfl-fme-perf.c | 943 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/fpga/dfl-fme.h      |   2 +
 drivers/fpga/dfl.h          |   2 +
 6 files changed, 1035 insertions(+)
 create mode 100644 drivers/fpga/dfl-fme-perf.c
Signature · 1 line
1.8.3.1