From: David Ahern <dsahern@gmail.com>
To: Wei Wang <weiwan@google.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, Ido Schimmel <idosch@nvidia.com>,
Petr Machata <petrm@nvidia.com>
Cc: syzbot <syzkaller@googlegroups.com>,
David Ahern <dsahern@kernel.org>,
Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH net] ipv6: fix suspecious RCU usage warning
Date: Mon, 8 Mar 2021 19:47:31 -0700 [thread overview]
Message-ID: <0d18e982-93de-5b88-b3a5-efb6ebd200f2@gmail.com> (raw)
In-Reply-To: <20210308192113.2721435-1-weiwan@google.com>
[ cc Ido and Petr ]
On 3/8/21 12:21 PM, Wei Wang wrote:
> diff --git a/include/net/nexthop.h b/include/net/nexthop.h
> index 7bc057aee40b..48956b144689 100644
> --- a/include/net/nexthop.h
> +++ b/include/net/nexthop.h
> @@ -410,31 +410,39 @@ static inline struct fib_nh *fib_info_nh(struct fib_info *fi, int nhsel)
> int fib6_check_nexthop(struct nexthop *nh, struct fib6_config *cfg,
> struct netlink_ext_ack *extack);
>
> -static inline struct fib6_nh *nexthop_fib6_nh(struct nexthop *nh)
> +static inline struct fib6_nh *nexthop_fib6_nh(struct nexthop *nh,
> + bool bh_disabled)
Hi Wei: I would prefer not to have a second argument to nexthop_fib6_nh
for 1 code path, and a control path at that.
> {
> struct nh_info *nhi;
>
> if (nh->is_group) {
> struct nh_group *nh_grp;
>
> - nh_grp = rcu_dereference_rtnl(nh->nh_grp);
> + if (bh_disabled)
> + nh_grp = rcu_dereference_bh_rtnl(nh->nh_grp);
> + else
> + nh_grp = rcu_dereference_rtnl(nh->nh_grp);
> nh = nexthop_mpath_select(nh_grp, 0);
> if (!nh)
> return NULL;
> }
>
> - nhi = rcu_dereference_rtnl(nh->nh_info);
> + if (bh_disabled)
> + nhi = rcu_dereference_bh_rtnl(nh->nh_info);
> + else
> + nhi = rcu_dereference_rtnl(nh->nh_info);
> if (nhi->family == AF_INET6)
> return &nhi->fib6_nh;
>
> return NULL;
> }
>
I am wary of duplicating code, but this helper is simple enough that it
should be ok with proper documentation.
Ido/Petr: I think your resilient hashing patch set touches this helper.
How ugly does it get to have a second version?
next prev parent reply other threads:[~2021-03-09 2:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-08 19:21 [PATCH net] ipv6: fix suspecious RCU usage warning Wei Wang
2021-03-09 2:47 ` David Ahern [this message]
2021-03-09 8:15 ` Ido Schimmel
2021-03-09 17:32 ` Wei Wang
2021-03-09 19:33 ` David Ahern
2021-03-09 19:37 ` Wei Wang
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=0d18e982-93de-5b88-b3a5-efb6ebd200f2@gmail.com \
--to=dsahern@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=petrm@nvidia.com \
--cc=syzkaller@googlegroups.com \
--cc=weiwan@google.com \
/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).