From: Joseph Huang <joseph.huang.2024@gmail.com>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: "Joseph Huang" <Joseph.Huang@garmin.com>,
netdev@vger.kernel.org, "Andrew Lunn" <andrew@lunn.ch>,
"Florian Fainelli" <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Roopa Prabhu" <roopa@nvidia.com>,
"Nikolay Aleksandrov" <razor@blackwall.org>,
"Linus Lüssing" <linus.luessing@c0d3.blue>,
linux-kernel@vger.kernel.org, bridge@lists.linux.dev
Subject: Re: [PATCH RFC net-next 07/10] net: dsa: mv88e6xxx: Track bridge mdb objects
Date: Tue, 30 Apr 2024 12:27:56 -0400 [thread overview]
Message-ID: <f5ca9b38-3729-49a1-b221-fcc3aecba5d6@gmail.com> (raw)
In-Reply-To: <20240430005949.44lcegwhmcetpddm@skbuf>
On 4/29/2024 8:59 PM, Vladimir Oltean wrote:
> On Mon, Apr 29, 2024 at 06:07:25PM -0400, Joseph Huang wrote:
>> Something like this (some layers omitted for brevity)?
>>
>> +br_iterator
>> | for each mdb
>> | _br_switchdev_mdb_notify
>> rtnl_lock | without F_DEFER flag
>> | | |
>> +switchdev_port_attr_set_deferred | +switchdev_port_obj_notify
>> | | |
>> +dsa_port_mrouter | +dsa_user_port_obj_a/d
>> | | |
>> +mv88e6xxx_port_mrouter----------+ +mv88e6xxx_port_obj_a/d
>> |
>> +--------------------------------------+
>> |
>> rtnl_unlock
>
> At a _very_ superficial glance, I don't think you are properly
> accounting for the fact that even with rtnl_lock() held, there are still
> SWITCHDEV_OBJ_ID_PORT_MDB events which may be pending on the switchdev
> chain. Without a switchdev_deferred_process() flush call, you won't be
> getting rid of them, so when you rtnl_unlock(), they will still run.
>
> Even worse, holding rtnl_lock() will not stop the bridge multicast layer
> from modifying its br->mdb_list; only br->multicast_lock will.
>
> So you may be better off also acquiring br->multicast_lock, and
> notifying the MDB entries to the switchdev chain _with_the F_DEFER flag.
Like this?
+br_iterator(dsa_cb)
| lock br->multicask_lock
| for each mdb
| br_switchdev_mdb_notify
rtnl_lock | |
| | +switchdev_port_obj_._defer
+switchdev_port_attr_set_deferred | unlock br->multicast_lock
| |
+dsa_port_mrouter |
| |
+mv88e6xxx_port_mrouter----------+
|
+--------------------------------------+
|
rtnl_unlock
(potential task change)
rtnl_lock
|
+switchdev_deferred_process
| flush all queued dfitems in queuing order
|
rtnl_unlock
I'm not that familiar with the bridge code, but is there any concern
with potential deadlock here (bewteen rtnl_lock and br->multicast_lock)?
>
>> Note that on the system I tested, each register read/write takes about 100us
>> to complete. For 100's of mdb groups, this would mean that we will be
>> holding rtnl lock for 10's of ms. I don't know if it's considered too long.
>
> Not sure how this is going to be any better if the iteration over MDB
> entries is done 100% in the driver, though - since its hook,
> dsa_port_mrouter(), runs entirely under rtnl_lock(). >
> Anyway, with the SWITCHDEV_F_DEFER flag, maybe the mdb object
> notifications can be made to run by switchdev only a few at a time, to
> give the network stack time to do other things as well.
next prev parent reply other threads:[~2024-04-30 16:27 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 0:10 [PATCH RFC net-next 00/10] MC Flood disable and snooping Joseph Huang
2024-04-02 0:11 ` [PATCH RFC net-next 01/10] net: bridge: Flood Queries even when mc flood is disabled Joseph Huang
2024-04-02 0:11 ` [PATCH RFC net-next 02/10] net: bridge: Always multicast_flood Reports Joseph Huang
2024-04-03 15:52 ` Simon Horman
2024-04-02 0:11 ` [PATCH RFC net-next 03/10] net: bridge: Always flood local subnet mc packets Joseph Huang
2024-04-02 0:11 ` [PATCH RFC net-next 04/10] net: dsa: mv88e6xxx: Add all hosts mc addr to ATU Joseph Huang
2024-04-02 18:08 ` Vladimir Oltean
2024-04-02 0:11 ` [PATCH RFC net-next 05/10] net: dsa: Add support for PORT_MROUTER attribute Joseph Huang
2024-04-02 0:11 ` [PATCH RFC net-next 06/10] net: dsa: mv88e6xxx: Track soft bridge objects Joseph Huang
2024-04-02 0:11 ` [PATCH RFC net-next 07/10] net: dsa: mv88e6xxx: Track bridge mdb objects Joseph Huang
2024-04-02 12:23 ` Vladimir Oltean
2024-04-04 20:43 ` Joseph Huang
2024-04-05 11:07 ` Vladimir Oltean
2024-04-05 18:58 ` Joseph Huang
2024-04-29 22:07 ` Joseph Huang
2024-04-30 0:59 ` Vladimir Oltean
2024-04-30 16:27 ` Joseph Huang [this message]
2024-05-02 20:37 ` Joseph Huang
2024-04-02 0:11 ` [PATCH RFC net-next 08/10] net: dsa: mv88e6xxx: Convert MAB to use bit flags Joseph Huang
2024-04-02 0:11 ` [PATCH RFC net-next 09/10] net: dsa: mv88e6xxx: Enable mc flood for mrouter port Joseph Huang
2024-04-03 15:49 ` Simon Horman
2024-04-02 0:11 ` [PATCH RFC net-next 10/10] net: dsa: mv88e6xxx: Offload " Joseph Huang
2024-04-02 9:28 ` [PATCH RFC net-next 00/10] MC Flood disable and snooping Nikolay Aleksandrov
2024-04-02 17:43 ` Vladimir Oltean
2024-04-02 18:50 ` Nikolay Aleksandrov
2024-04-02 20:46 ` Vladimir Oltean
2024-04-02 21:59 ` Nikolay Aleksandrov
2024-04-04 22:16 ` Joseph Huang
2024-04-05 10:20 ` Vladimir Oltean
2024-04-05 11:00 ` Nikolay Aleksandrov
2024-04-05 20:22 ` Joseph Huang
2024-04-05 21:15 ` Vladimir Oltean
2024-04-29 20:14 ` Joseph Huang
2024-04-30 1:21 ` Vladimir Oltean
2024-04-30 17:01 ` Joseph Huang
2024-05-02 12:12 ` Nikolay Aleksandrov
2025-02-26 20:20 ` Linus Lüssing
2025-02-26 22:17 ` Linus Lüssing
2024-04-02 12:43 ` Andrew Lunn
2024-04-04 21:35 ` Joseph Huang
2024-04-04 22:11 ` Andrew Lunn
2024-04-04 22:40 ` Joseph Huang
2024-04-05 13:09 ` Andrew Lunn
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=f5ca9b38-3729-49a1-b221-fcc3aecba5d6@gmail.com \
--to=joseph.huang.2024@gmail.com \
--cc=Joseph.Huang@garmin.com \
--cc=andrew@lunn.ch \
--cc=bridge@lists.linux.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linus.luessing@c0d3.blue \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
--cc=roopa@nvidia.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