[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YteyloM9mtRqCI0T@shredder>
Date: Wed, 20 Jul 2022 10:45:26 +0300
From: Ido Schimmel <idosch@...dia.com>
To: Jiri Pirko <jiri@...nulli.us>
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
petrm@...dia.com, pabeni@...hat.com, edumazet@...gle.com,
mlxsw@...dia.com, saeedm@...dia.com, snelson@...sando.io
Subject: Re: [patch net-next v2 01/12] net: devlink: make sure that
devlink_try_get() works with valid pointer during xarray iteration
On Tue, Jul 19, 2022 at 08:48:36AM +0200, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@...dia.com>
>
> Remove dependency on devlink_mutex during devlinks xarray iteration.
Missing motivation... Need to explain that devlink_mutex is held
throughout every user space command and that while issuing a reload and
registering / unregistering auxiliary devlink instances we will
deadlock on this mutex.
>
> The devlinks xarray consistency is ensured by internally by xarray.
s/by//
> There is a reference taken when working with devlink using
> devlink_try_get(). But there is no guarantee that devlink pointer
> picked during xarray iteration is not freed before devlink_try_get()
> is called.
>
> Make sure that devlink_try_get() works with valid pointer.
> Achieve it by:
> 1) Splitting devlink_put() so the completion is sent only
> after grace period. Completion unblocks the devlink_unregister()
> routine, which is followed-up by devlink_free()
> 2) Iterate the devlink xarray holding RCU read lock.
>
> Signed-off-by: Jiri Pirko <jiri@...dia.com>
Powered by blists - more mailing lists