1. Mar 06, 2024
  2. Mar 05, 2024
    • Eric Dumazet's avatar
      net/smc: reduce rtnl pressure in smc_pnet_create_pnetids_list() · 00af2aa9
      Eric Dumazet authored
      
      
      Many syzbot reports show extreme rtnl pressure, and many of them hint
      that smc acquires rtnl in netns creation for no good reason [1]
      
      This patch returns early from smc_pnet_net_init()
      if there is no netdevice yet.
      
      I am not even sure why smc_pnet_create_pnetids_list() even exists,
      because smc_pnet_netdev_event() is also calling
      smc_pnet_add_base_pnetid() when handling NETDEV_UP event.
      
      [1] extract of typical syzbot reports
      
      2 locks held by syz-executor.3/12252:
        #0: ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
      2 locks held by syz-executor.4/12253:
        #0: ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
      2 locks held by syz-executor.1/12257:
        #0: ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
      2 locks held by syz-executor.2/12261:
        #0: ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
      2 locks held by syz-executor.0/12265:
        #0: ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
      2 locks held by syz-executor.3/12268:
        #0: ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
      2 locks held by syz-executor.4/12271:
        #0: ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
      2 locks held by syz-executor.1/12274:
        #0: ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
      2 locks held by syz-executor.2/12280:
        #0: ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
        #1: ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Wenjia Zhang <wenjia@linux.ibm.com>
      Cc: Jan Karcher <jaka@linux.ibm.com>
      Cc: "D. Wythe" <alibuda@linux.alibaba.com>
      Cc: Tony Lu <tonylu@linux.alibaba.com>
      Cc: Wen Gu <guwen@linux.alibaba.com>
      Reviewed-by: default avatarWenjia Zhang <wenjia@linux.ibm.com>
      Link: https://lore.kernel.org/r/20240302100744.3868021-1-edumazet@google.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      00af2aa9
    • Paolo Abeni's avatar
      Merge tag 'linux-can-next-for-6.9-20240304' of... · eead0599
      Paolo Abeni authored
      Merge tag 'linux-can-next-for-6.9-20240304' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next
      
      Marc Kleine-Budde says:
      
      ====================
      pull-request: can-next 2024-03-04
      
      this is a pull request of 4 patches for net-next/master.
      
      The 1st patch is by Jimmy Assarsson and adds support for the Leaf v3
      to the kvaser_usb driver.
      
      Martin Jocić's patch targets the kvaser_pciefd driver and adds support
      for the Kvaser PCIe 8xCAN device.
      
      Followed by a patch by me that adds a missing a cpu_to_le32() to the
      gs_usb driver, the change is not critical as the assigned value is 0.
      
      The last patch is also by me and replaces a literal 256 with a proper
      define.
      
      linux-can-next-for-6.9-20240304
      
      * tag 'linux-can-next-for-6.9-20240304' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next:
        can: mcp251xfd: __mcp251xfd_get_berr_counter(): use CAN_BUS_OFF_THRESHOLD instead of open coding it
        can: gs_usb: gs_cmd_reset(): use cpu_to_le32() to assign mode
        can: kvaser_pciefd: Add support for Kvaser PCIe 8xCAN
        can: kvaser_usb: Add support for Leaf v3
      ====================
      
      Link: https://lore.kernel.org/r/20240304092051.3631481-1-mkl@pengutronix.de
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      eead0599
    • Abhishek Chauhan's avatar
      net: Re-use and set mono_delivery_time bit for userspace tstamp packets · 885c36e5
      Abhishek Chauhan authored
      
      
      Bridge driver today has no support to forward the userspace timestamp
      packets and ends up resetting the timestamp. ETF qdisc checks the
      packet coming from userspace and encounters to be 0 thereby dropping
      time sensitive packets. These changes will allow userspace timestamps
      packets to be forwarded from the bridge to NIC drivers.
      
      Setting the same bit (mono_delivery_time) to avoid dropping of
      userspace tstamp packets in the forwarding path.
      
      Existing functionality of mono_delivery_time remains unaltered here,
      instead just extended with userspace tstamp support for bridge
      forwarding path.
      
      Signed-off-by: default avatarAbhishek Chauhan <quic_abchauha@quicinc.com>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Link: https://lore.kernel.org/r/20240301201348.2815102-1-quic_abchauha@quicinc.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      885c36e5
    • Paolo Abeni's avatar
      Merge branch 'net-gro-cleanups-and-fast-path-refinement' · d35c9659
      Paolo Abeni authored
      Eric Dumazet says:
      
      ====================
      net: gro: cleanups and fast path refinement
      
      Current GRO stack has a 'fast path' for a subset of drivers,
      users of napi_frags_skb().
      
      With TCP zerocopy/direct uses, header split at receive is becoming
      more important, and GRO fast path is disabled.
      
      This series makes GRO (a bit) more efficient for almost all use cases.
      ====================
      
      Link: https://lore.kernel.org/r/20240301193740.3436871-1-edumazet@google.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      d35c9659
    • Eric Dumazet's avatar
      tcp: gro: micro optimizations in tcp[4]_gro_complete() · 8f78010b
      Eric Dumazet authored
      
      
      In tcp_gro_complete() :
      
      Moving the skb->inner_transport_header setting
      allows the compiler to reuse the previously loaded value
      of skb->transport_header.
      
      Caching skb_shinfo() avoids duplications as well.
      
      In tcp4_gro_complete(), doing a single change on
      skb_shinfo(skb)->gso_type also generates better code.
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      8f78010b