• Wu Hao's avatar
    fpga: dfl: fme: add performance reporting support · 724142f8
    Wu Hao authored
    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
    
      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 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 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
    Signed-off-by: default avatarLuwei Kang <luwei.kang@intel.com>
    Signed-off-by: default avatarXu Yilun <yilun.xu@intel.com>
    Signed-off-by: default avatarWu Hao <hao.wu@intel.com>
    Link: https://lore.kernel.org/r/1587949583-12058-3-git-send-email-hao.wu@intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    724142f8
dfl-fme-perf.c 29.5 KB