Skip to content

switchdev: change locking

Jiri Pirko netdev 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest8 patches 11 repliesIn review
  2. v47 patches 24 repliesSuperseded
  3. v37 patches 1 replySuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v27 patches5 repliesSuperseded
v17 patches1 replySuperseded

v1->v2 from the cover letter

- rebased on current net-next head (including Scott's ageing patchset) v2->v3:
- fixed comment s/of/or/ typo suggested by Nik

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8switchdev: introduce switchdev deferred ops infrastructureinclude/net/switchdev.h net/switchdev/switchdev.c+85 -00 replies
2/8switchdev: make struct switchdev_attr parameter const for attr_set callsdrivers/net/ethernet/rocker/rocker.c include/net/switchdev.h net/dsa/slave.c +1 more+9 -81 reply
3/8switchdev: allow caller to explicitly request attr_set as deferredinclude/net/switchdev.h net/bridge/br_stp.c net/switchdev/switchdev.c+46 -667 replies
4/8switchdev: remove pointers from switchdev objectsdrivers/net/ethernet/rocker/rocker.c include/net/switchdev.h net/bridge/br_fdb.c +2 more+15 -130 replies
5/8switchdev: introduce possibility to defer obj_add/delinclude/net/switchdev.h net/switchdev/switchdev.c+81 -202 replies
6/8bridge: defer switchdev fdb del call in fdb_del_external_learnnet/bridge/br_fdb.c net/bridge/br_if.c+7 -10 replies
7/8rocker: remove nowait from switchdev callbacks.drivers/net/ethernet/rocker/rocker.c+3 -40 replies
8/8switchdev: assert rtnl mutex when going over lower netdevsnet/switchdev/switchdev.c+11 -40 replies

Reviews trailers per patch

2 of 8 patches have a Reviewed-by or Acked-by.

PatchScott FeldmanJohn FastabendVivien Didelot
1/8
2/8R-b
3/8
4/8A-b R-b
5/8
6/8
7/8
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v5 thread

Cover letter [patch net-next v5 0/8] switchdev: change locking

From: Jiri Pirko <[email protected]>

This is something which I'm currently struggling with.
Callers of attr_set and obj_add/del often hold not only RTNL, but also spinlock (bridge). So in that case, the driver implementing the op cannot sleep.

The way rocker is dealing with this now is just to invoke driver operation and go out, without any checking or reporting of the operation status.

Since it would be nice to at least put a warning in case the operation fails, it makes sense to do this in delayed work directly in switchdev core instead of implementing this in separate drivers. And that is what this patchset is introducing.

So from now on, the locking of switchdev mod ops is consistent. Caller either holds rtnl mutex or in case it does not, caller sets defer flag, telling switchdev core to process the op later, in deferred queue.

Function to force to process switchdev deferred ops can be called by op caller in appropriate location, for example after it releases spin lock, to force switchdev core to process pending ops.

v1->v2:
- rebased on current net-next head (including Scott's ageing patchset) v2->v3:
- fixed comment s/of/or/ typo suggested by Nik
v3->v4:
- the actual patchset is sent instead of different branch I send in v3 :/ v4->v5:
- added patch to "const" attr param
- reworked deferred ops infrastructure (mainly patch number 1 and internal users (patch 3 and 5)) - resolves the issue pointed out by John

Jiri Pirko (8):
switchdev: introduce switchdev deferred ops infrastructure
switchdev: make struct switchdev_attr parameter const for attr_set
calls
switchdev: allow caller to explicitly request attr_set as deferred
switchdev: remove pointers from switchdev objects
switchdev: introduce possibility to defer obj_add/del
bridge: defer switchdev fdb del call in fdb_del_external_learn
rocker: remove nowait from switchdev callbacks.
switchdev: assert rtnl mutex when going over lower netdevs

 drivers/net/ethernet/rocker/rocker.c |  15 +-
 include/net/switchdev.h              |  20 ++-
 net/bridge/br_fdb.c                  |   7 +-
 net/bridge/br_if.c                   |   3 +
 net/bridge/br_stp.c                  |   3 +-
 net/dsa/slave.c                      |   4 +-
 net/switchdev/switchdev.c            | 315 ++++++++++++++++++++++++-----------
 7 files changed, 254 insertions(+), 113 deletions(-)
Signature · 1 line
1.9.3