From: Vlad Buslov <vladbu@nvidia•com>
To: Vladimir Oltean <vladimir.oltean@nxp•com>
Cc: <netdev@vger•kernel.org>, Jakub Kicinski <kuba@kernel•org>,
"David S. Miller" <davem@davemloft•net>,
Roopa Prabhu <roopa@nvidia•com>,
"Nikolay Aleksandrov" <nikolay@nvidia•com>,
Andrew Lunn <andrew@lunn•ch>,
"Florian Fainelli" <f.fainelli@gmail•com>,
Vivien Didelot <vivien.didelot@gmail•com>,
Vladimir Oltean <olteanv@gmail•com>,
Vadym Kochan <vkochan@marvell•com>,
Taras Chornyi <tchornyi@marvell•com>,
Jiri Pirko <jiri@nvidia•com>, "Ido Schimmel" <idosch@nvidia•com>,
<UNGLinuxDriver@microchip•com>,
"Grygorii Strashko" <grygorii.strashko@ti•com>,
Marek Behun <kabel@blackhole•sk>,
"DENG Qingfang" <dqfext@gmail•com>,
Kurt Kanzenbach <kurt@linutronix•de>,
"Hauke Mehrtens" <hauke@hauke-m•de>,
Woojung Huh <woojung.huh@microchip•com>,
"Sean Wang" <sean.wang@mediatek•com>,
Landen Chao <Landen.Chao@mediatek•com>,
Claudiu Manoil <claudiu.manoil@nxp•com>,
Alexandre Belloni <alexandre.belloni@bootlin•com>,
George McCollister <george.mccollister@gmail•com>,
Ioana Ciornei <ioana.ciornei@nxp•com>,
"Saeed Mahameed" <saeedm@nvidia•com>,
Leon Romanovsky <leon@kernel•org>,
Lars Povlsen <lars.povlsen@microchip•com>,
Steen Hegelund <Steen.Hegelund@microchip•com>,
Julian Wiedmann <jwi@linux•ibm.com>,
Alexandra Winter <wintera@linux•ibm.com>,
Karsten Graul <kgraul@linux•ibm.com>,
Heiko Carstens <hca@linux•ibm.com>,
Vasily Gorbik <gor@linux•ibm.com>,
Christian Borntraeger <borntraeger@de•ibm.com>,
Ivan Vecera <ivecera@redhat•com>, Jianbo Liu <jianbol@nvidia•com>,
Mark Bloch <mbloch@nvidia•com>, Roi Dayan <roid@nvidia•com>,
Tobias Waldekranz <tobias@waldekranz•com>,
"Vignesh Raghavendra" <vigneshr@ti•com>,
Jesse Brandeburg <jesse.brandeburg@intel•com>,
<linux-s390@vger•kernel.org>
Subject: Re: [PATCH v3 net-next 0/7] Make SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE blocking
Date: Fri, 20 Aug 2021 18:46:11 +0300 [thread overview]
Message-ID: <ygnhzgtcnmpo.fsf@nvidia.com> (raw)
In-Reply-To: <20210820115746.3701811-1-vladimir.oltean@nxp.com>
On Fri 20 Aug 2021 at 14:57, Vladimir Oltean <vladimir.oltean@nxp•com> wrote:
> Problem statement:
>
> Any time a driver needs to create a private association between a bridge
> upper interface and use that association within its
> SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE handler, we have an issue with FDB
> entries deleted by the bridge when the port leaves. The issue is that
> all switchdev drivers schedule a work item to have sleepable context,
> and that work item can be actually scheduled after the port has left the
> bridge, which means the association might have already been broken by
> the time the scheduled FDB work item attempts to use it.
>
> The solution is to modify switchdev to use its embedded SWITCHDEV_F_DEFER
> mechanism to make the FDB notifiers emitted from the fastpath be
> scheduled in sleepable context. All drivers are converted to handle
> SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE from their blocking notifier block
> handler (or register a blocking switchdev notifier handler if they
> didn't have one). This solves the aforementioned problem because the
> bridge waits for the switchdev deferred work items to finish before a
> port leaves (del_nbp calls switchdev_deferred_process), whereas a work
> item privately scheduled by the driver will obviously not be waited upon
> by the bridge, leading to the possibility of having the race.
>
> This is a dependency for the "DSA FDB isolation" posted here. It was
> split out of that series hence the numbering starts directly at v2.
>
> https://patchwork.kernel.org/project/netdevbpf/cover/20210818120150.892647-1-vladimir.oltean@nxp.com/
>
> Changes in v3:
> - make "addr" part of switchdev_fdb_notifier_info to avoid dangling
> pointers not watched by RCU
> - mlx5 correction
> - build fixes in the S/390 qeth driver
>
> Vladimir Oltean (7):
> net: bridge: move br_fdb_replay inside br_switchdev.c
> net: switchdev: keep the MAC address by value in struct
> switchdev_notifier_fdb_info
> net: switchdev: move SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE to the blocking
> notifier chain
> net: bridge: switchdev: make br_fdb_replay offer sleepable context to
> consumers
> net: switchdev: drop the atomic notifier block from
> switchdev_bridge_port_{,un}offload
> net: switchdev: don't assume RCU context in
> switchdev_handle_fdb_{add,del}_to_device
> net: dsa: handle SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE synchronously
>
> .../ethernet/freescale/dpaa2/dpaa2-switch.c | 75 ++++------
> .../marvell/prestera/prestera_switchdev.c | 104 ++++++-------
> .../mellanox/mlx5/core/en/rep/bridge.c | 65 +++++++--
> .../ethernet/mellanox/mlx5/core/esw/bridge.c | 2 +-
> .../ethernet/mellanox/mlxsw/spectrum_router.c | 4 +-
> .../mellanox/mlxsw/spectrum_switchdev.c | 62 ++++++--
> .../microchip/sparx5/sparx5_mactable.c | 2 +-
> .../microchip/sparx5/sparx5_switchdev.c | 72 ++++-----
> drivers/net/ethernet/mscc/ocelot_net.c | 3 -
> drivers/net/ethernet/rocker/rocker_main.c | 67 ++++-----
> drivers/net/ethernet/rocker/rocker_ofdpa.c | 6 +-
> drivers/net/ethernet/ti/am65-cpsw-nuss.c | 4 +-
> drivers/net/ethernet/ti/am65-cpsw-switchdev.c | 54 +++----
> drivers/net/ethernet/ti/cpsw_new.c | 4 +-
> drivers/net/ethernet/ti/cpsw_switchdev.c | 57 ++++----
> drivers/s390/net/qeth_l2_main.c | 26 ++--
> include/net/switchdev.h | 33 ++++-
> net/bridge/br.c | 5 +-
> net/bridge/br_fdb.c | 54 -------
> net/bridge/br_private.h | 6 -
> net/bridge/br_switchdev.c | 128 +++++++++++++---
> net/dsa/dsa.c | 15 --
> net/dsa/dsa_priv.h | 15 --
> net/dsa/port.c | 3 -
> net/dsa/slave.c | 138 ++++++------------
> net/switchdev/switchdev.c | 61 +++++++-
> 26 files changed, 550 insertions(+), 515 deletions(-)
For mlx5 parts:
Reviewed-and-tested-by: Vlad Buslov <vladbu@nvidia•com>
next prev parent reply other threads:[~2021-08-20 15:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-20 11:57 [PATCH v3 net-next 0/7] Make SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE blocking Vladimir Oltean
2021-08-20 11:57 ` [PATCH v3 net-next 1/7] net: bridge: move br_fdb_replay inside br_switchdev.c Vladimir Oltean
2021-08-20 11:57 ` [PATCH v3 net-next 2/7] net: switchdev: keep the MAC address by value in struct switchdev_notifier_fdb_info Vladimir Oltean
2021-08-20 11:57 ` [PATCH v3 net-next 3/7] net: switchdev: move SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE to the blocking notifier chain Vladimir Oltean
2021-08-20 15:54 ` Jakub Kicinski
2021-08-20 15:57 ` Vladimir Oltean
2021-08-20 16:55 ` Jakub Kicinski
2021-08-20 11:57 ` [PATCH v3 net-next 4/7] net: bridge: switchdev: make br_fdb_replay offer sleepable context to consumers Vladimir Oltean
2021-08-20 11:57 ` [PATCH v3 net-next 5/7] net: switchdev: drop the atomic notifier block from switchdev_bridge_port_{,un}offload Vladimir Oltean
2021-08-20 11:57 ` [PATCH v3 net-next 6/7] net: switchdev: don't assume RCU context in switchdev_handle_fdb_{add,del}_to_device Vladimir Oltean
2021-08-20 11:57 ` [PATCH v3 net-next 7/7] net: dsa: handle SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE synchronously Vladimir Oltean
2021-08-20 15:46 ` Vlad Buslov [this message]
2021-08-26 14:35 ` [PATCH v3 net-next 0/7] Make SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE blocking Alexandra Winter
2021-08-26 14:41 ` Vladimir Oltean
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=ygnhzgtcnmpo.fsf@nvidia.com \
--to=vladbu@nvidia$(echo .)com \
--cc=Landen.Chao@mediatek$(echo .)com \
--cc=Steen.Hegelund@microchip$(echo .)com \
--cc=UNGLinuxDriver@microchip$(echo .)com \
--cc=alexandre.belloni@bootlin$(echo .)com \
--cc=andrew@lunn$(echo .)ch \
--cc=borntraeger@de$(echo .)ibm.com \
--cc=claudiu.manoil@nxp$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=dqfext@gmail$(echo .)com \
--cc=f.fainelli@gmail$(echo .)com \
--cc=george.mccollister@gmail$(echo .)com \
--cc=gor@linux$(echo .)ibm.com \
--cc=grygorii.strashko@ti$(echo .)com \
--cc=hauke@hauke-m$(echo .)de \
--cc=hca@linux$(echo .)ibm.com \
--cc=idosch@nvidia$(echo .)com \
--cc=ioana.ciornei@nxp$(echo .)com \
--cc=ivecera@redhat$(echo .)com \
--cc=jesse.brandeburg@intel$(echo .)com \
--cc=jianbol@nvidia$(echo .)com \
--cc=jiri@nvidia$(echo .)com \
--cc=jwi@linux$(echo .)ibm.com \
--cc=kabel@blackhole$(echo .)sk \
--cc=kgraul@linux$(echo .)ibm.com \
--cc=kuba@kernel$(echo .)org \
--cc=kurt@linutronix$(echo .)de \
--cc=lars.povlsen@microchip$(echo .)com \
--cc=leon@kernel$(echo .)org \
--cc=linux-s390@vger$(echo .)kernel.org \
--cc=mbloch@nvidia$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=nikolay@nvidia$(echo .)com \
--cc=olteanv@gmail$(echo .)com \
--cc=roid@nvidia$(echo .)com \
--cc=roopa@nvidia$(echo .)com \
--cc=saeedm@nvidia$(echo .)com \
--cc=sean.wang@mediatek$(echo .)com \
--cc=tchornyi@marvell$(echo .)com \
--cc=tobias@waldekranz$(echo .)com \
--cc=vigneshr@ti$(echo .)com \
--cc=vivien.didelot@gmail$(echo .)com \
--cc=vkochan@marvell$(echo .)com \
--cc=vladimir.oltean@nxp$(echo .)com \
--cc=wintera@linux$(echo .)ibm.com \
--cc=woojung.huh@microchip$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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