lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZrryHH4VbiPSdFzx@nanopsycho.orion>
Date: Tue, 13 Aug 2024 07:41:48 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: Przemek Kitszel <przemyslaw.kitszel@...el.com>
Cc: Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
	Ido Schimmel <idosch@...dia.com>, Petr Machata <petrm@...dia.com>,
	Andrew Lunn <andrew@...n.ch>,
	Florian Fainelli <f.fainelli@...il.com>,
	Vladimir Oltean <olteanv@...il.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
	Saeed Mahameed <saeedm@...dia.com>,
	Leon Romanovsky <leon@...nel.org>, Tariq Toukan <tariqt@...dia.com>,
	Tony Nguyen <anthony.l.nguyen@...el.com>,
	nex.sw.ncis.osdt.itp.upstreaming@...el.com,
	Wojciech Drewek <wojciech.drewek@...el.com>
Subject: Re: [PATCH net-next 4/5] devlink: embed driver's priv data callback
 param into devlink_resource

Tue, Aug 13, 2024 at 05:45:47AM CEST, przemyslaw.kitszel@...el.com wrote:
>On 8/12/24 17:00, Jiri Pirko wrote:
>> Mon, Aug 12, 2024 at 01:50:06PM CEST, przemyslaw.kitszel@...el.com wrote:
>> > On 8/9/24 13:02, Jiri Pirko wrote:
>> > > Fri, Aug 09, 2024 at 04:41:50AM CEST, kuba@...nel.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.
>
>Yet enables one to nicely combine all occ getters/setters for given

I don't see the benefit, sorry :/

>resource group. It is also straightforward (compared to this series).
>You are right it is not absolutely necessary, but does not hurt and
>improves thing (this time I will don't update mlxsw just to have
>consumer though, will just post later - as this is not so controversial,
>I hope).
>
>> 
>> 
>> > 
>> > > > 
>> > > > 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?
>
>Typical way to think about resources is "there are X foos" (resource
>register time), "give me one foo" (later, on user request). Users could
>be heterogeneous, such as VFs and PFs, and resource pool shared over.
>This is what I have for (different sizes of) RSS contexes.
>(Limit is constant, need to "get*" resources by one at a time, so driver
>knows occupancy and arbitrages usage requests).
>
>"get*" == set usage to be increased by one
>
>> 
>> 
>> > 
>> > 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.
>
>I guess no one cared about it yet, as resource register and occ getter
>register is much separated in code space (to the point of being in
>different file).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ