Subject: Re: [PATCH net-next 2/9] net: devlink: remove region snapshots list dependency on devlink->lock

From: Jiri Pirko <[email-masked]>
Date: Thu, 28 Jul 2022 10:50:29 +0200

Thu, Jul 28, 2022 at 04:01:56AM CEST, [email-masked] wrote:
>On Wed, 27 Jul 2022 20:03:29 +0300 Moshe Shemesh wrote:
>> From: Jiri Pirko <[email-masked]>
>> 
>> After mlx4 driver is converted to do locked reload,
>> devlink_region_snapshot_create() may be called from both locked and
>> unlocked context.
>
>You need to explain why, tho. What makes region snapshots special? 

Will do.

>
>> So resolve this by removing dependency on devlink->lock for region
>> snapshots list consistency and introduce new mutex to ensure it.
>
>I was hoping to avoid per-subobject locks. What prevents us from
>depending on the instance lock here (once the driver is converted)?

The fact that it could be called in mlx4 from both devl locked and
unlocked context. Basically whenever CMD to fw is called.

What is wrong in small locks here and there when they are sufficient?