1. 15 Apr, 2024 1 commit
    • Wander Lairson Costa's avatar
      drop_monitor: replace spin_lock by raw_spin_lock · f1e197a6
      Wander Lairson Costa authored
      trace_drop_common() is called with preemption disabled, and it acquires
      a spin_lock. This is problematic for RT kernels because spin_locks are
      sleeping locks in this configuration, which causes the following splat:
      
      BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
      in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 449, name: rcuc/47
      preempt_count: 1, expected: 0
      RCU nest depth: 2, expected: 2
      5 locks held by rcuc/47/449:
       #0: ff1100086ec30a60 ((softirq_ctrl.lock)){+.+.}-{2:2}, at: __local_bh_disable_ip+0x105/0x210
       #1: ffffffffb394a280 (rcu_read_lock){....}-{1:2}, at: rt_spin_lock+0xbf/0x130
       #2: ffffffffb394a280 (rcu_read_lock){....}-{1:2}, at: __local_bh_disable_ip+0x11c/0x210
       #3: ffffffffb394a160 (rcu_callback){....}-{0:0}, at: rcu_do_batch+0x360/0xc70
       #4: ff1100086ee07520 (&data->lock){+.+.}-{2:2}, at: trace_drop_common.constprop.0+0xb5/0x290
      irq event stamp: 139909
      hardirqs last  enabled at (139908): [<ffffffffb1df2b33>] _raw_spin_unlock_irqrestore+0x63/0x80
      hardirqs last disabled at (139909): [<ffffffffb19bd03d>] trace_drop_common.constprop.0+0x26d/0x290
      softirqs last  enabled at (139892): [<ffffffffb07a1083>] __local_bh_enable_ip+0x103/0x170
      softirqs last disabled at (139898): [<ffffffffb0909b33>] rcu_cpu_kthread+0x93/0x1f0
      Preemption disabled at:
      [<ffffffffb1de786b>] rt_mutex_slowunlock+0xab/0x2e0
      CPU: 47 PID: 449 Comm: rcuc/47 Not tainted 6.9.0-rc2-rt1+ #7
      Hardware name: Dell Inc. PowerEdge R650/0Y2G81, BIOS 1.6.5 04/15/2022
      Call Trace:
       <TASK>
       dump_stack_lvl+0x8c/0xd0
       dump_stack+0x14/0x20
       __might_resched+0x21e/0x2f0
       rt_spin_lock+0x5e/0x130
       ? trace_drop_common.constprop.0+0xb5/0x290
       ? skb_queue_purge_reason.part.0+0x1bf/0x230
       trace_drop_common.constprop.0+0xb5/0x290
       ? preempt_count_sub+0x1c/0xd0
       ? _raw_spin_unlock_irqrestore+0x4a/0x80
       ? __pfx_trace_drop_common.constprop.0+0x10/0x10
       ? rt_mutex_slowunlock+0x26a/0x2e0
       ? skb_queue_purge_reason.part.0+0x1bf/0x230
       ? __pfx_rt_mutex_slowunlock+0x10/0x10
       ? skb_queue_purge_reason.part.0+0x1bf/0x230
       trace_kfree_skb_hit+0x15/0x20
       trace_kfree_skb+0xe9/0x150
       kfree_skb_reason+0x7b/0x110
       skb_queue_purge_reason.part.0+0x1bf/0x230
       ? __pfx_skb_queue_purge_reason.part.0+0x10/0x10
       ? mark_lock.part.0+0x8a/0x520
      ...
      
      trace_drop_common() also disables interrupts, but this is a minor issue
      because we could easily replace it with a local_lock.
      
      Replace the spin_lock with raw_spin_lock to avoid sleeping in atomic
      context.
      Signed-off-by: default avatarWander Lairson Costa <wander@redhat.com>
      Reported-by: default avatarHu Chunyu <chuhu@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f1e197a6
  2. 13 Apr, 2024 31 commits
  3. 12 Apr, 2024 8 commits
    • David S. Miller's avatar
      Merge branch 'nfp-minor-improvements' · 982a73c7
      David S. Miller authored
      Louis Peens says:
      
      ====================
      nfp: series of minor driver improvements
      
      This short series bundles now only includes a small update to add a
      board part number to devlink. Previously some dim patches also formed
      part of this series, these were dropped in v5.
      
      Patch1: Add new define for devlink string "board.part_number"
      Patch2: Make use of this field in the nfp driver
      
      Changes since V4:
      - Dropped the dim patches, as there is a more significant rework in
        progress to make it more flexible, as mentioned in the V4 review:
        https://lore.kernel.org/all/1712547870-112976-2-git-send-email-hengqi@linux.alibaba.com/
      - Updated the devlink description of 'board.part_number'
      
      Changes since V3:
      - Fixed: Documentation/networking/devlink/devlink-info.rst:150:
          WARNING: Title underline too short.
      
      Changes since V2:
      - After some discussion on the previous series it was agreed that only
        the "board.part_number" field makes sense in the common code. The
        "board.model" field which was moved to devlink common code in V1 is
        now kept in the driver. The field is specific to the nfp driver,
        exposing the codename of the board.
      - In summary, add "board.part_number" to devlink, and populate it
        in the the nfp driver.
      
      Changes since V1:
      - Move nfp local defines to devlink common code as it is quite generic.
      - Add new 'dim' profile instead of using driver local overrides, as this
        allows use of the 'dim' helpers.
      - This expanded 2 patches to 4, as the common code changes are split
        into seperate patches.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      982a73c7
    • Fei Qin's avatar
      nfp: update devlink device info output · 8910f93b
      Fei Qin authored
      Newer NIC will introduce a new part number, now add it
      into devlink device info.
      
      This patch also updates the information of "board.id" in
      nfp.rst to match the devlink-info.rst.
      Signed-off-by: default avatarFei Qin <fei.qin@corigine.com>
      Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8910f93b
    • Fei Qin's avatar
      devlink: add a new info version tag · 3bb946c9
      Fei Qin authored
      Add definition and documentation for the new generic
      info "board.part_number".
      
      The new one is for part number specific use, and board.id
      is modified to match the documentation in devlink-info.
      Signed-off-by: default avatarFei Qin <fei.qin@corigine.com>
      Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3bb946c9
    • Hechao Li's avatar
      tcp: increase the default TCP scaling ratio · 697a6c8c
      Hechao Li authored
      After commit dfa2f048 ("tcp: get rid of sysctl_tcp_adv_win_scale"),
      we noticed an application-level timeout due to reduced throughput.
      
      Before the commit, for a client that sets SO_RCVBUF to 65k, it takes
      around 22 seconds to transfer 10M data. After the commit, it takes 40
      seconds. Because our application has a 30-second timeout, this
      regression broke the application.
      
      The reason that it takes longer to transfer data is that
      tp->scaling_ratio is initialized to a value that results in ~0.25 of
      rcvbuf. In our case, SO_RCVBUF is set to 65536 by the application, which
      translates to 2 * 65536 = 131,072 bytes in rcvbuf and hence a ~28k
      initial receive window.
      
      Later, even though the scaling_ratio is updated to a more accurate
      skb->len/skb->truesize, which is ~0.66 in our environment, the window
      stays at ~0.25 * rcvbuf. This is because tp->window_clamp does not
      change together with the tp->scaling_ratio update when autotuning is
      disabled due to SO_RCVBUF. As a result, the window size is capped at the
      initial window_clamp, which is also ~0.25 * rcvbuf, and never grows
      bigger.
      
      Most modern applications let the kernel do autotuning, and benefit from
      the increased scaling_ratio. But there are applications such as kafka
      that has a default setting of SO_RCVBUF=64k.
      
      This patch increases the initial scaling_ratio from ~25% to 50% in order
      to make it backward compatible with the original default
      sysctl_tcp_adv_win_scale for applications setting SO_RCVBUF.
      
      Fixes: dfa2f048 ("tcp: get rid of sysctl_tcp_adv_win_scale")
      Signed-off-by: default avatarHechao Li <hli@netflix.com>
      Reviewed-by: default avatarTycho Andersen <tycho@tycho.pizza>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/netdev/20240402215405.432863-1-hli@netflix.com/Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      697a6c8c
    • David S. Miller's avatar
      Merge branch 'rtl8226b-serdes-switching' · c31bd5b6
      David S. Miller authored
      Eric Woudstra says:
      
      ====================
      rtl8226b/8221b add C45 instances and SerDes switching
      
      Based on the comments in [PATCH net-next]
      "Realtek RTL822x PHY rework to c45 and SerDes interface switching"
      
      Adds SerDes switching interface between 2500base-x and sgmii for
      rtl8221b and rtl8226b.
      
      Add get_rate_matching() for rtl8226b and rtl8221b, reading the serdes
      mode from phy.
      
      Driver instances are added for rtl8226b and rtl8221b for Clause 45
      access only. The existing code is not touched, they use newly added
      functions. They also use the same rtl822xb_config_init() and
      rtl822xb_get_rate_matching() as these functions also can be used for
      direct Clause 45 access. Also Adds definition of MMC 31 registers,
      which cannot be used through C45-over-C22, only when phydev->is_c45
      is set.
      
      Change rtlgen_get_speed() so the register value is passed as argument.
      Using Clause 45 access, this value is retrieved differently.
      Rename it to rtlgen_decode_speed() and add a call to it in
      rtl822x_c45_read_status().
      
      Add rtl822x_c45_get_features() to set supported port for rtl8221b.
      
      Then 1 quirk is added for sfp modules known to have a rtl8221b
      behind RollBall, Clause 45 only, protocol.
      
      Changed in PATCH v4:
      * Changed switch to if statement in rtl822xb_get_rate_matching()
      * Removed setting ETHTOOL_LINK_MODE_MII_BIT in rtl822x_c45_get_features()
      
      Changed in PATCH v3:
      * Only apply to rtl8221b and rtl8226b phy's
      * Set phydev->rate_matching in .config_init()
      * Removed OEM SFP fixup for now, as there are modules with the same
        vendor name/PN, but with different PHY's. We found rtl8221b, but
        also the ty8821, which is not yet supported.
      
      Changed in PATCH v2:
      * Set author to Marek for the commit of the new C45 instances
      * Separate commit for setting supported ports
      * Renamed rtlgen_get_speed to rtlgen_decode_speed
      * Always fill in possible interfaces
      * Renamed sfp_fixup_oem_2_5g to sfp_fixup_oem_2_5gbaset
      * Only update phydev->interface when link is up
      
      Alexander Couzens (1):
        net: phy: realtek: configure SerDes mode for rtl822xb PHYs
      
      Eric Woudstra (3):
        net: phy: realtek: add get_rate_matching() for rtl822xb PHYs
        net: phy: realtek: Change rtlgen_get_speed() to rtlgen_decode_speed()
        net: phy: realtek: add rtl822x_c45_get_features() to set supported
          port
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c31bd5b6
    • Marek Behún's avatar
      net: sfp: add quirk for another multigig RollBall transceiver · 1c77c721
      Marek Behún authored
      Add quirk for another RollBall copper transceiver: Turris RTSFP-2.5G,
      containing 2.5g capable RTL8221B PHY.
      Signed-off-by: default avatarMarek Behún <kabel@kernel.org>
      Signed-off-by: default avatarEric Woudstra <ericwouds@gmail.com>
      Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1c77c721
    • Eric Woudstra's avatar
      net: phy: realtek: add rtl822x_c45_get_features() to set supported port · 2d9ce648
      Eric Woudstra authored
      Sets ETHTOOL_LINK_MODE_TP_BIT in phydev->supported.
      Signed-off-by: default avatarEric Woudstra <ericwouds@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2d9ce648
    • Eric Woudstra's avatar
      net: phy: realtek: Change rtlgen_get_speed() to rtlgen_decode_speed() · 2e4ea707
      Eric Woudstra authored
      The value of the register to determine the speed, is retrieved
      differently when using Clause 45 only. To use the rtlgen_get_speed()
      function in this case, pass the value of the register as argument to
      rtlgen_get_speed(). The function would then always return 0, so change it
      to void. A better name for this function now is rtlgen_decode_speed().
      
      Replace a call to genphy_read_status() followed by rtlgen_get_speed()
      with a call to rtlgen_read_status() in rtl822x_read_status().
      
      Add reading speed to rtl822x_c45_read_status().
      Signed-off-by: default avatarEric Woudstra <ericwouds@gmail.com>
      Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2e4ea707