Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] tap: do not hold RTNL in open(), release() and queue ioctls
@ 2026-11-19  7:22 Eric Dumazet
  2026-11-19  7:22 ` [PATCH net-next 1/4] tap: detach queues from the NETDEV_UNREGISTER notifier Eric Dumazet
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Eric Dumazet @ 2026-11-19  7:22 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni, Willem de Bruijn
  Cc: Kuniyuki Iwashima, Simon Horman, netdev, Eric Dumazet

Opening or closing a macvtap/ipvtap char device acquires RTNL, as do
the TUNSETQUEUE and TUNGETIFF ioctls, although they only manipulate
the list of queues attached to the device, which is private to tap.
Hosts starting and stopping many virtual machines thus add contention
on RTNL for no good reason.

This series protects the queue list with a per-device mutex, and
stops taking RTNL in these four paths.

Patch 1 makes sure tap_del_queues() is called for every unregistered
device, and that no queue can be attached afterwards. Both properties
are currently provided by RTNL being held in tap_open().

Patch 2 adds tap->lock and takes it wherever the queue list is used,
still under RTNL.

Patch 3 removes RTNL from open(), release(), TUNSETQUEUE and TUNGETIFF.

Patch 4 removes a device reference that is not needed by the ioctls
still running under RTNL.

TUNSETOFFLOAD, SIOCGIFHWADDR and SIOCSIFHWADDR still take RTNL, since
they call into the core stack. The datapath is unchanged.

Testing: selftests net/tap and net/ipvtap_test.sh pass. A test program
(not part of this series) checking the queue limit, attach/detach,
txqueuelen change, rename, netns move and device or lower device
removal with open queues gives the same results before and after the
series. The same program was used to run open/ioctl/read/write/close
loops against concurrent link add/del/rename/netns moves for macvtap
and ipvtap, on a kernel with lockdep, PROVE_RCU and KASAN enabled,
without any splat. No test was done with vhost-net or real VM.

Eric Dumazet (4):
  tap: detach queues from the NETDEV_UNREGISTER notifier
  tap: add a mutex to protect queue management
  tap: do not hold RTNL in open(), release() and queue ioctls
  tap: remove tap_get_tap_dev() and tap_put_tap_dev()

 drivers/net/ipvlan/ipvtap.c |  23 ++++--
 drivers/net/macvlan.c       |   3 +-
 drivers/net/macvtap.c       |  24 ++++--
 drivers/net/tap.c           | 184 ++++++++++++++++++++++++++------------------
 include/linux/if_macvlan.h  |   2 +
 include/linux/if_tap.h      |  12 +++
 net/core/dev.c              |   1 +
 7 files changed, 161 insertions(+), 88 deletions(-)


base-commit: 66726ba54a01a2951688a56f5eb4d13d063acbea
-- 
2.53.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-19  7:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19  7:22 [PATCH net-next 0/4] tap: do not hold RTNL in open(), release() and queue ioctls Eric Dumazet
2026-11-19  7:22 ` [PATCH net-next 1/4] tap: detach queues from the NETDEV_UNREGISTER notifier Eric Dumazet
2026-11-19  7:22 ` [PATCH net-next 2/4] tap: add a mutex to protect queue management Eric Dumazet
2026-11-19  7:22 ` [PATCH net-next 3/4] tap: do not hold RTNL in open(), release() and queue ioctls Eric Dumazet
2026-11-19  7:22 ` [PATCH net-next 4/4] tap: remove tap_get_tap_dev() and tap_put_tap_dev() Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox