public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli•us>
To: Ido Schimmel <idosch@nvidia•com>
Cc: netdev@vger•kernel.org, davem@davemloft•net, kuba@kernel•org,
	petrm@nvidia•com, pabeni@redhat•com, edumazet@google•com,
	mlxsw@nvidia•com, saeedm@nvidia•com, snelson@pensando•io
Subject: Re: [patch net-next v2 01/12] net: devlink: make sure that devlink_try_get() works with valid pointer during xarray iteration
Date: Wed, 20 Jul 2022 13:00:27 +0200	[thread overview]
Message-ID: <YtfgS09cFbQLpCBD@nanopsycho> (raw)
In-Reply-To: <YteyloM9mtRqCI0T@shredder>

Wed, Jul 20, 2022 at 09:45:26AM CEST, idosch@nvidia•com wrote:
>On Tue, Jul 19, 2022 at 08:48:36AM +0200, Jiri Pirko wrote:
>> From: Jiri Pirko <jiri@nvidia•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.

Fixed.


>
>> 
>> The devlinks xarray consistency is ensured by internally by xarray.
>
>s/by//

Fixed.


>
>> 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@nvidia•com>

  reply	other threads:[~2022-07-20 11:00 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19  6:48 [patch net-next v2 00/12] mlxsw: Implement dev info and dev flash for line cards Jiri Pirko
2022-07-19  6:48 ` [patch net-next v2 01/12] net: devlink: make sure that devlink_try_get() works with valid pointer during xarray iteration Jiri Pirko
2022-07-19 11:39   ` Ido Schimmel
2022-07-19 11:41     ` Jiri Pirko
2022-07-20  7:45   ` Ido Schimmel
2022-07-20 11:00     ` Jiri Pirko [this message]
2022-07-19  6:48 ` [patch net-next v2 02/12] net: devlink: introduce nested devlink entity for line card Jiri Pirko
2022-07-20  7:58   ` Ido Schimmel
2022-07-19  6:48 ` [patch net-next v2 03/12] mlxsw: core_linecards: Introduce per line card auxiliary device Jiri Pirko
2022-07-20  8:45   ` Ido Schimmel
2022-07-20 12:17     ` Jiri Pirko
2022-07-19  6:48 ` [patch net-next v2 04/12] mlxsw: core_linecard_dev: Set nested devlink relationship for a line card Jiri Pirko
2022-07-20  8:47   ` Ido Schimmel
2022-07-19  6:48 ` [patch net-next v2 05/12] mlxsw: core_linecards: Expose HW revision and INI version Jiri Pirko
2022-07-20  8:56   ` Ido Schimmel
2022-07-20 12:27     ` Jiri Pirko
2022-07-20 12:43       ` Ido Schimmel
2022-07-20 12:50         ` Ido Schimmel
2022-07-20 14:58           ` Jiri Pirko
2022-07-20 14:59         ` Jiri Pirko
2022-07-20 15:01           ` Ido Schimmel
2022-07-20 15:09             ` Jiri Pirko
2022-07-19  6:48 ` [patch net-next v2 06/12] mlxsw: reg: Extend MDDQ by device_info Jiri Pirko
2022-07-20  8:57   ` Ido Schimmel
2022-07-19  6:48 ` [patch net-next v2 07/12] mlxsw: core_linecards: Probe provisioned line cards for devices and expose FW version Jiri Pirko
2022-07-20  9:14   ` Ido Schimmel
2022-07-20 10:51     ` Jiri Pirko
2022-07-20 11:16       ` Ido Schimmel
2022-07-20 12:29         ` Jiri Pirko
2022-07-19  6:48 ` [patch net-next v2 08/12] mlxsw: reg: Add Management DownStream Device Tunneling Register Jiri Pirko
2022-07-19  6:48 ` [patch net-next v2 09/12] mlxsw: core_linecards: Expose device PSID over device info Jiri Pirko
2022-07-20 10:42   ` Ido Schimmel
2022-07-19  6:48 ` [patch net-next v2 10/12] mlxsw: core_linecards: Implement line card device flashing Jiri Pirko
2022-07-20 10:46   ` Ido Schimmel
2022-07-20 10:53     ` Jiri Pirko
2022-07-19  6:48 ` [patch net-next v2 11/12] selftests: mlxsw: Check line card info on provisioned line card Jiri Pirko
2022-07-19  6:48 ` [patch net-next v2 12/12] selftests: mlxsw: Check line card info on activated " Jiri Pirko
2022-07-19 10:30 ` [patch net-next v2 00/12] mlxsw: Implement dev info and dev flash for line cards Ido Schimmel

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=YtfgS09cFbQLpCBD@nanopsycho \
    --to=jiri@resnulli$(echo .)us \
    --cc=davem@davemloft$(echo .)net \
    --cc=edumazet@google$(echo .)com \
    --cc=idosch@nvidia$(echo .)com \
    --cc=kuba@kernel$(echo .)org \
    --cc=mlxsw@nvidia$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pabeni@redhat$(echo .)com \
    --cc=petrm@nvidia$(echo .)com \
    --cc=saeedm@nvidia$(echo .)com \
    --cc=snelson@pensando$(echo .)io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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