All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com
Subject: Re: [PATCH net-next 04/13] ipv6: use xarray iterator to implement inet6_dump_ifinfo()
Date: Wed, 21 Feb 2024 20:39:21 +0200	[thread overview]
Message-ID: <ZdZDWVdjMaQkXBgW@shredder> (raw)
In-Reply-To: <20240221105915.829140-5-edumazet@google.com>

On Wed, Feb 21, 2024 at 10:59:06AM +0000, Eric Dumazet wrote:
> Prepare inet6_dump_ifinfo() to run with RCU protection
> instead of RTNL and use for_each_netdev_dump() interface.
> 
> Also properly return 0 at the end of a dump, avoiding
> an extra recvmsg() system call and RTNL acquisition.
> 
> Note that RTNL-less dumps need core changes, yet to come.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Ido Schimmel <idosch@nvidia.com>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

BTW, not sure if you saw, but there's a failure in the fib_nexthops test
in Jakub's CI due to a lockdep splat [1]. Reproducer:

# ip link add name dummy1 up type dummy
# ip nexthop add id 1 dev dummy1
# ip nexthop add id 2 dev dummy1
# ip nexthop add id 10 group 1/2
# ip route add 198.51.100.0/24 nhid 10
# ip -4 r s

Seems like an oversight in nexthop code and fixed by:

diff --git a/include/net/nexthop.h b/include/net/nexthop.h
index 6647ad509faa..77e99cba60ad 100644
--- a/include/net/nexthop.h
+++ b/include/net/nexthop.h
@@ -317,7 +317,7 @@ static inline
 int nexthop_mpath_fill_node(struct sk_buff *skb, struct nexthop *nh,
                            u8 rt_family)
 {
-       struct nh_group *nhg = rtnl_dereference(nh->nh_grp);
+       struct nh_group *nhg = rcu_dereference_rtnl(nh->nh_grp);
        int i;
 
        for (i = 0; i < nhg->num_nh; i++) {

[1]
=============================
WARNING: suspicious RCU usage
6.8.0-rc4-custom-g85d71c2cf96e #20 Not tainted
-----------------------------
include/net/nexthop.h:320 suspicious rcu_dereference_protected() usage!

other info that might help us debug this:


rcu_scheduler_active = 2, debug_locks = 1
2 locks held by ip/668:
 #0: ffff88801c1a3eb0 (nlk_cb_mutex-ROUTE){+.+.}-{3:3}, at: __netlink_dump_start+0x155/0x9e0
 #1: ffffffff85d4fba0 (rcu_read_lock){....}-{1:2}, at: inet_dump_fib+0x133/0xab0

stack backtrace:
CPU: 19 PID: 668 Comm: ip Not tainted 6.8.0-rc4-custom-g85d71c2cf96e #20
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-1.fc38 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xbd/0xe0
 lockdep_rcu_suspicious+0x211/0x3b0
 fib_dump_info+0x1ae2/0x1e10
 fib_table_dump+0xc2e/0xf70
 inet_dump_fib+0x7fa/0xab0
 netlink_dump+0xd47/0x10f0
 __netlink_dump_start+0x702/0x9e0
 rtnetlink_rcv_msg+0xb6e/0xf20
 netlink_rcv_skb+0x170/0x440
 netlink_unicast+0x540/0x820
 netlink_sendmsg+0x8d8/0xda0
 __sys_sendto+0x27a/0x3f0
 __x64_sys_sendto+0xe5/0x1c0
 do_syscall_64+0xc5/0x1d0
 entry_SYSCALL_64_after_hwframe+0x63/0x6b

  reply	other threads:[~2024-02-21 18:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21 10:59 [PATCH net-next 00/13] rtnetlink: reduce RTNL pressure for dumps Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 01/13] rtnetlink: prepare nla_put_iflink() to run under RCU Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 02/13] ipv6: prepare inet6_fill_ifla6_attrs() for RCU Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 03/13] ipv6: prepare inet6_fill_ifinfo() for RCU protection Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 04/13] ipv6: use xarray iterator to implement inet6_dump_ifinfo() Eric Dumazet
2024-02-21 18:39   ` Ido Schimmel [this message]
2024-02-21 18:57     ` Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 05/13] netlink: fix netlink_diag_dump() return value Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 06/13] netlink: hold nlk->cb_mutex longer in __netlink_dump_start() Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 07/13] rtnetlink: change nlk->cb_mutex role Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 08/13] rtnetlink: add RTNL_FLAG_DUMP_UNLOCKED flag Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 09/13] ipv6: switch inet6_dump_ifinfo() to RCU protection Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 10/13] inet: allow ip_valid_fib_dump_req() to be called with RTNL or RCU Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 11/13] inet: switch inet_dump_fib() to RCU protection Eric Dumazet
2024-02-21 10:59 ` [PATCH net-next 12/13] rtnetlink: make rtnl_fill_link_ifmap() RCU ready Eric Dumazet
2024-02-21 16:02   ` Jiri Pirko
2024-02-21 17:15     ` Eric Dumazet
2024-02-21 18:22       ` Jiri Pirko
2024-02-21 18:56       ` Jakub Kicinski
2024-02-21 10:59 ` [PATCH net-next 13/13] rtnetlink: provide RCU protection to rtnl_fill_prop_list() Eric Dumazet

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=ZdZDWVdjMaQkXBgW@shredder \
    --to=idosch@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 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.