From: Hans de Goede <hdegoede@redhat.com>
To: Luiz Capitulino <luizcap@redhat.com>,
ilpo.jarvinen@linux.intel.com, shravankr@nvidia.com
Cc: davthompson@nvidia.com, ndalvi@redhat.com,
linux-kernel@vger.kernel.org,
platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH 2/2] platform/mellanox: mlxbf-pmc: Ignore unsupported performance blocks
Date: Mon, 26 Feb 2024 11:49:47 +0100 [thread overview]
Message-ID: <3a641698-a0eb-4335-932a-2f0ae73dab44@redhat.com> (raw)
In-Reply-To: <f8e2e6210b43e825b69824b420c801cd513d401d.1708635408.git.luizcap@redhat.com>
Hi,
On 2/22/24 21:57, Luiz Capitulino wrote:
> Currently, the driver has two behaviors to deal with new & unsupported
> performance blocks reported by the firmware:
>
> 1. For register and unknown block types, the driver will fail to load
> with the following error message:
>
> [ 4510.956369] mlxbf-pmc: probe of MLNXBFD2:00 failed with error -22
>
> 2. For counter and crspace blocks, the driver will load and sysfs files
> will be created but getting the contents of event_list or trying to
> setup the counter will fail
>
> Instead, let's ignore and log unsupported blocks. This means the driver
> will always load and unsupported blocks will never show up in sysfs.
>
> Signed-off-by: Luiz Capitulino <luizcap@redhat.com>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
> ---
> drivers/platform/mellanox/mlxbf-pmc.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/mellanox/mlxbf-pmc.c b/drivers/platform/mellanox/mlxbf-pmc.c
> index b71636eb3db1..746567767e5b 100644
> --- a/drivers/platform/mellanox/mlxbf-pmc.c
> +++ b/drivers/platform/mellanox/mlxbf-pmc.c
> @@ -1043,6 +1043,11 @@ static const struct mlxbf_pmc_events *mlxbf_pmc_event_list(const char *blk, size
> return events;
> }
>
> +static bool mlxbf_pmc_event_supported(const char *blk)
> +{
> + return !!mlxbf_pmc_event_list(blk, NULL);
> +}
> +
> /* Get the event number given the name */
> static int mlxbf_pmc_get_event_num(const char *blk, const char *evt)
> {
> @@ -1761,6 +1766,9 @@ static int mlxbf_pmc_init_perftype_counter(struct device *dev, unsigned int blk_
> struct mlxbf_pmc_attribute *attr;
> unsigned int i = 0, j = 0;
>
> + if (!mlxbf_pmc_event_supported(pmc->block_name[blk_num]))
> + return -ENOENT;
> +
> /* "event_list" sysfs to list events supported by the block */
> attr = &pmc->block[blk_num].attr_event_list;
> attr->dev_attr.attr.mode = 0444;
> @@ -1840,7 +1848,7 @@ static int mlxbf_pmc_init_perftype_reg(struct device *dev, unsigned int blk_num)
>
> events = mlxbf_pmc_event_list(pmc->block_name[blk_num], &count);
> if (!events)
> - return -EINVAL;
> + return -ENOENT;
>
> pmc->block[blk_num].attr_event = devm_kcalloc(
> dev, count, sizeof(struct mlxbf_pmc_attribute), GFP_KERNEL);
> @@ -1878,7 +1886,7 @@ static int mlxbf_pmc_create_groups(struct device *dev, unsigned int blk_num)
> else if (pmc->block[blk_num].type == MLXBF_PMC_TYPE_REGISTER)
> err = mlxbf_pmc_init_perftype_reg(dev, blk_num);
> else
> - err = -EINVAL;
> + err = -ENOENT;
>
> if (err)
> return err;
> @@ -1983,6 +1991,10 @@ static int mlxbf_pmc_map_counters(struct device *dev)
> return -ENOMEM;
>
> ret = mlxbf_pmc_create_groups(dev, i);
> + if (ret == -ENOENT) {
> + dev_warn(dev, "ignoring unsupported block: '%s'\n", pmc->block_name[i]);
> + continue;
> + }
> if (ret)
> return ret;
> }
next prev parent reply other threads:[~2024-02-26 10:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-22 20:57 [PATCH 0/2] platform/mellanox: mlxbf-pmc: Fix module loading Luiz Capitulino
2024-02-22 20:57 ` [PATCH 1/2] platform/mellanox: mlxbf-pmc: mlxbf_pmc_event_list(): make size ptr optional Luiz Capitulino
2024-02-26 10:49 ` Hans de Goede
2024-02-22 20:57 ` [PATCH 2/2] platform/mellanox: mlxbf-pmc: Ignore unsupported performance blocks Luiz Capitulino
2024-02-26 10:49 ` Hans de Goede [this message]
2024-02-26 13:27 ` [PATCH 0/2] platform/mellanox: mlxbf-pmc: Fix module loading Ilpo Järvinen
2024-02-26 15:49 ` Luiz Capitulino
2024-02-26 16:04 ` Ilpo Järvinen
2024-02-26 16:10 ` Luiz Capitulino
2024-02-26 16:57 ` Hans de Goede
2024-02-26 17:05 ` Luiz Capitulino
2024-02-27 13:18 ` Ilpo Järvinen
2024-02-27 18:28 ` Luiz Capitulino
2024-02-26 16:59 ` Ilpo Järvinen
2024-02-26 17:07 ` Luiz Capitulino
2024-02-27 13:20 ` Ilpo Järvinen
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=3a641698-a0eb-4335-932a-2f0ae73dab44@redhat.com \
--to=hdegoede@redhat.com \
--cc=davthompson@nvidia.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luizcap@redhat.com \
--cc=ndalvi@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=shravankr@nvidia.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
all inboxes | Powered by JetHome®