[SRU][J:linux-bluefield][PATCH v1 0/2] Enhancements to mlxbf-pmc

Shravan Kumar Ramani shravankr at nvidia.com
Thu Nov 2 06:20:41 UTC 2023


This submission contains 2 patches:

1. Support for 64-bit counters and monitoring cycle counts

BugLink: https://bugs.launchpad.net/bugs/2042525

SRU Justification:

[Impact]
Currently, there is no method to keep track of the cycle count when an event
is being monitored. And since cycle count increments quickly, the 32-bit counter
values could wrap around and hence support for 64-bit counters is also needed
for the same.

[Fix]
Expose 2 additional sysfs entries: count_clock and use_odd_counter. These fields
are supported in BlueField-3 PMC hardware and each bit in count_clock
corresponds to each counter, while each bit in use_odd_counter corresponds to an
even counter.
Exposing these fields will allow the user to program any counter of choice to
monitor the cycle count for the required duration.
Similarly, use_odd_counter can be set to couple 2 adjacent odd and even counters
to form a 64-bit counter.

[Test Case]
1. Verify that count_clock and use_odd_counter sysfs entries are created for
each BlueField-3 HW block.
These are not supported by BlueField-1 or BlueField-2 HW.
2. Set any bit in count_clock and check if the corresponding counter values
increment after enabling.
3. Set any bit in use_odd_counter and check if the cycle count increments on
2 counters with the odd counter being the lower 32 bits and the even counter
being the upper 32 bits.

[Regression Potential]
Can be considered minimal.

2. Addition of clock_measure performance events

BugLink: https://bugs.launchpad.net/bugs/2042527

SRU Justification:

[Impact]
Currently, the counters under the clock_measure HW block are not supported by
the driver and is a new requirement for calculating performance metrics.

[Fix]
Add support for "clock_measure" block by passing the block info via ACPI.
The events monitored by these counters is added to the driver and exposed via
a new sysfs sub-directory for this block.

[Test Case]
Read any of the registers listed under the "clock_measure" sub-directory.
These fields are read-only and hence all writes will be blocked by the driver.

[Regression Potential]
Can be considered minimal.

Shravan Kumar Ramani (2):
  UBUNTU: SAUCE: mlxbf-pmc: Add support for 64-bit counters and cycle
    count
  UBUNTU: SAUCE: mlxbf-pmc: Add support for clock_measure performance
    block

 drivers/platform/mellanox/mlxbf-pmc.c | 174 +++++++++++++++++++++++++-
 1 file changed, 170 insertions(+), 4 deletions(-)

-- 
2.30.1




More information about the kernel-team mailing list