Nikolay Aleksandrov
2021-Feb-10 10:31 UTC
[Bridge] [PATCH v3 net-next 00/11] Cleanup in brport flags switchdev offload for DSA
On 10/02/2021 11:14, Vladimir Oltean wrote:> From: Vladimir Oltean <vladimir.oltean at nxp.com> > > The initial goal of this series was to have better support for > standalone ports mode and multiple bridges on the DSA drivers like > ocelot/felix and sja1105. Proper support for standalone mode requires > disabling address learning, which in turn requires interaction with the > switchdev notifier, which is actually where most of the patches are. > > I also noticed that most of the drivers are actually talking either to > firmware or SPI/MDIO connected devices from the brport flags switchdev > attribute handler, so it makes sense to actually make it sleepable > instead of atomic. >Hi Vladimir, Let's take a step back for a moment and discuss the bridge unlock/lock sequences that come with this set. I'd really like to avoid those as they're a recipe for future problems. The only good way to achieve that currently is to keep the PRE_FLAGS call and do that in unsleepable context but move the FLAGS call after the flags have been changed (if they have changed obviously). That would make the code read much easier since we'll have all our lock/unlock sequences in the same code blocks and won't play games to get sleepable context. Please let's think and work in that direction, rather than having: + spin_lock_bh(&p->br->lock); + if (err) { + netdev_err(p->dev, "%s\n", extack._msg); + return err; } + which immediately looks like a bug even though after some code checking we can verify it's ok. WDYT? I plan to get rid of most of the br->lock since it's been abused for a very long time because it's essentially STP lock, but people have started using it for other things and I plan to fix that when I get more time. Thanks, Nik
Vladimir Oltean
2021-Feb-10 10:45 UTC
[Bridge] [PATCH v3 net-next 00/11] Cleanup in brport flags switchdev offload for DSA
Hi Nikolay, On Wed, Feb 10, 2021 at 12:31:43PM +0200, Nikolay Aleksandrov wrote:> Hi Vladimir, > Let's take a step back for a moment and discuss the bridge unlock/lock sequences > that come with this set. I'd really like to avoid those as they're a recipe > for future problems. The only good way to achieve that currently is to keep > the PRE_FLAGS call and do that in unsleepable context but move the FLAGS call > after the flags have been changed (if they have changed obviously). That would > make the code read much easier since we'll have all our lock/unlock sequences > in the same code blocks and won't play games to get sleepable context. > Please let's think and work in that direction, rather than having: > + spin_lock_bh(&p->br->lock); > + if (err) { > + netdev_err(p->dev, "%s\n", extack._msg); > + return err; > } > + > > which immediately looks like a bug even though after some code checking we can > verify it's ok. WDYT? > > I plan to get rid of most of the br->lock since it's been abused for a very long > time because it's essentially STP lock, but people have started using it for other > things and I plan to fix that when I get more time.This won't make the sysfs codepath any nicer, will it?