1. 26 Apr, 2024 37 commits
  2. 25 Apr, 2024 3 commits
    • Eric Dumazet's avatar
      net: add two more call_rcu_hurry() · c4e86b43
      Eric Dumazet authored
      I had failures with pmtu.sh selftests lately,
      with netns dismantles firing ref_tracking alerts [1].
      
      After much debugging, I found that some queued
      rcu callbacks were delayed by minutes, because
      of CONFIG_RCU_LAZY=y option.
      
      Joel Fernandes had a similar issue in the past,
      fixed with commit 483c26ff ("net: Use call_rcu_hurry()
      for dst_release()")
      
      In this commit, I make sure nexthop_free_rcu()
      and free_fib_info_rcu() are not delayed too much
      because they both can release device references.
      
      tools/testing/selftests/net/pmtu.sh no longer fails.
      
      Traces were:
      
      [  968.179860] ref_tracker: veth_A-R1@00000000d0ff3fe2 has 3/5 users at
                          dst_alloc+0x76/0x160
                          ip6_dst_alloc+0x25/0x80
                          ip6_pol_route+0x2a8/0x450
                          ip6_pol_route_output+0x1f/0x30
                          fib6_rule_lookup+0x163/0x270
                          ip6_route_output_flags+0xda/0x190
                          ip6_dst_lookup_tail.constprop.0+0x1d0/0x260
                          ip6_dst_lookup_flow+0x47/0xa0
                          udp_tunnel6_dst_lookup+0x158/0x210
                          vxlan_xmit_one+0x4c2/0x1550 [vxlan]
                          vxlan_xmit+0x52d/0x14f0 [vxlan]
                          dev_hard_start_xmit+0x7b/0x1e0
                          __dev_queue_xmit+0x20b/0xe40
                          ip6_finish_output2+0x2ea/0x6e0
                          ip6_finish_output+0x143/0x320
                          ip6_output+0x74/0x140
      
      [  968.179860] ref_tracker: veth_A-R1@00000000d0ff3fe2 has 1/5 users at
                          netdev_get_by_index+0xc0/0xe0
                          fib6_nh_init+0x1a9/0xa90
                          rtm_new_nexthop+0x6fa/0x1580
                          rtnetlink_rcv_msg+0x155/0x3e0
                          netlink_rcv_skb+0x61/0x110
                          rtnetlink_rcv+0x19/0x20
                          netlink_unicast+0x23f/0x380
                          netlink_sendmsg+0x1fc/0x430
                          ____sys_sendmsg+0x2ef/0x320
                          ___sys_sendmsg+0x86/0xd0
                          __sys_sendmsg+0x67/0xc0
                          __x64_sys_sendmsg+0x21/0x30
                          x64_sys_call+0x252/0x2030
                          do_syscall_64+0x6c/0x190
                          entry_SYSCALL_64_after_hwframe+0x76/0x7e
      
      [  968.179860] ref_tracker: veth_A-R1@00000000d0ff3fe2 has 1/5 users at
                          ipv6_add_dev+0x136/0x530
                          addrconf_notify+0x19d/0x770
                          notifier_call_chain+0x65/0xd0
                          raw_notifier_call_chain+0x1a/0x20
                          call_netdevice_notifiers_info+0x54/0x90
                          register_netdevice+0x61e/0x790
                          veth_newlink+0x230/0x440
                          __rtnl_newlink+0x7d2/0xaa0
                          rtnl_newlink+0x4c/0x70
                          rtnetlink_rcv_msg+0x155/0x3e0
                          netlink_rcv_skb+0x61/0x110
                          rtnetlink_rcv+0x19/0x20
                          netlink_unicast+0x23f/0x380
                          netlink_sendmsg+0x1fc/0x430
                          ____sys_sendmsg+0x2ef/0x320
                          ___sys_sendmsg+0x86/0xd0
      ....
      [ 1079.316024]  ? show_regs+0x68/0x80
      [ 1079.316087]  ? __warn+0x8c/0x140
      [ 1079.316103]  ? ref_tracker_free+0x1a0/0x270
      [ 1079.316117]  ? report_bug+0x196/0x1c0
      [ 1079.316135]  ? handle_bug+0x42/0x80
      [ 1079.316149]  ? exc_invalid_op+0x1c/0x70
      [ 1079.316162]  ? asm_exc_invalid_op+0x1f/0x30
      [ 1079.316193]  ? ref_tracker_free+0x1a0/0x270
      [ 1079.316208]  ? _raw_spin_unlock+0x1a/0x40
      [ 1079.316222]  ? free_unref_page+0x126/0x1a0
      [ 1079.316239]  ? destroy_large_folio+0x69/0x90
      [ 1079.316251]  ? __folio_put+0x99/0xd0
      [ 1079.316276]  dst_dev_put+0x69/0xd0
      [ 1079.316308]  fib6_nh_release_dsts.part.0+0x3d/0x80
      [ 1079.316327]  fib6_nh_release+0x45/0x70
      [ 1079.316340]  nexthop_free_rcu+0x131/0x170
      [ 1079.316356]  rcu_do_batch+0x1ee/0x820
      [ 1079.316370]  ? rcu_do_batch+0x179/0x820
      [ 1079.316388]  rcu_core+0x1aa/0x4d0
      [ 1079.316405]  rcu_core_si+0x12/0x20
      [ 1079.316417]  __do_softirq+0x13a/0x3dc
      [ 1079.316435]  __irq_exit_rcu+0xa3/0x110
      [ 1079.316449]  irq_exit_rcu+0x12/0x30
      [ 1079.316462]  sysvec_apic_timer_interrupt+0x5b/0xe0
      [ 1079.316474]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
      [ 1079.316569] RIP: 0033:0x7f06b65c63f0
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Joel Fernandes (Google) <joel@joelfernandes.org>
      Cc: Paul E. McKenney <paulmck@kernel.org>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20240423205408.39632-1-edumazet@google.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c4e86b43
    • Jakub Kicinski's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 2bd87951
      Jakub Kicinski authored
      Cross-merge networking fixes after downstream PR.
      
      Conflicts:
      
      drivers/net/ethernet/ti/icssg/icssg_prueth.c
      
      net/mac80211/chan.c
        89884459 ("wifi: mac80211: fix idle calculation with multi-link")
        87f55002 ("wifi: mac80211: simplify ieee80211_assign_link_chanctx()")
      https://lore.kernel.org/all/20240422105623.7b1fbda2@canb.auug.org.au/
      
      net/unix/garbage.c
        1971d13f ("af_unix: Suppress false-positive lockdep splat for spin_lock() in __unix_gc().")
        4090fa37 ("af_unix: Replace garbage collection algorithm.")
      
      drivers/net/ethernet/ti/icssg/icssg_prueth.c
      drivers/net/ethernet/ti/icssg/icssg_common.c
        4dcd0e83 ("net: ti: icssg-prueth: Fix signedness bug in prueth_init_rx_chns()")
        e2dc7bfd ("net: ti: icssg-prueth: Move common functions into a separate file")
      
      No adjacent changes.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2bd87951
    • Eric Dumazet's avatar
      tcp: avoid premature drops in tcp_add_backlog() · ec00ed47
      Eric Dumazet authored
      While testing TCP performance with latest trees,
      I saw suspect SOCKET_BACKLOG drops.
      
      tcp_add_backlog() computes its limit with :
      
          limit = (u32)READ_ONCE(sk->sk_rcvbuf) +
                  (u32)(READ_ONCE(sk->sk_sndbuf) >> 1);
          limit += 64 * 1024;
      
      This does not take into account that sk->sk_backlog.len
      is reset only at the very end of __release_sock().
      
      Both sk->sk_backlog.len and sk->sk_rmem_alloc could reach
      sk_rcvbuf in normal conditions.
      
      We should double sk->sk_rcvbuf contribution in the formula
      to absorb bubbles in the backlog, which happen more often
      for very fast flows.
      
      This change maintains decent protection against abuses.
      
      Fixes: c377411f ("net: sk_add_backlog() take rmem_alloc into account")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20240423125620.3309458-1-edumazet@google.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ec00ed47