Skip to content

rtnetlink: allow selected handlers to run without rtnl

Florian Westphal netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest7 patches 5 repliesIn review
  2. v17 patches 4 repliesSuperseded

Changes in v2 from the cover letter

In patch 6, don't make ipv6 route handlers lockless, they all have assumptions on rtnl being held. Other patches are unchanged.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7rtnetlink: call rtnl_calcit directlynet/core/rtnetlink.c+4 -250 replies
2/7rtnetlink: make rtnl_register accept a flags parameterinclude/net/rtnetlink.h net/bridge/br_mdb.c net/can/gw.c +23 more+95 -960 replies
3/7rtnetlink: add reference counting to prevent module unload while dump is in progressnet/core/rtnetlink.c+13 -10 replies
4/7rtnetlink: small rtnl lock pushdownnet/core/rtnetlink.c+13 -60 replies
5/7rtnetlink: protect handler table with rcunet/core/rtnetlink.c+65 -561 reply
6/7rtnetlink: add RTNL_FLAG_DOIT_UNLOCKEDinclude/net/rtnetlink.h net/core/rtnetlink.c+19 -00 replies
7/7net: call newid/getid without rtnl mutex heldnet/core/net_namespace.c+3 -20 replies

Reviews trailers per patch

All 7 patches have a Reviewed-by or Acked-by.

PatchHannes Frederic Sowa
1/7R-b
2/7R-b
3/7R-b
4/7R-b
5/7R-b
6/7R-b
7/7R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 net-next 0/7] rtnetlink: allow selected handlers to run without rtnl

Changes since v1:
In patch 6, don't make ipv6 route handlers lockless, they all have assumptions on rtnl being held. Other patches are unchanged.

The RTNL mutex is used to serialize both rtnetlink calls and dump requests.
Its also used to protect other things such as the list of current net namespaces.

Unfortunately RTNL mutex is a performance issue, e.g. a cpu adding an ip address prevents other cpus from seemingly unrelated tasks such as dumping tc classifiers or doing rtnetlink route lookups.

This patch set adds basic infrastructure to start pushing the rtnl lock down to those places that need it, or even elide it entirely in some cases.

Subsystems can now indicate that their doit() callback can run without RTNL mutex, such callbacks can then run in parallel.

This will obviously need a lot of followup work; all current users need to be audited/changed to benefit from this. Initial no-rtnl spot is netns new/getid.

We have various 'get' handlers that are also a tempting target, however, several of these depend on rtnl mutex to prevent information from changing while objects are being read by rtnl handlers; however, it doesn't appear impossible to change this.

Dumps are another problem entirely, see
commit 2907c35ff64708065 ("net: hold rtnl again in dump callbacks"), this patchset doesn't touch dump requests.