From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, idosch@mellanox.com, eladr@mellanox.com,
sfeldma@gmail.com, f.fainelli@gmail.com, linux@roeck-us.net,
vivien.didelot@savoirfairelinux.com, andrew@lunn.ch,
john.fastabend@gmail.com, David.Laight@ACULAB.COM,
stephen@networkplumber.org
Subject: [patch net-next v4 0/7] switchdev: change locking
Date: Mon, 12 Oct 2015 19:54:20 +0200 [thread overview]
Message-ID: <1444672467-20621-1-git-send-email-jiri@resnulli.us> (raw)
From: Jiri Pirko <jiri@mellanox.com>
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 delayed work.
Flush function for 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 :/
Jiri Pirko (7):
switchdev: introduce switchdev workqueue
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 | 13 +-
include/net/switchdev.h | 14 +-
net/bridge/br_fdb.c | 7 +-
net/bridge/br_if.c | 3 +
net/bridge/br_stp.c | 3 +-
net/dsa/slave.c | 2 +-
net/switchdev/switchdev.c | 289 ++++++++++++++++++++++++-----------
7 files changed, 231 insertions(+), 100 deletions(-)
--
1.9.3
next reply other threads:[~2015-10-12 17:54 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-12 17:54 Jiri Pirko [this message]
2015-10-12 17:54 ` [patch net-next v4 1/7] switchdev: introduce switchdev workqueue Jiri Pirko
2015-10-13 3:01 ` Scott Feldman
2015-10-12 18:03 ` [patch net-next v4 2/7] switchdev: allow caller to explicitly request attr_set as deferred Jiri Pirko
2015-10-12 18:03 ` [patch net-next v4 3/7] switchdev: remove pointers from switchdev objects Jiri Pirko
2015-10-13 3:01 ` Scott Feldman
2015-10-13 4:44 ` John Fastabend
2015-10-12 18:03 ` [patch net-next v4 4/7] switchdev: introduce possibility to defer obj_add/del Jiri Pirko
2015-10-13 3:08 ` Scott Feldman
2015-10-12 18:03 ` [patch net-next v4 5/7] bridge: defer switchdev fdb del call in fdb_del_external_learn Jiri Pirko
2015-10-13 3:28 ` Scott Feldman
2015-10-13 3:31 ` John Fastabend
2015-10-13 4:19 ` Scott Feldman
2015-10-13 5:16 ` John Fastabend
2015-10-13 6:05 ` Jiri Pirko
2015-10-13 6:46 ` Scott Feldman
2015-10-12 18:03 ` [patch net-next v4 6/7] rocker: remove nowait from switchdev callbacks Jiri Pirko
2015-10-13 4:02 ` Scott Feldman
2015-10-13 6:25 ` Jiri Pirko
2015-10-13 6:55 ` Scott Feldman
2015-10-12 18:03 ` [patch net-next v4 7/7] switchdev: assert rtnl mutex when going over lower netdevs Jiri Pirko
2015-10-13 2:52 ` [patch net-next v4 2/7] switchdev: allow caller to explicitly request attr_set as deferred Scott Feldman
2015-10-13 4:40 ` John Fastabend
2015-10-13 5:45 ` Jiri Pirko
2015-10-13 5:48 ` John Fastabend
2015-10-13 5:44 ` Jiri Pirko
2015-10-13 6:03 ` John Fastabend
2015-10-13 6:21 ` Jiri Pirko
2015-10-13 6:53 ` Scott Feldman
2015-10-13 7:30 ` Jiri Pirko
2015-10-13 14:07 ` Scott Feldman
2015-10-13 14:39 ` Jiri Pirko
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=1444672467-20621-1-git-send-email-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=David.Laight@ACULAB.COM \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=eladr@mellanox.com \
--cc=f.fainelli@gmail.com \
--cc=idosch@mellanox.com \
--cc=john.fastabend@gmail.com \
--cc=linux@roeck-us.net \
--cc=netdev@vger.kernel.org \
--cc=sfeldma@gmail.com \
--cc=stephen@networkplumber.org \
--cc=vivien.didelot@savoirfairelinux.com \
/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).