From: Ido Schimmel <idosch@nvidia.com>
To: Jiri Pirko <jiri@resnulli.us>
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: Tue, 19 Jul 2022 14:39:07 +0300 [thread overview]
Message-ID: <YtaX2536pQXe0+f1@shredder> (raw)
In-Reply-To: <20220719064847.3688226-2-jiri@resnulli.us>
> @@ -6511,9 +6566,11 @@ static int devlink_nl_cmd_info_get_dumpit(struct sk_buff *msg,
> int err = 0;
>
> mutex_lock(&devlink_mutex);
> + rcu_read_lock();
> xa_for_each_marked(&devlinks, index, devlink, DEVLINK_REGISTERED) {
> if (!devlink_try_get(devlink))
> continue;
> + rcu_read_unlock();
>
> if (!net_eq(devlink_net(devlink), sock_net(msg->sk)))
> goto retry;
> @@ -6537,7 +6594,9 @@ static int devlink_nl_cmd_info_get_dumpit(struct sk_buff *msg,
> idx++;
> retry:
> devlink_put(devlink);
> + rcu_read_lock();
> }
> + rcu_read_unlock();
> mutex_unlock(&devlink_mutex);
>
> if (err != -EMSGSIZE)
The pw CI is complaining about this:
New errors added
--- /tmp/tmp.Lx7CWX0u9n 2022-07-18 23:56:05.513142294 -0700
+++ /tmp/tmp.SFcuLwts4X 2022-07-18 23:56:49.917188829 -0700
@@ -0,0 +1,2 @@
+../net/core/devlink.c: note: in included file (through ../include/linux/rculist.h, ../include/linux/dcache.h, ../include/linux/fs.h, ../include/linux/highmem.h, ../include/linux/bvec.h, ../include/linux/skbuff.h, ...):
+../include/linux/rcupdate.h:726:9: warning: context imbalance in 'devlink_nl_cmd_info_get_dumpit' - unexpected unlock
Might need something like:
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 0e8274feab11..5a39a02b6ed6 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -6611,6 +6611,7 @@ static int devlink_nl_cmd_info_get_dumpit(struct sk_buff *msg,
err = 0;
else if (err) {
devlink_put(devlink);
+ rcu_read_lock();
break;
}
inc:
next prev parent reply other threads:[~2022-07-19 11:39 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 [this message]
2022-07-19 11:41 ` Jiri Pirko
2022-07-20 7:45 ` Ido Schimmel
2022-07-20 11:00 ` Jiri Pirko
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=YtaX2536pQXe0+f1@shredder \
--to=idosch@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).