From: Stanislav Fomichev <sdf@fomichev.me>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, Saeed Mahameed <saeed@kernel.org>,
David Wei <dw@davidwei.uk>
Subject: [PATCH net-next v8 00/12] net: Hold netdev instance lock during ndo operations
Date: Wed, 26 Feb 2025 13:10:56 -0800 [thread overview]
Message-ID: <20250226211108.387727-1-sdf@fomichev.me> (raw)
As the gradual purging of rtnl continues, start grabbing netdev
instance lock in more places so we can get to the state where
most paths are working without rtnl. Start with requiring the
drivers that use shaper api (and later queue mgmt api) to work
with both rtnl and netdev instance lock. Eventually we might
attempt to drop rtnl. This mostly affects iavf, gve, bnxt and
netdev sim (as the drivers that implement shaper/queue mgmt)
so those drivers are converted in the process.
call_netdevice_notifiers locking is very inconsistent and might need
a separate follow up. Some notified events are covered by the
instance lock, some are not, which might complicate the driver
expectations.
Changes since v7:
- fix AA deadlock detection in netdev_lock_cmp_fn (Jakub)
Changes since v6:
- rebase on top of net-next
Changes since v5:
- fix comment in bnxt_lock_sp (Michael)
- add netdev_lock/unlock around GVE suspend/resume (Sabrina)
- grab netdev lock around ethtool_ops->reset in cmis_fw_update_reset (Sabrina)
Changes since v4:
- reword documentation about rtnl_lock and instance lock relation
(Jakub)
- do s/RTNL/rtnl_lock/ in the documentation (Jakub)
- mention dev_xxx/netif_xxx distinction (Paolo)
- add new patch to add request_ops_lock opt-in (Jakub)
- drop patch that adds shaper API to dummy (Jakub)
- drop () around dev in netdev_need_ops_lock
Changes since v3:
- add instance lock to netdev_lockdep_set_classes,
move lock_set_cmp_fn to happen after set_class (NIPA)
Changes since v2:
- new patch to replace dev_addr_sem with instance lock (forwarding tests)
- CONFIG_LOCKDEP around netdev_lock_cmp_fn (Jakub)
- remove netif_device_present check from dev_setup_tc (bpf_offload.py)
- reorder bpf_devs_locks and instance lock ordering in bpf map
offload (bpf_offload.py)
Changes since v1:
- fix netdev_set_mtu_ext_locked in the wrong place (lkp@intel.com)
- add missing depend on CONFIG_NET_SHAPER for dummy device
(lkp@intel.com)
- not sure we need to apply dummy device patch..
- need_netdev_ops_lock -> netdev_need_ops_lock (Jakub)
- remove netdev_assert_locked near napi_xxx_locked calls (Jakub)
- fix netdev_lock_cmp_fn comment and line length (Jakub)
- fix kdoc style of dev_api.c routines (Jakub)
- reflow dev_setup_tc to avoid indent (Jakub)
- keep tc_can_offload checks outside of dev_setup_tc (Jakub)
Changes since RFC:
- other control paths are protected
- bntx has been converted to mostly depend on netdev instance lock
Cc: Saeed Mahameed <saeed@kernel.org>
Cc: David Wei <dw@davidwei.uk>
Jakub Kicinski (1):
net: ethtool: try to protect all callback with netdev instance lock
Stanislav Fomichev (11):
net: hold netdev instance lock during ndo_open/ndo_stop
net: hold netdev instance lock during ndo_setup_tc
net: hold netdev instance lock during queue operations
net: hold netdev instance lock during rtnetlink operations
net: hold netdev instance lock during ioctl operations
net: hold netdev instance lock during sysfs operations
net: hold netdev instance lock during ndo_bpf
net: replace dev_addr_sem with netdev instance lock
net: add option to request netdev instance lock
docs: net: document new locking reality
eth: bnxt: remove most dependencies on RTNL
Documentation/networking/netdevices.rst | 65 +++-
drivers/net/bonding/bond_main.c | 16 +-
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 133 ++++----
.../net/ethernet/broadcom/bnxt/bnxt_devlink.c | 9 +
.../net/ethernet/broadcom/bnxt/bnxt_sriov.c | 6 +
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 16 +-
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 18 +-
drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 3 +-
drivers/net/ethernet/google/gve/gve_main.c | 12 +-
drivers/net/ethernet/google/gve/gve_utils.c | 6 +-
drivers/net/ethernet/intel/iavf/iavf_main.c | 16 +-
drivers/net/netdevsim/ethtool.c | 2 -
drivers/net/netdevsim/netdev.c | 39 ++-
drivers/net/tap.c | 2 +-
drivers/net/tun.c | 2 +-
include/linux/netdevice.h | 90 ++++-
kernel/bpf/offload.c | 6 +-
net/8021q/vlan_dev.c | 4 +-
net/core/Makefile | 2 +-
net/core/dev.c | 284 ++++++----------
net/core/dev.h | 22 +-
net/core/dev_api.c | 318 ++++++++++++++++++
net/core/dev_ioctl.c | 69 ++--
net/core/net-sysfs.c | 9 +-
net/core/netdev_rx_queue.c | 5 +
net/core/rtnetlink.c | 50 ++-
net/dsa/conduit.c | 16 +-
net/dsa/user.c | 5 +-
net/ethtool/cabletest.c | 20 +-
net/ethtool/cmis_fw_update.c | 7 +-
net/ethtool/features.c | 6 +-
net/ethtool/ioctl.c | 6 +
net/ethtool/module.c | 8 +-
net/ethtool/netlink.c | 12 +
net/ethtool/phy.c | 20 +-
net/ethtool/rss.c | 2 +
net/ethtool/tsinfo.c | 9 +-
net/netfilter/nf_flow_table_offload.c | 2 +-
net/netfilter/nf_tables_offload.c | 2 +-
net/sched/cls_api.c | 2 +-
net/sched/sch_api.c | 8 +-
net/sched/sch_cbs.c | 8 +-
net/sched/sch_etf.c | 8 +-
net/sched/sch_ets.c | 4 +-
net/sched/sch_fifo.c | 4 +-
net/sched/sch_gred.c | 2 +-
net/sched/sch_htb.c | 2 +-
net/sched/sch_mq.c | 2 +-
net/sched/sch_mqprio.c | 6 +-
net/sched/sch_prio.c | 2 +-
net/sched/sch_red.c | 5 +-
net/sched/sch_taprio.c | 17 +-
net/sched/sch_tbf.c | 4 +-
net/xdp/xsk.c | 3 +
net/xdp/xsk_buff_pool.c | 2 +
55 files changed, 934 insertions(+), 464 deletions(-)
create mode 100644 net/core/dev_api.c
--
2.48.1
next reply other threads:[~2025-02-26 21:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 21:10 Stanislav Fomichev [this message]
2025-02-26 21:10 ` [PATCH net-next v8 01/12] net: hold netdev instance lock during ndo_open/ndo_stop Stanislav Fomichev
2025-02-26 21:10 ` [PATCH net-next v8 02/12] net: hold netdev instance lock during ndo_setup_tc Stanislav Fomichev
2025-02-26 21:10 ` [PATCH net-next v8 03/12] net: hold netdev instance lock during queue operations Stanislav Fomichev
2025-02-26 21:11 ` [PATCH net-next v8 04/12] net: hold netdev instance lock during rtnetlink operations Stanislav Fomichev
2025-02-26 21:11 ` [PATCH net-next v8 05/12] net: hold netdev instance lock during ioctl operations Stanislav Fomichev
2025-02-26 21:11 ` [PATCH net-next v8 06/12] net: hold netdev instance lock during sysfs operations Stanislav Fomichev
2025-02-26 21:11 ` [PATCH net-next v8 07/12] net: hold netdev instance lock during ndo_bpf Stanislav Fomichev
2025-02-26 21:11 ` [PATCH net-next v8 08/12] net: ethtool: try to protect all callback with netdev instance lock Stanislav Fomichev
2025-02-27 8:48 ` Maxime Chevallier
2025-02-27 22:40 ` Stanislav Fomichev
2025-02-26 21:11 ` [PATCH net-next v8 09/12] net: replace dev_addr_sem " Stanislav Fomichev
2025-02-26 21:11 ` [PATCH net-next v8 10/12] net: add option to request " Stanislav Fomichev
2025-02-26 21:11 ` [PATCH net-next v8 11/12] docs: net: document new locking reality Stanislav Fomichev
2025-02-26 21:11 ` [PATCH net-next v8 12/12] eth: bnxt: remove most dependencies on RTNL Stanislav Fomichev
2025-02-28 1:27 ` [PATCH net-next v8 00/12] net: Hold netdev instance lock during ndo operations Jakub Kicinski
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=20250226211108.387727-1-sdf@fomichev.me \
--to=sdf@fomichev.me \
--cc=davem@davemloft.net \
--cc=dw@davidwei.uk \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeed@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