From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C683DC4338F for ; Thu, 19 Aug 2021 16:07:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A8166610A3 for ; Thu, 19 Aug 2021 16:07:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233731AbhHSQI3 (ORCPT ); Thu, 19 Aug 2021 12:08:29 -0400 Received: from mail-db8eur05on2074.outbound.protection.outlook.com ([40.107.20.74]:24161 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230305AbhHSQI1 (ORCPT ); Thu, 19 Aug 2021 12:08:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oHV+ENG+KcMuKDAo+cNF529Zwf13LlgPr5mvzfZuuEQx6eG0Is0fRmpGEuwJWp92P0/QWlf6HMAS7C+Y7OFkZBgwhMsjb6IeJ/sj6ImYmLnznMQaFBJPUuzHv2ot0Qf5S3jGN0bvSXKkGxDbt1/gRClxUDYB/WORgXzulMoMZxQ9AOeS/eKquKE/j2iBDpc9qT+ttweZ9Hl80VICPS2aGILrSKZJkbKI6FE4K2esUG8LCa43YP3O80n1X1m23zYJcfJyF8M2PCGOdgKVbF+EKLe9GonPLMVhAvFZauSRBBzWJFqkoU2vpAwLbJv5/sJJ9wqPsCaxOsSG9LmqXHDJew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fS1vNUljl5/8lMDXgwKxSXVVO0W+Um0xsrOmXRczSEs=; b=YdqMxlUEwEpY+KFqXK+xlpJ3al6q8dBSuGSXjX1Uo9AV2xVAKkuIXUTEP9w6y/Hq11e7ZZKLzdXT7f037S6XHs1F/8xLRf/2LVWetbqy/ky54hotet0DUWBsWjEGTzseuzsnSDd0N08oqXnT6msI+peiVTdBCYcpTpETXd6D/B64aF/KDgB2uaGRbzmln3iOhVCedfJBtlSnI+HVqqgh7Tz+2cKmtTQoiYFLTnisqXnBOHV8LxZhKbNIOtV/AGIYxWiiG7Qdi2Nuj9uPc6YlUpu7slQZZzHssNTzrdg+9K8QvyuA0ENeM/e2D3Ef0KRRyMQG/vxx+27sM1tBRl4wiA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fS1vNUljl5/8lMDXgwKxSXVVO0W+Um0xsrOmXRczSEs=; b=mwmQAs2o5xk3WPGQMfzqkDT90sp87zg7zFKhXv1pR+PO0nFUu6Jiyt6upamnEz3qMzd1a4kO0N4odNqGVbLCinQvC/d1ZRVkkGB/GVg4yxg4rElvJ/TzuIDtsOtwvaJCRM+BGERLJTYwPRnJRuP5i7QBHeHeOIUWYwyM7GZHkD8= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB6269.eurprd04.prod.outlook.com (2603:10a6:803:fa::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Thu, 19 Aug 2021 16:07:49 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::109:1995:3e6b:5bd0]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::109:1995:3e6b:5bd0%2]) with mapi id 15.20.4436.019; Thu, 19 Aug 2021 16:07:48 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" Cc: Roopa Prabhu , Nikolay Aleksandrov , Andrew Lunn , Florian Fainelli , Vivien Didelot , Vladimir Oltean , Vadym Kochan , Taras Chornyi , Jiri Pirko , Ido Schimmel , UNGLinuxDriver@microchip.com, Grygorii Strashko , Marek Behun , DENG Qingfang , Kurt Kanzenbach , Hauke Mehrtens , Woojung Huh , Sean Wang , Landen Chao , Claudiu Manoil , Alexandre Belloni , George McCollister , Ioana Ciornei , Saeed Mahameed , Leon Romanovsky , Lars Povlsen , Steen Hegelund , Julian Wiedmann , Karsten Graul , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Ivan Vecera , Vlad Buslov , Jianbo Liu , Mark Bloch , Roi Dayan , Tobias Waldekranz , Vignesh Raghavendra , Jesse Brandeburg Subject: [PATCH v2 net-next 0/5] Make SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE blocking Date: Thu, 19 Aug 2021 19:07:18 +0300 Message-Id: <20210819160723.2186424-1-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: AM8P189CA0004.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:218::9) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.144.60) by AM8P189CA0004.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:218::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Thu, 19 Aug 2021 16:07:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bfef60fe-0dc4-40ce-7b1d-08d9632b7d25 X-MS-TrafficTypeDiagnostic: VI1PR04MB6269: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8+paLhDkQT6flVrXnVZL3q5TQh4IQU8AkPXVEz2fPECkM6kIEfFccIAVsWUReWPaHiHlpXsS9AaHZx31BvS1povYVB5EP8f5glbesI0W7BTZZS2nX0Ng2DzgvfwEuvEVhDwBHmV9Z2d6VINA8+1Jm8tE2cghF45feDFvCjAMyKQOWczSiFfAxM7RWaQTiUExxQv82wVKP73rzH3Ft9+9No+WMTXTG29Wt6Q4PgY2qGjAghroDp4Znn+7z+LIxs1nsQAnzLfDFm/xam8uWBilqGcUdxXCIepNGj1yYM0yvKwGRIH3lcDNs3dLgbWtIqRcB1b3kSnTThKlZZTMZIpzqmWOX1t23Ylf19Ar1zqeJccgE81/JUESZtakKlv3QRNYF03y1SGKokO/1rEHctGBDldycFVKyqNqTXF2pPTGO0W7oc3ESoPcXUKlMLW3ysaVsspVgoonA+8n6TatDF+L0i+blrXIYnFoN3QgkVCCOePUuCDmRQ/VNfqYZudDc5Ys8KZWwVctsthYaR8o/wNivtOk9IewXcv1whEerexjL17TQ+rxtfi15CkrfZCO78p8TGAz+HYpGf1WUWRGIKvxA1uJO8QS1ndqHhgitEoM7G0TJBXzeoNV7X7eYHVReNCpTZV9bSu3iLAiYeOwZRH/wx/PofLwo6rOcDZ3zq8cfTyVWpVaWD4j9zlld9RIb1vZWYEwnfn4xYzNTTT8FbxGAxp+KadbewwJxUgPwoo00EBvq0cAunKyR6CLZid9cQ4NTEXJKun/Wfs3gXQeO+M5cQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(346002)(39860400002)(136003)(396003)(366004)(7406005)(2616005)(26005)(6486002)(38350700002)(5660300002)(38100700002)(7416002)(4326008)(8676002)(316002)(54906003)(110136005)(6512007)(6506007)(6666004)(478600001)(44832011)(186003)(1076003)(8936002)(956004)(66476007)(966005)(52116002)(2906002)(83380400001)(36756003)(86362001)(66946007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ZLy8cRwnMZNRjG9+4XijIUwBkA+68BDhiLURjUCtzgqBkBzHt8Te0pbj0kNa?= =?us-ascii?Q?yBtp6i6E5bAMTe1o73rU1nkXhI58Nkojce+3aH8iPpn9OPej23NblDVq0UHz?= =?us-ascii?Q?6MqlDFLDsjOtVvCqX0aS1pKwhHZ091tcD77UttmTsZRvb6V+xhY92i8TTQJG?= =?us-ascii?Q?tx2igr2JK1ZGv8KDWybpsNE7DU/ac6cwQp1yP77kV9hF0Hv6BABEX+T0VIzq?= =?us-ascii?Q?YpbCTuCFCHhH2qgGnZQm4sVltUgNM2elP6mWMMZww8SreJ07l65nEljkdpIl?= =?us-ascii?Q?gPEyLR8IsRhnXHTOBlm+e6eY5X7NI6SIY3JAoGTVzLj6teKKx5OwR5cHx1sZ?= =?us-ascii?Q?H3UspgQ0/UU4LQmjCyg/+4euiT1eUqNVBD2vHjaIX1cdZrYGXyXDPHkHErQ6?= =?us-ascii?Q?kyr+pnhZa34cSgdeUX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1TXYVVvgDN?= =?us-ascii?Q?MVODC4ySU0iPby7l6zHqRSSh?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bfef60fe-0dc4-40ce-7b1d-08d9632b7d25 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2021 16:07:48.6806 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eopzUFqujEMwGrAnmW2jd7Kxe4oDxhrCZIet6pyR8etNQpZJnDEgjk8mWFYe853QLQ2Xr8Yhwy/xFuNSY0+8Yg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6269 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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/ Vladimir Oltean (5): 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 | 86 +++++------ .../marvell/prestera/prestera_switchdev.c | 110 +++++++------- .../mellanox/mlx5/core/en/rep/bridge.c | 59 +++++++- .../mellanox/mlxsw/spectrum_switchdev.c | 61 +++++++- .../microchip/sparx5/sparx5_switchdev.c | 78 +++++----- drivers/net/ethernet/mscc/ocelot_net.c | 3 - drivers/net/ethernet/rocker/rocker_main.c | 73 ++++----- drivers/net/ethernet/rocker/rocker_ofdpa.c | 4 +- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 4 +- drivers/net/ethernet/ti/am65-cpsw-switchdev.c | 57 ++++---- drivers/net/ethernet/ti/cpsw_new.c | 4 +- drivers/net/ethernet/ti/cpsw_switchdev.c | 60 ++++---- drivers/s390/net/qeth_l2_main.c | 10 +- include/net/switchdev.h | 30 +++- net/bridge/br.c | 5 +- net/bridge/br_fdb.c | 40 ++++- net/bridge/br_private.h | 4 - net/bridge/br_switchdev.c | 18 +-- 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 +++++++- 23 files changed, 529 insertions(+), 409 deletions(-) -- 2.25.1