lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210802100343.GA27282@willie-the-truck>
Date:   Mon, 2 Aug 2021 11:03:43 +0100
From:   Will Deacon <will@...nel.org>
To:     Qi Liu <liuqi115@...wei.com>
Cc:     mark.rutland@....com, bhelgaas@...gle.com,
        linux-pci@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org, linuxarm@...wei.com,
        zhangshaokun@...ilicon.com
Subject: Re: [PATCH v8 2/2] drivers/perf: hisi: Add driver for HiSilicon PCIe
 PMU

On Wed, Jul 28, 2021 at 04:09:32PM +0800, Qi Liu wrote:
> PCIe PMU Root Complex Integrated End Point(RCiEP) device is supported
> to sample bandwidth, latency, buffer occupation etc.
> 
> Each PMU RCiEP device monitors multiple Root Ports, and each RCiEP is
> registered as a PMU in /sys/bus/event_source/devices, so users can
> select target PMU, and use filter to do further sets.
> 
> Filtering options contains:
> event        - select the event.
> subevent     - select the subevent.

Hmm, I was hoping that you would expose all the events as proper perf_events
and get rid of the subevents entirely.

Then userspace could do things like:

  // Count number of RX memory reads
  $ perf stat -e hisi_pcie0_0/rx_memory_read/

  // Count delay cycles
  $ perf stat -e hisi_pcie0_0/latency/

  // Count both of the above (events must be in the same group)
  $ perf stat -g -e hisi_pcie0_0/latency/ -e hisi_pcie0_0/rx_memory_read/

Note that in all three of these cases the hardware will be programmed in
the same way and both HISI_PCIE_CNT and HISI_PCIE_EXT_CNT are allocated!

So for example, doing this (i.e. without the '-g'):

  $ perf stat -e hisi_pcie0_0/latency/ -e hisi_pcie0_0/rx_memory_read/

would fail because the first event would allocate both of the counters.

All you need to do is check the counter scheduling constraints when
accepting an event group in the driver. No need for subevents at all.

Does that make sense?

Will

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ