netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, Ido Schimmel <idosch@nvidia.com>,
	Petr Machata <petrm@nvidia.com>, Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Leon Romanovsky <leon@kernel.org>,
	Tariq Toukan <tariqt@nvidia.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	nex.sw.ncis.osdt.itp.upstreaming@intel.com,
	Wojciech Drewek <wojciech.drewek@intel.com>
Subject: Re: [PATCH net-next 4/5] devlink: embed driver's priv data callback param into devlink_resource
Date: Mon, 12 Aug 2024 17:00:19 +0200	[thread overview]
Message-ID: <Zrojg-svvDA7_OUV@nanopsycho.orion> (raw)
In-Reply-To: <589aed8d-500c-4e92-91ca-492302bb2542@intel.com>

Mon, Aug 12, 2024 at 01:50:06PM CEST, przemyslaw.kitszel@intel.com wrote:
>On 8/9/24 13:02, Jiri Pirko wrote:
>> Fri, Aug 09, 2024 at 04:41:50AM CEST, kuba@kernel.org wrote:
>> > On Wed, 7 Aug 2024 08:49:57 +0200 Jiri Pirko wrote:
>> > > > 	lockdep_assert_held(&devlink->lock);
>> > > > 
>> > > > 	resource = devlink_resource_find(devlink, NULL, resource_id);
>> > > > -	if (WARN_ON(!resource))
>> > > > +	if (WARN_ON(!resource || occ_priv_size > resource->priv_size))
>> > > 
>> > > Very odd. You allocate a mem in devl_resource_register() and here you
>> > > copy data to it. Why the void pointer is not enough for you? You can
>> > > easily alloc struct in the driver and pass a pointer to it.
>> > > 
>> > > This is quite weird. Please don't.
>> > 
>> > The patch is a bit of a half measure, true.
>
>Another option to suit my wants would be to just pass resource_id to the
>callbacks, would you accept that?

Why, the callback is registered for particular resource. Passing ID is
just redundant.


>
>> > 
>> > Could you shed more light on the design choices for the resource API,
>> > tho? Why the tying of objects by driver-defined IDs? It looks like
>> 
>> The ids are exposed all the way down to the user. They are the same
>> across the reboots and allow user to use the same scripts. Similar to
>> port index for example.
>> 
>> 
>> > the callback for getting resources occupancy is "added" later once
>> > the resource is registered? Is this some legacy of the old locking
>> > scheme? It's quite unusual.
>
>I did such review last month, many decisions really bother me :F, esp:
>- whole thing is about limiting resources, driver asks HW for occupancy.

Can you elaborate what's exactly wrong with that?


>
>Some minor things:
>- resizing request validation: parent asks children for permission;
>- the function to commit the size after the reload is named
>  devl_resource_size_get().
>
>From the user perspective, I'm going to add a setter, that will be
>another mode of operation (if compared to the first thing on my complain
>list):
>+ there is a limit that is constant, and driver/user allocates resource
>  from such pool.
>
>> 
>> It's been some while since I reviewed this, but afaik the reason is that
>> the occupancy was not possible to obtain during reload, yet the resource
>> itself stayed during reload. This is now not a problem, since
>> devlink->lock protects it. I don't see why occupancy getter cannot be
>> put during resource register, you are correct.
>> 
>I could add that to my todo list

Cool.


  reply	other threads:[~2024-08-12 15:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-06 14:33 [PATCH net-next 0/5] devlink: embed driver's priv data callback param into devlink_resource Przemek Kitszel
2024-08-06 14:33 ` [PATCH net-next 1/5] net: dsa: replace devlink resource registration calls by devl_ variants Przemek Kitszel
2024-08-06 14:33 ` [PATCH net-next 2/5] devlink: remove unused devlink_resource_occ_get_register() and _unregister() Przemek Kitszel
2024-08-06 14:33 ` [PATCH net-next 3/5] devlink: remove unused devlink_resource_register() Przemek Kitszel
2024-08-06 14:33 ` [PATCH net-next 4/5] devlink: embed driver's priv data callback param into devlink_resource Przemek Kitszel
2024-08-07  6:49   ` Jiri Pirko
2024-08-09  2:41     ` Jakub Kicinski
2024-08-09 11:02       ` Jiri Pirko
2024-08-12 11:50         ` Przemek Kitszel
2024-08-12 15:00           ` Jiri Pirko [this message]
2024-08-13  3:45             ` Przemek Kitszel
2024-08-13  5:41               ` Jiri Pirko
2024-08-16  8:33   ` kernel test robot
2024-08-06 14:33 ` [PATCH net-next 5/5] mlxsw: spectrum_kvdl: combine devlink resource occupation getters Przemek Kitszel
2024-08-07  6:47   ` Jiri Pirko
2024-08-12 11:23     ` Przemek Kitszel
2024-08-12 15:01       ` Jiri Pirko
2024-08-07  6:51 ` [PATCH net-next 0/5] devlink: embed driver's priv data callback param into devlink_resource Jiri Pirko

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=Zrojg-svvDA7_OUV@nanopsycho.orion \
    --to=jiri@resnulli.us \
    --cc=andrew@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nex.sw.ncis.osdt.itp.upstreaming@intel.com \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=wojciech.drewek@intel.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;
as well as URLs for NNTP newsgroup(s).