* [PATCH v1 net-next 0/2] net: Clean up af_ops->{get_link_af_size,fill_link_af}().
@ 2024-08-15 21:11 Kuniyuki Iwashima
2024-08-15 21:11 ` [PATCH v1 net-next 1/2] ipv4: Use RCU helper in inet_get_link_af_size() and inet_fill_link_af() Kuniyuki Iwashima
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Kuniyuki Iwashima @ 2024-08-15 21:11 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
David Ahern, Roopa Prabhu, Nikolay Aleksandrov
Cc: Kuniyuki Iwashima, Kuniyuki Iwashima, netdev
Since commit 5fa85a09390c ("net: core: rcu-ify rtnl af_ops"),
af_ops->{get_link_af_size,fill_link_af}() are called under RCU.
Patch 1 makes the context clear and patch 2 removes unnecessary
rcu_read_lock().
Kuniyuki Iwashima (2):
ipv4: Use RCU helper in inet_get_link_af_size() and
inet_fill_link_af().
net: bridge: Remove rcu_read_lock() in br_get_link_af_size_filtered().
net/bridge/br_netlink.c | 2 --
net/ipv4/devinet.c | 6 ++----
2 files changed, 2 insertions(+), 6 deletions(-)
--
2.30.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 net-next 1/2] ipv4: Use RCU helper in inet_get_link_af_size() and inet_fill_link_af().
2024-08-15 21:11 [PATCH v1 net-next 0/2] net: Clean up af_ops->{get_link_af_size,fill_link_af}() Kuniyuki Iwashima
@ 2024-08-15 21:11 ` Kuniyuki Iwashima
2024-08-15 21:11 ` [PATCH v1 net-next 2/2] net: bridge: Remove rcu_read_lock() in br_get_link_af_size_filtered() Kuniyuki Iwashima
2024-08-16 1:36 ` [PATCH v1 net-next 0/2] net: Clean up af_ops->{get_link_af_size,fill_link_af}() Jakub Kicinski
2 siblings, 0 replies; 5+ messages in thread
From: Kuniyuki Iwashima @ 2024-08-15 21:11 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
David Ahern, Roopa Prabhu, Nikolay Aleksandrov
Cc: Kuniyuki Iwashima, Kuniyuki Iwashima, netdev
Since commit 5fa85a09390c ("net: core: rcu-ify rtnl af_ops"),
af_ops->{get_link_af_size,fill_link_af}() are called under RCU.
Instead of using rcu_dereference_rtnl(), let's make the context
clear by using RCU helpers.
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
net/ipv4/devinet.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 61be85154dd1..a4f9822213bf 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1950,9 +1950,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr *ifa, struct nlmsghdr *nlh,
static size_t inet_get_link_af_size(const struct net_device *dev,
u32 ext_filter_mask)
{
- struct in_device *in_dev = rcu_dereference_rtnl(dev->ip_ptr);
-
- if (!in_dev)
+ if (!rcu_access_pointer(dev->ip_ptr))
return 0;
return nla_total_size(IPV4_DEVCONF_MAX * 4); /* IFLA_INET_CONF */
@@ -1961,7 +1959,7 @@ static size_t inet_get_link_af_size(const struct net_device *dev,
static int inet_fill_link_af(struct sk_buff *skb, const struct net_device *dev,
u32 ext_filter_mask)
{
- struct in_device *in_dev = rcu_dereference_rtnl(dev->ip_ptr);
+ struct in_device *in_dev = rcu_dereference(dev->ip_ptr);
struct nlattr *nla;
int i;
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v1 net-next 2/2] net: bridge: Remove rcu_read_lock() in br_get_link_af_size_filtered().
2024-08-15 21:11 [PATCH v1 net-next 0/2] net: Clean up af_ops->{get_link_af_size,fill_link_af}() Kuniyuki Iwashima
2024-08-15 21:11 ` [PATCH v1 net-next 1/2] ipv4: Use RCU helper in inet_get_link_af_size() and inet_fill_link_af() Kuniyuki Iwashima
@ 2024-08-15 21:11 ` Kuniyuki Iwashima
2024-08-16 1:36 ` [PATCH v1 net-next 0/2] net: Clean up af_ops->{get_link_af_size,fill_link_af}() Jakub Kicinski
2 siblings, 0 replies; 5+ messages in thread
From: Kuniyuki Iwashima @ 2024-08-15 21:11 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
David Ahern, Roopa Prabhu, Nikolay Aleksandrov
Cc: Kuniyuki Iwashima, Kuniyuki Iwashima, netdev
Since commit 5fa85a09390c ("net: core: rcu-ify rtnl af_ops"),
af_ops->get_link_af_size() is called under RCU.
Let's remove unnecessary rcu_read_lock() in br_get_link_af_size_filtered().
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
net/bridge/br_netlink.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index f17dbac7d828..c386a8ec370f 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -101,7 +101,6 @@ static size_t br_get_link_af_size_filtered(const struct net_device *dev,
size_t vinfo_sz = 0;
int num_vlan_infos;
- rcu_read_lock();
if (netif_is_bridge_port(dev)) {
p = br_port_get_check_rcu(dev);
if (p)
@@ -111,7 +110,6 @@ static size_t br_get_link_af_size_filtered(const struct net_device *dev,
vg = br_vlan_group_rcu(br);
}
num_vlan_infos = br_get_num_vlan_infos(vg, filter_mask);
- rcu_read_unlock();
if (p && (p->flags & BR_VLAN_TUNNEL))
vinfo_sz += br_get_vlan_tunnel_info_size(vg);
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 net-next 0/2] net: Clean up af_ops->{get_link_af_size,fill_link_af}().
2024-08-15 21:11 [PATCH v1 net-next 0/2] net: Clean up af_ops->{get_link_af_size,fill_link_af}() Kuniyuki Iwashima
2024-08-15 21:11 ` [PATCH v1 net-next 1/2] ipv4: Use RCU helper in inet_get_link_af_size() and inet_fill_link_af() Kuniyuki Iwashima
2024-08-15 21:11 ` [PATCH v1 net-next 2/2] net: bridge: Remove rcu_read_lock() in br_get_link_af_size_filtered() Kuniyuki Iwashima
@ 2024-08-16 1:36 ` Jakub Kicinski
2024-08-16 2:39 ` Kuniyuki Iwashima
2 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2024-08-16 1:36 UTC (permalink / raw)
To: Kuniyuki Iwashima
Cc: David S. Miller, Eric Dumazet, Paolo Abeni, David Ahern,
Roopa Prabhu, Nikolay Aleksandrov, Kuniyuki Iwashima, netdev
On Thu, 15 Aug 2024 14:11:35 -0700 Kuniyuki Iwashima wrote:
> Since commit 5fa85a09390c ("net: core: rcu-ify rtnl af_ops"),
> af_ops->{get_link_af_size,fill_link_af}() are called under RCU.
>
> Patch 1 makes the context clear and patch 2 removes unnecessary
> rcu_read_lock().
Tests violently disagree.
https://netdev.bots.linux.dev/contest.html?branch=net-next-2024-08-16--00-00&pw-n=0&pass=0
--
pw-bot: cr
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 net-next 0/2] net: Clean up af_ops->{get_link_af_size,fill_link_af}().
2024-08-16 1:36 ` [PATCH v1 net-next 0/2] net: Clean up af_ops->{get_link_af_size,fill_link_af}() Jakub Kicinski
@ 2024-08-16 2:39 ` Kuniyuki Iwashima
0 siblings, 0 replies; 5+ messages in thread
From: Kuniyuki Iwashima @ 2024-08-16 2:39 UTC (permalink / raw)
To: kuba
Cc: davem, dsahern, edumazet, kuni1840, kuniyu, netdev, pabeni, razor,
roopa
From: Jakub Kicinski <kuba@kernel.org>
Date: Thu, 15 Aug 2024 18:36:51 -0700
> On Thu, 15 Aug 2024 14:11:35 -0700 Kuniyuki Iwashima wrote:
> > Since commit 5fa85a09390c ("net: core: rcu-ify rtnl af_ops"),
> > af_ops->{get_link_af_size,fill_link_af}() are called under RCU.
> >
> > Patch 1 makes the context clear and patch 2 removes unnecessary
> > rcu_read_lock().
>
> Tests violently disagree.
>
> https://netdev.bots.linux.dev/contest.html?branch=net-next-2024-08-16--00-00&pw-n=0&pass=0
Sorry, I missed the birdge one is called under RTNL.
I'll drop patch 2.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-08-16 2:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-15 21:11 [PATCH v1 net-next 0/2] net: Clean up af_ops->{get_link_af_size,fill_link_af}() Kuniyuki Iwashima
2024-08-15 21:11 ` [PATCH v1 net-next 1/2] ipv4: Use RCU helper in inet_get_link_af_size() and inet_fill_link_af() Kuniyuki Iwashima
2024-08-15 21:11 ` [PATCH v1 net-next 2/2] net: bridge: Remove rcu_read_lock() in br_get_link_af_size_filtered() Kuniyuki Iwashima
2024-08-16 1:36 ` [PATCH v1 net-next 0/2] net: Clean up af_ops->{get_link_af_size,fill_link_af}() Jakub Kicinski
2024-08-16 2:39 ` Kuniyuki Iwashima
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).