From: Jakub Kicinski <kuba@kernel.org>
To: Jiri Pirko <jiri@resnulli.us>
Cc: netdev@vger.kernel.org, davem@davemloft.net, idosch@nvidia.com,
petrm@nvidia.com, pabeni@redhat.com, edumazet@google.com,
mlxsw@nvidia.com, saeedm@nvidia.com, snelson@pensando.io
Subject: Re: [patch net-next v4 01/12] net: devlink: make sure that devlink_try_get() works with valid pointer during xarray iteration
Date: Mon, 25 Jul 2022 18:47:44 -0700 [thread overview]
Message-ID: <20220725184744.4e486fd6@kernel.org> (raw)
In-Reply-To: <20220725082925.366455-2-jiri@resnulli.us>
On Mon, 25 Jul 2022 10:29:14 +0200 Jiri Pirko wrote:
> From: Jiri Pirko <jiri@nvidia.com>
>
> Remove dependency on devlink_mutex during devlinks xarray iteration.
>
> The reason is that devlink_register/unregister() functions taking
> devlink_mutex would deadlock during devlink reload operation of devlink
> instance which registers/unregisters nested devlink instances.
>
> The devlinks xarray consistency is ensured internally by xarray.
> 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) During devlinks xa_array iteration, get devlink pointer from xa_array
> holding RCU read lock and taking reference using devlink_try_get()
> before unlock.
>
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
next prev parent reply other threads:[~2022-07-26 1:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-25 8:29 [patch net-next v4 00/12] Implement dev info and dev flash for line cards Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 01/12] net: devlink: make sure that devlink_try_get() works with valid pointer during xarray iteration Jiri Pirko
2022-07-26 1:47 ` Jakub Kicinski [this message]
2022-07-25 8:29 ` [patch net-next v4 02/12] net: devlink: move net check into devlinks_xa_for_each_registered_get() Jiri Pirko
2022-07-26 1:48 ` Jakub Kicinski
2022-07-25 8:29 ` [patch net-next v4 03/12] net: devlink: introduce nested devlink entity for line card Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 04/12] mlxsw: core_linecards: Introduce per line card auxiliary device Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 05/12] mlxsw: core_linecards: Expose HW revision and INI version Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 06/12] mlxsw: reg: Extend MDDQ by device_info Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 07/12] mlxsw: core_linecards: Probe active line cards for devices and expose FW version Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 08/12] mlxsw: reg: Add Management DownStream Device Tunneling Register Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 09/12] mlxsw: core_linecards: Expose device PSID over device info Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 10/12] mlxsw: core_linecards: Implement line card device flashing Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 11/12] selftests: mlxsw: Check line card info on provisioned line card Jiri Pirko
2022-07-25 8:29 ` [patch net-next v4 12/12] selftests: mlxsw: Check line card info on activated " Jiri Pirko
2022-07-26 21:20 ` [patch net-next v4 00/12] Implement dev info and dev flash for line cards patchwork-bot+netdevbpf
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=20220725184744.4e486fd6@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=jiri@resnulli.us \
--cc=mlxsw@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=saeedm@nvidia.com \
--cc=snelson@pensando.io \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.