mbox series

[SRU,F:linux-bluefield,v2,0/1] Bug fix for mlxbf-pmc

Message ID cover.1663673280.git.shravankr@nvidia.com
Headers show
Series Bug fix for mlxbf-pmc | expand

Message

Shravan Kumar Ramani Sept. 20, 2022, 11:41 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1989172

SRU Justification:

[Impact]
When the counters are not programmed to monitor any events, reading the
"event<n>" file results in the following error:
cat: /sys/class/hwmon/hwmon0/smmu0/event0: Invalid argument
This is misleading and instead needs to indicate that the counter is currently
not enabled.

[Fix]
* First, skip the check for whether the counter is enabled when reading the event
info. If the counter is not enabled, it should return 0, which is the default
value when coming out of reset.
* 0 is not a valid event in most blocks as per the respective event lists, so
add a "Disable" event to all the event lists.

[Test Case]
Without the fix, reading any "event" file right after reset when the counters
are not programmed should result in the following error:
cat: /sys/class/hwmon/hwmon0/smmu0/event0: Invalid argument

With the fix, it should instead print:
0x0: DISABLE

[Regression Potential]
Can be considered minimal

Shravan Kumar Ramani (1):
  UBUNTU: SAUCE: mlxbf-pmc: Fix error when reading unprogrammed events

 drivers/platform/mellanox/mlxbf-pmc.c | 24 ++----------------------
 drivers/platform/mellanox/mlxbf-pmc.h |  6 ++++++
 2 files changed, 8 insertions(+), 22 deletions(-)

Comments

Tim Gardner Sept. 20, 2022, 12:23 p.m. UTC | #1
On 9/20/22 05:41, Shravan Kumar Ramani wrote:
> BugLink: https://bugs.launchpad.net/bugs/1989172
> 
> SRU Justification:
> 
> [Impact]
> When the counters are not programmed to monitor any events, reading the
> "event<n>" file results in the following error:
> cat: /sys/class/hwmon/hwmon0/smmu0/event0: Invalid argument
> This is misleading and instead needs to indicate that the counter is currently
> not enabled.
> 
> [Fix]
> * First, skip the check for whether the counter is enabled when reading the event
> info. If the counter is not enabled, it should return 0, which is the default
> value when coming out of reset.
> * 0 is not a valid event in most blocks as per the respective event lists, so
> add a "Disable" event to all the event lists.
> 
> [Test Case]
> Without the fix, reading any "event" file right after reset when the counters
> are not programmed should result in the following error:
> cat: /sys/class/hwmon/hwmon0/smmu0/event0: Invalid argument
> 
> With the fix, it should instead print:
> 0x0: DISABLE
> 
> [Regression Potential]
> Can be considered minimal
> 
> Shravan Kumar Ramani (1):
>    UBUNTU: SAUCE: mlxbf-pmc: Fix error when reading unprogrammed events
> 
>   drivers/platform/mellanox/mlxbf-pmc.c | 24 ++----------------------
>   drivers/platform/mellanox/mlxbf-pmc.h |  6 ++++++
>   2 files changed, 8 insertions(+), 22 deletions(-)
> 
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Bartlomiej Zolnierkiewicz Sept. 21, 2022, 2:36 p.m. UTC | #2
Acked-by: Bartlomiej Zolnierkiewicz <bartlomiej.zolnierkiewicz@canonical.com>

On Tue, Sep 20, 2022 at 1:42 PM Shravan Kumar Ramani
<shravankr@nvidia.com> wrote:
>
> BugLink: https://bugs.launchpad.net/bugs/1989172
>
> SRU Justification:
>
> [Impact]
> When the counters are not programmed to monitor any events, reading the
> "event<n>" file results in the following error:
> cat: /sys/class/hwmon/hwmon0/smmu0/event0: Invalid argument
> This is misleading and instead needs to indicate that the counter is currently
> not enabled.
>
> [Fix]
> * First, skip the check for whether the counter is enabled when reading the event
> info. If the counter is not enabled, it should return 0, which is the default
> value when coming out of reset.
> * 0 is not a valid event in most blocks as per the respective event lists, so
> add a "Disable" event to all the event lists.
>
> [Test Case]
> Without the fix, reading any "event" file right after reset when the counters
> are not programmed should result in the following error:
> cat: /sys/class/hwmon/hwmon0/smmu0/event0: Invalid argument
>
> With the fix, it should instead print:
> 0x0: DISABLE
>
> [Regression Potential]
> Can be considered minimal
>
> Shravan Kumar Ramani (1):
>   UBUNTU: SAUCE: mlxbf-pmc: Fix error when reading unprogrammed events
>
>  drivers/platform/mellanox/mlxbf-pmc.c | 24 ++----------------------
>  drivers/platform/mellanox/mlxbf-pmc.h |  6 ++++++
>  2 files changed, 8 insertions(+), 22 deletions(-)
Bartlomiej Zolnierkiewicz Sept. 21, 2022, 3:26 p.m. UTC | #3
Applied to focal:linux-bluefield. Thanks.

--
Best regards,
Bartlomiej

On Tue, Sep 20, 2022 at 1:42 PM Shravan Kumar Ramani
<shravankr@nvidia.com> wrote:
>
> BugLink: https://bugs.launchpad.net/bugs/1989172
>
> SRU Justification:
>
> [Impact]
> When the counters are not programmed to monitor any events, reading the
> "event<n>" file results in the following error:
> cat: /sys/class/hwmon/hwmon0/smmu0/event0: Invalid argument
> This is misleading and instead needs to indicate that the counter is currently
> not enabled.
>
> [Fix]
> * First, skip the check for whether the counter is enabled when reading the event
> info. If the counter is not enabled, it should return 0, which is the default
> value when coming out of reset.
> * 0 is not a valid event in most blocks as per the respective event lists, so
> add a "Disable" event to all the event lists.
>
> [Test Case]
> Without the fix, reading any "event" file right after reset when the counters
> are not programmed should result in the following error:
> cat: /sys/class/hwmon/hwmon0/smmu0/event0: Invalid argument
>
> With the fix, it should instead print:
> 0x0: DISABLE
>
> [Regression Potential]
> Can be considered minimal
>
> Shravan Kumar Ramani (1):
>   UBUNTU: SAUCE: mlxbf-pmc: Fix error when reading unprogrammed events
>
>  drivers/platform/mellanox/mlxbf-pmc.c | 24 ++----------------------
>  drivers/platform/mellanox/mlxbf-pmc.h |  6 ++++++
>  2 files changed, 8 insertions(+), 22 deletions(-)