linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: Guangbin Huang <huangguangbin2@huawei.com>, <will@kernel.org>,
	<mark.rutland@arm.com>
Cc: <liuqi115@huawei.com>, <zhangshaokun@hisilicon.com>,
	<f.fangjian@huawei.com>, <linux-arm-kernel@lists.infradead.org>,
	<lipeng321@huawei.com>, <shenjian15@huawei.com>,
	<linyunsheng@huawei.com>, <tanhuazhong@huawei.com>
Subject: Re: [RFC PATCH 1/2] {topost} drivers/perf: hisi: Add description for HNS3 PMU driver
Date: Thu, 25 Mar 2021 15:13:14 +0000	[thread overview]
Message-ID: <4a184ed1-4b07-bca5-bf12-10aef723f53f@huawei.com> (raw)
In-Reply-To: <1616377787-1550-2-git-send-email-huangguangbin2@huawei.com>

On 22/03/2021 01:49, Guangbin Huang wrote:

please remove {topost} next time

> HNS3 PMU End Point device is supported on HiSilicon HIP09 platform, so
> add document hns3-pmu.rst to provide guidance on how to use it.
> 

sorry, I didn't do much review of this before sending out...

> Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
> ---
>   Documentation/admin-guide/perf/hns3-pmu.rst | 125 ++++++++++++++++++++++++++++
>   1 file changed, 125 insertions(+)
>   create mode 100644 Documentation/admin-guide/perf/hns3-pmu.rst
> 
> diff --git a/Documentation/admin-guide/perf/hns3-pmu.rst b/Documentation/admin-guide/perf/hns3-pmu.rst
> new file mode 100644
> index 0000000..3597a8e
> --- /dev/null
> +++ b/Documentation/admin-guide/perf/hns3-pmu.rst
> @@ -0,0 +1,125 @@
> +======================================
> +HNS3 Performance Monitoring Unit (PMU)
> +======================================
> +
> +HNS3(HiSilicon network system 3) Performance Monitoring Unit (PMU) is an
> +End Point device to collect performance statistics of HiSilicon SoC NIC.
> +On Hip09, each SICL has one PMU device.

Even though the hisi-pmu doc now mentions what is SICL, it is also 
better mention here what it is.

> +
> +HNS3 PMU is supported to collect performance statistics of bandwidth,
> +latency, packet rate and interrupt rate.
> +
> +Each HNS3 PMU supports up to 8 hardware events.
> +
> +HNS3 PMU driver
> +===============
> +
> +The HNS3 PMU driver registers a perf PMU with the name of its device id.::
> +
> +  /sys/devices/hns3_pmu_<device_id>

any reason for which sicl is not used in the same?

How is a anyone supposed to know which device hns3_pmu_0 - for example - 
is ?

> +
> +PMU driver provides description of available events, filter modes, format,
> +identifier and cpumask in sysfs.
> +
> +The "events" directory describes the event code and subevent code of all
> +supported events shown in perf list.
> +
> +The "filtermode" directory describes the supported filter modes of each
> +event.
> +
> +The "format" directory describes all formats of the config (events) and
> +config1 (filter options) fields of the perf_event_attr structure.
> +
> +The "identifier" file shows version of PMU hardware device.
> +
> +The "cpumask" file shows which CPU is PMU driver running on.

isn't that really the CPUs associated with that PMU?

> +
> +Example usage of checking event code and subevent code::
> +
> +  $# cat /sys/devices/hns3_pmu_0/events/bw_igu_ssu
> +  event=0x0, subevent=0x0

as below

> +
> +Example usage of checking supported filter mode::
> +
> +  $# cat /sys/devices/hns3_pmu_0/filtermode/bw_igu_ssu
> +  filter mode supported: global/port/port-tc/

A sysfs file should just hold a single value is a basic rule

> +
> +Example usage of perf::
> +
> +  $# perf list
> +  hns3_pmu_0/bw_igu_ssu/ [kernel PMU event]
> +  ------------------------------------------
> +
> +  $# perf stat -a -e hns3_pmu_0/bw_igu_ssu,global=1/ -I 1000
> +  or
> +  $# perf stat -a -e hns3_pmu_0/event=0,subevent=0,global=1/ -I 1000
> +
> +The current driver does not support sampling. So "perf record" is unsupported.
> +Also attach to a task is unsupported for HNS3 PMU.
> +
> +Filter modes
> +--------------
> +
> +1. global mode
> +PMU collect performance statistic of all functions of IO DIE. Set the
> +"global" filter option to 1 will enable this mode.
> +Example usage of perf::
> +
> +  $# perf stat -a -e hns3_pmu_0/event=0,subevent=0,global=1/ -I 1000
> +
> +2. port mode
> +PMU collect performance statistic of one whole physical port. The port id
> +is same as mac id. The "tc" filter option must be set to 0xF in this mode.
> +Example usage of perf::
> +
> +  $# perf stat -a -e hns3_pmu_0/event=0,subevent=0,port=0,tc=0xF/ -I 1000
> +
> +3. port-tc mode
> +PMU collect performance statistic of one tc of physical port. The port id
> +is same as mac id. The "tc" filter option must be set to 0 ~ 7 in this
> +mode.
> +Example usage of perf::
> +
> +  $# perf stat -a -e hns3_pmu_0/event=0,subevent=0,port=0,tc=0/ -I 1000
> +
> +4. func mode
> +PMU collect performance statistic of one PF/VF. The function id is BDF of
> +PF/VF, its conversion formula::
> +
> +  func = (bus << 8) + (device << 3) + (function)
> +
> +for example:
> +  BDF         func
> +  35:00.0    0x3500
> +  35:00.1    0x3501
> +  35:01.0    0x3508

any reason why we can't have each nibble holding a digit of BDF?  0x3508 
look strange

> +
> +In this mode, the "queue" filter option must be set to 0xFFFF.
> +Example usage of perf::
> +
> +  $# perf stat -a -e hns3_pmu_0/event=0,subevent=0,func=0x3500,queue=0xFFFF/ -I 1000
> +
> +5. func-queue mode
> +PMU collect performance statistic of one queue of PF/VF. The function id
> +is BDF of PF/VF, its conversion formula::
> +
> +  func = (bus << 8) + (device << 3) + (function)
> +
> +In this mode, the "queue" filter option must be set to the exact queue id
> +of function.
> +Example usage of perf::
> +
> +  $# perf stat -a -e hns3_pmu_0/event=0,subevent=0,func=0x3500,queue=0/ -I 1000
> +

To me it's odd that the difference between func mode and func-queue mode 
is just setting the queue=0xffff or queue=0 - seems to be just the same 
mode with a different queue option

> +
> +6. func-intr mode
> +PMU collect performance statistic of one interrupt of PF/VF. The function
> +id is BDF of PF/VF, its conversion formula::
> +
> +  func = (bus << 8) + (device << 3) + (function)
> +
> +In this mode, the "intr" filter option must be set to the exact interrupt
> +id of function.
> +Example usage of perf::
> +
> +  $# perf stat -a -e hns3_pmu_0/event=0,subevent=0,func=0x3500,intr=0/ -I 1000
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-03-25 15:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22  1:49 [RFC PATCH 0/2] {topost} drivers/perf: hisi: Add driver for HNS3 PMU Guangbin Huang
2021-03-22  1:49 ` [RFC PATCH 1/2] {topost} drivers/perf: hisi: Add description for HNS3 PMU driver Guangbin Huang
2021-03-25 15:13   ` John Garry [this message]
2021-03-22  1:49 ` [RFC PATCH 2/2] {topost} drivers/perf: hisi: add driver for HNS3 PMU Guangbin Huang
2021-03-25 15:53   ` John Garry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a184ed1-4b07-bca5-bf12-10aef723f53f@huawei.com \
    --to=john.garry@huawei.com \
    --cc=f.fangjian@huawei.com \
    --cc=huangguangbin2@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linyunsheng@huawei.com \
    --cc=lipeng321@huawei.com \
    --cc=liuqi115@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=shenjian15@huawei.com \
    --cc=tanhuazhong@huawei.com \
    --cc=will@kernel.org \
    --cc=zhangshaokun@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).