[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<DM4PR12MB513613B05FB14A933AB7304DC00E2@DM4PR12MB5136.namprd12.prod.outlook.com>
Date: Thu, 18 Apr 2024 12:06:22 +0000
From: Shravan Ramani <shravankr@...dia.com>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
CC: Hans de Goede <hdegoede@...hat.com>, Vadim Pasternak <vadimp@...dia.com>,
David Thompson <davthompson@...dia.com>,
"platform-driver-x86@...r.kernel.org" <platform-driver-x86@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1 2/3] platform/mellanox: mlxbf-pmc: Add support for
64-bit counters and cycle count
> On Wed, 17 Apr 2024, Shravan Kumar Ramani wrote:
>
> > Add support for programming any counter to monitor the cycle count.
> > Since counting of cycles using 32-bit ocunters would result in frequent
> > wraparounds, add the ability to combine 2 adjacent 32-bit counters to
> > form 1 64-bit counter.
> > Both these features are supported by BlueField-3 PMC hardware, hence
> > the required bit-fields are exposed by the driver via sysfs to allow
> > the user to configure as needed.
> >
> > Signed-off-by: Shravan Kumar Ramani <shravankr@...dia.com>
> > Reviewed-by: David Thompson <davthompson@...dia.com>
> > Reviewed-by: Vadim Pasternak <vadimp@...dia.com>
> > ---
>
> > @@ -1799,6 +1902,37 @@ static int mlxbf_pmc_init_perftype_counter(struct device *dev, unsigned int blk_
> > attr = NULL;
> > }
> >
> > + if (pmc->block[blk_num].type == MLXBF_PMC_TYPE_CRSPACE) {
> > + /*
> > + * Couple adjacent odd and even 32-bit counters to form 64-bit counters
> > + * using "use_odd_counter" sysfs which has one bit per even counter.
> > + */
> > + attr = &pmc->block[blk_num].attr_use_odd_counter;
> > + attr->dev_attr.attr.mode = 0644;
> > + attr->dev_attr.show = mlxbf_pmc_use_odd_counter_show;
> > + attr->dev_attr.store = mlxbf_pmc_use_odd_counter_store;
> > + attr->nr = blk_num;
> > + attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL,
> > + "use_odd_counter");
> > + if (!attr->dev_attr.attr.name)
> > + return -ENOMEM;
> > + pmc->block[blk_num].block_attr[++i] = &attr->dev_attr.attr;
> > + attr = NULL;
> > +
> > + /* Program crspace counters to count clock cycles using "count_clock" sysfs */
> > + attr = &pmc->block[blk_num].attr_count_clock;
> > + attr->dev_attr.attr.mode = 0644;
> > + attr->dev_attr.show = mlxbf_pmc_count_clock_show;
> > + attr->dev_attr.store = mlxbf_pmc_count_clock_store;
> > + attr->nr = blk_num;
> > + attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL,
> > + "count_clock");
> > + if (!attr->dev_attr.attr.name)
> > + return -ENOMEM;
> > + pmc->block[blk_num].block_attr[++i] = &attr->dev_attr.attr;
> > + attr = NULL;
> > + }
>
> Hi,
>
> What was the reason why this driver could not use .dev_groups to setup
> sysfs (filtering can be done with .is_visible)?
>
The current approach was suggested during the initial submission of the driver and the same has
been followed since. Do you mean to add a is_visible routine for each of the sysfs types like
count_clock, use_odd_counter, etc and check the conditions for their inclusion in this routine?
Thanks,
Shravan
Powered by blists - more mailing lists