From: Sasha Levin <sashal@kernel.org>
To: Antoine Tenart <atenart@kernel.org>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Jakub Kicinski <kuba@kernel.org>,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
sdf@fomichev.me, jdamato@fastly.com,
aleksander.lobakin@intel.com, kuniyu@amazon.com,
shaw.leon@gmail.com, netdev@vger.kernel.org
Subject: Re: [PATCH AUTOSEL 6.14 554/642] net-sysfs: remove rtnl_trylock from device attributes
Date: Tue, 20 May 2025 10:10:48 -0400 [thread overview]
Message-ID: <aCyNaDS3w8UEv7El@lappy> (raw)
In-Reply-To: <jj7nizvkfuas57zcfkkbdaqnxzjdlgwtgzlkgzpazbrdnzhlc3@6ohz5cfz3tds>
On Tue, May 06, 2025 at 10:12:40AM +0200, Antoine Tenart wrote:
>Hello,
>
>On Mon, May 05, 2025 at 06:12:50PM -0400, Sasha Levin wrote:
>> From: Antoine Tenart <atenart@kernel.org>
>>
>> [ Upstream commit 79c61899b5eee317907efd1b0d06a1ada0cc00d8 ]
>>
>> There is an ABBA deadlock between net device unregistration and sysfs
>> files being accessed[1][2]. To prevent this from happening all paths
>> taking the rtnl lock after the sysfs one (actually kn->active refcount)
>> use rtnl_trylock and return early (using restart_syscall)[3], which can
>> make syscalls to spin for a long time when there is contention on the
>> rtnl lock[4].
>>
>> There are not many possibilities to improve the above:
>> - Rework the entire net/ locking logic.
>> - Invert two locks in one of the paths — not possible.
>>
>> But here it's actually possible to drop one of the locks safely: the
>> kernfs_node refcount. More details in the code itself, which comes with
>> lots of comments.
>>
>> Note that we check the device is alive in the added sysfs_rtnl_lock
>> helper to disallow sysfs operations to run after device dismantle has
>> started. This also help keeping the same behavior as before. Because of
>> this calls to dev_isalive in sysfs ops were removed.
>>
>> [1] https://lore.kernel.org/netdev/49A4D5D5.5090602@trash.net/
>> [2] https://lore.kernel.org/netdev/m14oyhis31.fsf@fess.ebiederm.org/
>> [3] https://lore.kernel.org/netdev/20090226084924.16cb3e08@nehalam/
>> [4] https://lore.kernel.org/all/20210928125500.167943-1-atenart@kernel.org/T/
>>
>> Signed-off-by: Antoine Tenart <atenart@kernel.org>
>> Link: https://patch.msgid.link/20250204170314.146022-2-atenart@kernel.org
>> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>
>I'm not sure why commits from this series were flagged for stable trees,
>but I would not advise to take them. They are not fixing a bug, only
>improving performances by reducing lock contention.
>
>The commits are:
>
>79c61899b5ee net-sysfs: remove rtnl_trylock from device attributes
>b7ecc1de51ca net-sysfs: move queue attribute groups outside the default groups
>[It seems this one was missed?]
>7e54f85c6082 net-sysfs: prevent uncleared queues from being re-added
>[My guess is this looks like a real fix, but it's only preventing an
>issue after the changes made in the series]
>b0b6fcfa6ad8 net-sysfs: remove rtnl_trylock from queue attributes
>
>Same applies for the other stable backport requests.
I'll drop them, thanks!
--
Thanks,
Sasha
next prev parent reply other threads:[~2025-05-20 14:10 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250505221419.2672473-1-sashal@kernel.org>
2025-05-05 22:03 ` [PATCH AUTOSEL 6.14 014/642] SUNRPC: Don't allow waiting for exiting tasks Sasha Levin
2025-05-05 22:04 ` [PATCH AUTOSEL 6.14 033/642] SUNRPC: rpc_clnt_set_transport() must not change the autobind setting Sasha Levin
2025-05-05 22:04 ` [PATCH AUTOSEL 6.14 034/642] SUNRPC: rpcbind should never reset the port to the value '0' Sasha Levin
2025-05-05 22:04 ` [PATCH AUTOSEL 6.14 038/642] mctp: Fix incorrect tx flow invalidation condition in mctp-i2c Sasha Levin
2025-05-05 22:04 ` [PATCH AUTOSEL 6.14 039/642] net: tn40xx: add pci-id of the aqr105-based Tehuti TN4010 cards Sasha Levin
2025-05-05 22:04 ` [PATCH AUTOSEL 6.14 040/642] net: tn40xx: create swnode for mdio and aqr105 phy and add to mdiobus Sasha Levin
2025-05-05 22:04 ` [PATCH AUTOSEL 6.14 051/642] net/mlx5e: Use right API to free bitmap memory Sasha Levin
2025-05-05 22:04 ` [PATCH AUTOSEL 6.14 053/642] r8169: disable RTL8126 ZRX-DC timeout Sasha Levin
2025-05-05 22:05 ` [PATCH AUTOSEL 6.14 115/642] net/mlx5: Preserve rate settings when creating a rate node Sasha Levin
2025-05-05 22:05 ` [PATCH AUTOSEL 6.14 117/642] bnxt_en: Query FW parameters when the CAPS_CHANGE bit is set Sasha Levin
2025-05-05 22:05 ` [PATCH AUTOSEL 6.14 118/642] ixgbe: add support for thermal sensor event reception Sasha Levin
2025-05-05 22:05 ` [PATCH AUTOSEL 6.14 125/642] bpftool: Using the right format specifiers Sasha Levin
2025-05-05 22:05 ` [PATCH AUTOSEL 6.14 130/642] tcp: reorganize tcp_in_ack_event() and tcp_count_delivered() Sasha Levin
2025-05-05 22:06 ` [PATCH AUTOSEL 6.14 145/642] net/smc: use the correct ndev to find pnetid by pnetid table Sasha Levin
2025-05-05 22:06 ` [PATCH AUTOSEL 6.14 164/642] net: stmmac: dwmac-rk: Validate GRF and peripheral GRF during probe Sasha Levin
2025-05-05 22:06 ` [PATCH AUTOSEL 6.14 165/642] net: hsr: Fix PRP duplicate detection Sasha Levin
2025-05-05 22:06 ` [PATCH AUTOSEL 6.14 169/642] netfilter: conntrack: Bound nf_conntrack sysctl writes Sasha Levin
2025-05-05 22:06 ` [PATCH AUTOSEL 6.14 192/642] r8169: increase max jumbo packet size on RTL8125/RTL8126 Sasha Levin
2025-05-05 22:06 ` [PATCH AUTOSEL 6.14 193/642] ipv6: save dontfrag in cork Sasha Levin
2025-05-05 22:07 ` [PATCH AUTOSEL 6.14 227/642] tcp: bring back NUMA dispersion in inet_ehash_locks_alloc() Sasha Levin
2025-05-05 22:07 ` [PATCH AUTOSEL 6.14 230/642] ieee802154: ca8210: Use proper setters and getters for bitwise types Sasha Levin
2025-05-05 22:07 ` [PATCH AUTOSEL 6.14 242/642] net: phylink: use pl->link_interface in phylink_expects_phy() Sasha Levin
2025-05-05 22:07 ` [PATCH AUTOSEL 6.14 261/642] net: ethernet: ti: cpsw_new: populate netdev of_node Sasha Levin
2025-05-05 22:07 ` [PATCH AUTOSEL 6.14 262/642] eth: fbnic: Prepend TSENE FW fields with FBNIC_FW Sasha Levin
2025-05-05 22:07 ` [PATCH AUTOSEL 6.14 263/642] net: phy: nxp-c45-tja11xx: add match_phy_device to TJA1103/TJA1104 Sasha Levin
2025-05-05 22:08 ` [PATCH AUTOSEL 6.14 264/642] dpll: Add an assertion to check freq_supported_num Sasha Levin
2025-05-05 22:08 ` [PATCH AUTOSEL 6.14 268/642] net: pktgen: fix mpls maximum labels list parsing Sasha Levin
2025-05-05 22:08 ` [PATCH AUTOSEL 6.14 273/642] ipv4: fib: Move fib_valid_key_len() to rtm_to_fib_config() Sasha Levin
2025-05-05 22:08 ` [PATCH AUTOSEL 6.14 274/642] ipv4: fib: Hold rtnl_net_lock() in ip_rt_ioctl() Sasha Levin
2025-05-05 22:08 ` [PATCH AUTOSEL 6.14 299/642] net/mlx5: Avoid report two health errors on same syndrome Sasha Levin
2025-05-05 22:08 ` [PATCH AUTOSEL 6.14 300/642] selftests/net: have `gro.sh -t` return a correct exit code Sasha Levin
2025-05-05 22:08 ` [PATCH AUTOSEL 6.14 308/642] net: ethernet: mtk_ppe_offload: Allow QinQ, double ETH_P_8021Q only Sasha Levin
2025-05-05 22:08 ` [PATCH AUTOSEL 6.14 309/642] net: xgene-v2: remove incorrect ACPI_PTR annotation Sasha Levin
2025-05-05 22:08 ` [PATCH AUTOSEL 6.14 310/642] dmaengine: ti: k3-udma-glue: Drop skip_fdq argument from k3_udma_glue_reset_rx_chn Sasha Levin
2025-05-05 22:08 ` [PATCH AUTOSEL 6.14 312/642] bonding: report duplicate MAC address in all situations Sasha Levin
2025-05-05 22:08 ` [PATCH AUTOSEL 6.14 313/642] tcp: be less liberal in TSEcr received while in SYN_RECV state Sasha Levin
2025-05-05 22:08 ` [PATCH AUTOSEL 6.14 319/642] Octeontx2-af: RPM: Register driver with PCI subsys IDs Sasha Levin
2025-05-05 22:09 ` [PATCH AUTOSEL 6.14 330/642] vhost-scsi: Return queue full for page alloc failures during copy Sasha Levin
2025-05-05 22:09 ` [PATCH AUTOSEL 6.14 335/642] net/mlx5e: Add correct match to check IPSec syndromes for switchdev mode Sasha Levin
2025-05-05 22:09 ` [PATCH AUTOSEL 6.14 338/642] net: stmmac: Correct usage of maximum queue number macros Sasha Levin
2025-05-05 22:09 ` [PATCH AUTOSEL 6.14 347/642] net/mlx5: Change POOL_NEXT_SIZE define value and make it global Sasha Levin
2025-05-05 22:09 ` [PATCH AUTOSEL 6.14 351/642] net: ipv6: Init tunnel link-netns before registering dev Sasha Levin
2025-05-05 22:09 ` [PATCH AUTOSEL 6.14 352/642] rtnetlink: Lookup device in target netns when creating link Sasha Levin
2025-05-05 22:09 ` [PATCH AUTOSEL 6.14 372/642] net: pktgen: fix access outside of user given buffer in pktgen_thread_write() Sasha Levin
2025-05-05 22:09 ` [PATCH AUTOSEL 6.14 375/642] bpf: Prevent unsafe access to the sock fields in the BPF timestamping callback Sasha Levin
2025-05-05 22:09 ` [PATCH AUTOSEL 6.14 377/642] netdevsim: call napi_schedule from a timer context Sasha Levin
2025-05-05 22:10 ` [PATCH AUTOSEL 6.14 396/642] eth: mlx4: don't try to complete XDP frames in netpoll Sasha Levin
2025-05-05 22:10 ` [PATCH AUTOSEL 6.14 399/642] vxlan: Join / leave MC group after remote changes Sasha Levin
2025-05-05 22:10 ` [PATCH AUTOSEL 6.14 407/642] net/mlx5: Modify LSB bitmask in temperature event to include only the first bit Sasha Levin
2025-05-05 22:10 ` [PATCH AUTOSEL 6.14 408/642] net/mlx5: Apply rate-limiting to high temperature warning Sasha Levin
2025-05-05 22:10 ` [PATCH AUTOSEL 6.14 434/642] bnxt_en: Set NPAR 1.2 support when registering with firmware Sasha Levin
2025-05-05 22:10 ` [PATCH AUTOSEL 6.14 435/642] net/mlx4_core: Avoid impossible mlx4_db_alloc() order value Sasha Levin
2025-05-05 22:11 ` [PATCH AUTOSEL 6.14 456/642] net: stmmac: dwmac-loongson: Set correct {tx,rx}_fifo_size Sasha Levin
2025-05-05 22:11 ` [PATCH AUTOSEL 6.14 486/642] net/mlx5: XDP, Enable TX side XDP multi-buffer support Sasha Levin
2025-05-05 22:11 ` [PATCH AUTOSEL 6.14 487/642] net/mlx5: Extend Ethtool loopback selftest to support non-linear SKB Sasha Levin
2025-05-05 22:11 ` [PATCH AUTOSEL 6.14 488/642] net/mlx5e: set the tx_queue_len for pfifo_fast Sasha Levin
2025-05-05 22:11 ` [PATCH AUTOSEL 6.14 489/642] net/mlx5e: reduce rep rxq depth to 256 for ECPF Sasha Levin
2025-05-05 22:11 ` [PATCH AUTOSEL 6.14 490/642] net/mlx5e: reduce the max log mpwrq sz for ECPF and reps Sasha Levin
2025-05-05 22:11 ` [PATCH AUTOSEL 6.14 492/642] xfrm: prevent high SEQ input in non-ESN mode Sasha Levin
2025-05-05 22:11 ` [PATCH AUTOSEL 6.14 498/642] mptcp: pm: userspace: flags: clearer msg if no remote addr Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 506/642] wifi: mac80211: Drop cooked monitor support Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 507/642] net: fec: Refactor MAC reset to function Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 511/642] ip: fib_rules: Fetch net from fib_rule in fib[46]_rule_configure() Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 512/642] r8152: add vendor/device ID pair for Dell Alienware AW1022z Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 515/642] igc: Avoid unnecessary link down event in XDP_SETUP_PROG process Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 518/642] ice: Don't check device type when checking GNSS presence Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 519/642] net: ethtool: prevent flow steering to RSS contexts which don't exist Sasha Levin
2025-05-06 6:31 ` Gal Pressman
2025-05-20 14:11 ` Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 533/642] netdevsim: allow normal queue reset while down Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 534/642] net: page_pool: avoid false positive warning if NAPI was never added Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 543/642] eth: fbnic: set IFF_UNICAST_FLT to avoid enabling promiscuous mode when adding unicast addrs Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 544/642] tools: ynl-gen: don't output external constants Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 545/642] net/mlx5e: Avoid WARN_ON when configuring MQPRIO with HTB offload enabled Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 547/642] vxlan: Annotate FDB data races Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 548/642] ipv4: ip_gre: Fix set but not used warning in ipgre_err() if IPv4-only Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 549/642] r8169: don't scan PHY addresses > 0 Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 550/642] net: flush_backlog() small changes Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 551/642] bridge: mdb: Allow replace of a host-joined group Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 552/642] net-sysfs: remove rtnl_trylock from queue attributes Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 553/642] net-sysfs: prevent uncleared queues from being re-added Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 554/642] net-sysfs: remove rtnl_trylock from device attributes Sasha Levin
2025-05-06 8:12 ` Antoine Tenart
2025-05-20 14:10 ` Sasha Levin [this message]
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 555/642] ice: init flow director before RDMA Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 556/642] ice: treat dyn_allowed only as suggestion Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 561/642] ice: count combined queues using Rx/Tx count Sasha Levin
2025-05-05 22:12 ` [PATCH AUTOSEL 6.14 563/642] net/mana: fix warning in the writer of client oob Sasha Levin
2025-05-05 22:13 ` [PATCH AUTOSEL 6.14 580/642] bpf: Use kallsyms to find the function name of a struct_ops's stub function Sasha Levin
2025-05-05 22:14 ` [PATCH AUTOSEL 6.14 632/642] ipv6: remove leftover ip6 cookie initializer Sasha Levin
2025-05-05 22:14 ` [PATCH AUTOSEL 6.14 642/642] net-sysfs: restore behavior for not running devices Sasha Levin
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=aCyNaDS3w8UEv7El@lappy \
--to=sashal@kernel.org \
--cc=aleksander.lobakin@intel.com \
--cc=atenart@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jdamato@fastly.com \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=shaw.leon@gmail.com \
--cc=stable@vger.kernel.org \
/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 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).