From patchwork Tue Aug 24 11:40:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12454847 X-Patchwork-Delegate: kuba@kernel.org 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,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 85848C4338F for ; Tue, 24 Aug 2021 11:41:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64832613AB for ; Tue, 24 Aug 2021 11:41:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236876AbhHXLmZ (ORCPT ); Tue, 24 Aug 2021 07:42:25 -0400 Received: from mail-eopbgr80078.outbound.protection.outlook.com ([40.107.8.78]:43248 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236803AbhHXLmO (ORCPT ); Tue, 24 Aug 2021 07:42:14 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U53a8pmtLg5EH5gDCnv3yuJK1r9TCCXXEc2wJGhzxUuvhxk4q+xOABN7FUDg41lN7cw0dpIaBD/qi+UhWkEtxke5k915QsUfz4sVkGmjI/MA0stkU8R2n+1ZGuMh/TejhyJUXXTb9Va1ejj6r7KveZR7c7BCCsEluzVyVpQMdECvo2G0oxD6E2N2jPUZsPFpUUYXF2aJ/Xx08Dakq/UBxpYzNS3qGkgQGScwBP7EtWCTsX3eTC3zWSxYHOK1mf3GedHMDNnx/hwLc0Jw4uLYLGNVl6m5fsEoje9MNuQ9Tmsqh5PlyAV1k+C++ZwMQHkYOztWpP3veeXjvYyCjZwmLw== 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=1MLoEG/rnDqVFrRVQuKAgy3tKTMZTYxjQ2iWsAUtwgw=; b=ZUWOhinC2e3D1a7u1M8NI0C9VOFkwfqJ4ZO7FCPOtct0HcZtO8V6Av9lvQsaQnOeIjjfqaQjPfa4qjBwj25VftmZswv/SK5IwUTdcgt2Skf6ZjGUOjvkNF7WQyp+FpeY1lBmijDnFTed5nAl95WRWwvSm1j13ejrEhzkAyogAGgqB+zP76rtEmPa/oVszXkMqVXGgl6R9GDHrMTFH/o/YTC29QuT2L4in7ZVWFwZ7SJWLtO4lMYo6j+M8TvWelCMs9axMRDuPKeVu8FKpWa2pM0/ufTD0ZYWQBSBee0pLUp4rL4aChuwM+0KjcDPTeWMtCHiD2D4RrKDdrnqGr1pyw== 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=1MLoEG/rnDqVFrRVQuKAgy3tKTMZTYxjQ2iWsAUtwgw=; b=qx21YIy4+9svLSmublr0VNwH/Xy/UWlxcWNObGB1+FerT1IDsCxi04FWqwsYAtXkbn8mnrex49ZfX4x4mU73OHgPWZvm8r/k45Svvucpkf3qSh8+N5cbE+cBVXAQ/C39B5VCM5AIjl4upG/w/4JnrxnB+2IsKosDZwwz2hxlShA= 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 VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Tue, 24 Aug 2021 11:41:21 +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.025; Tue, 24 Aug 2021 11:41:21 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vivien Didelot , Vladimir Oltean , UNGLinuxDriver@microchip.com, DENG Qingfang , Kurt Kanzenbach , Hauke Mehrtens , Woojung Huh , Sean Wang , Landen Chao , Alexandre Belloni , George McCollister , John Crispin , Aleksander Jan Bajkowski , Egil Hjelmeland , Oleksij Rempel Subject: [RFC PATCH net-next 5/8] net: dsa: drop rtnl_lock from dsa_slave_switchdev_event_work Date: Tue, 24 Aug 2021 14:40:46 +0300 Message-Id: <20210824114049.3814660-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210824114049.3814660-1-vladimir.oltean@nxp.com> References: <20210824114049.3814660-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: FR0P281CA0083.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1e::18) 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 FR0P281CA0083.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.6 via Frontend Transport; Tue, 24 Aug 2021 11:41:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3c95c00a-84b0-4e76-7115-08d966f41832 X-MS-TrafficTypeDiagnostic: VI1PR04MB5696: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q3ieuOD15rLjv8GNVwC0WbdX1tbW/KXlrqdq/NYmXDy2b5b9IRMUAelf/uHWJE2nfCJJYh745ji+wUyldd+miUS0i4ggIgAZNxxr+WZXITOlTDFOJlEeKeVeRVZqD6fMEd/PK36B57qxIs2nVuW8ZQe2mz+CVy12jZUYPZuZbxUegNN9iUyppRC05oCzJVSMJRy58uYtSdgyrun0THyQSetldPkgbwJfCrofrPtuH+YbrwoCMGFCeOBzLbcxQ/JL2CNFDPw+ertFpiTXJ3xcfTIBfi0VY3+D1VGXbgetx7Po0ufLJsa46Dg1SYC+1JDP+7ZDhAkdLQ0jgANNGBvKxWxGzWD+qJrg5+2/SZPzhWJmorRs9ZNx5Mc5pBvFjM8rK3HcaI+MDdGDskOP41KNOxdWMaz1p70VS88JbGftvj0LawRoZoVhpI4ylc3xgPVsxhp+D2STv5LpH8/z+J7TqFsEyQu+/92UvEXzd8Gvfa1XdILATleOYrybi8AyZBT4FpW3VCeCec+0hshHSMCi08xIGKmQ/D3b51FFcWbpD8yzevP99L+0+gPwOS9s5m6s6zjCbjCZZhTUp6e2ExTJ7hs6jFM0f2Cl8yoSdZcEu8DifLry7mUVgAAva3mPtST8yG1R4yU5YgDNA9Kvy9BnnLHyC4hDHB4rAIrN5f2cy6qSIEShSBUhRM//IXC4Tulh2j/XpV/VKftF9sWAFI3Nbw== 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)(366004)(346002)(396003)(136003)(39850400004)(376002)(52116002)(4326008)(478600001)(5660300002)(6916009)(66476007)(66556008)(26005)(83380400001)(1076003)(36756003)(66946007)(6486002)(6666004)(6512007)(7416002)(6506007)(186003)(8676002)(8936002)(2616005)(86362001)(44832011)(38100700002)(38350700002)(956004)(2906002)(54906003)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 48Qjl3ZBzyZQRFJXaNWyCRHIc8H6wqhwKJqk8FUhY4WxHhn647ka3Wz/fX5Zckjeu7mGmwJLZZIRsIB6TDyExcik1yUuco58A6SGz18NGAFPJ46rpuiuX79cTJE6UOmzpUUWtPEMWb486Y/XmpM8DJBpXZQC0lpcjuab8GfD3H5A2iGm/0Om37ckk/MbEzdliCySNf3uTPCc0q/CNbOaVrDhVCdgyFdIdexd7DJe/k7MO9xOt9dykhoy6crcpp4m6mFkihRLrAuRE+f8NoDmWPNfrFk6UZeU/KBTLQtXEfHbB0YQkVDyUCJrBMCnyrfkQZK0WCwqk8ZC7+dhW9bJMFuG9VGajOH2YM0EntYm33QMgbrbBbrv/2kpkWvcHRfsh1lpsYNTPXsGMonpVwCpahRmMXNXYwcgwzZCMX/WSEbMfyn3kgbUqPksywNSwexN57KS9h7FOLRcrMY9us1fRnojes0CDP4VIzoDJH0k8TDnl29qvW57BlpHz1X1NeL2qD3ZXsqHIiwKJnqK7GesRKFz0C5Ej3kmNVLkbJ/ZUTcZxL2n61tT65gnQVGtPC+L+Cbyr/xiKpQbljF7r1WH5LHu0GrE3JcipAurSIw6ftNeBs+a4I8m54QjxjtWQHYlPotQitd8skDKrzWhovbNCe0eUTvx3YXW/T9fDtM6wTpY5OLoJ/FYpyX4Tlf01jjZsAzimbzxfKa+2LbfMnp+QEZArxM8yJqN+IhPFMCUmqkgb21E2JVfAoiaohdzweklo7zzJmIxt9GchTYEpiHhBYvAuyXHTqOSy8k7c/QgaO9YczUbROwCfIJc4z3xBIIjklwnknwRYP22kUjIZLY6FE1vgBFsRfuILXsrU9k6o3QJ3BgDBO+1zvUV7nAGADr1IiXkg4mqa8P20DetuXjF1k6MekhzcK2phZbJfrMtcKDzL16AiqLegQM7XauQQj+AcpQfM9qvMqxD0vsgByRzbVWzZ+zKqvnRXQSAxR4EjaXylZVTpeajB2azBqYh67tQGoa55wsipz5OkRHZKXfiCIfj6RUZ2Z3mvMj+P8oh+7Hmtw2gw0wGJ+XXuxjqdmofIzziqAAQ1mEcl9CE5A6igScXSz37zAk3BcB7eBlwcHw3YHYMUXRTW16jnO5vr1oUpSW1aWEOcgLpjWoxVocIVMMkOW/PFS+ZJySvNUDHFzc8ug/phpYxtFKLlkHotWad4uVlEYtn58lOdFKudPAiqn3ePxK71Nzfzg69aXXjLJBK8BEGCKYV46lM2AhS9yShrClQ+CLsWPYZTc9j00qRv2sAHLqNSv5okWSdnQkPG854MiwcXKb9TNMSKKMUsL5D X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c95c00a-84b0-4e76-7115-08d966f41832 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2021 11:41:21.4867 (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: x5uoLMkB4eTfCAcRllI9TYEFvUAgCCDtuDrDP/BcQbk29rL+IW0KkJKeg8T3sDcK2gRin3qEYqqZmpNZWEzObw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5696 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC After talking with Ido Schimmel, it became clear that rtnl_lock is not actually required for anything that is done inside the SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE deferred work handlers. The reason why it was probably added by Arkadi Sharshevsky in commit c9eb3e0f8701 ("net: dsa: Add support for learning FDB through notification") was to offer the same locking/serialization guarantees as .ndo_fdb_{add,del} and avoid reworking any drivers. DSA has implemented .ndo_fdb_add and .ndo_fdb_del until commit b117e1e8a86d ("net: dsa: delete dsa_legacy_fdb_add and dsa_legacy_fdb_del") - that is to say, until fairly recently. But those methods have been deleted, so now we are free to drop the rtnl_lock as well. Note that exposing DSA switch drivers to an unlocked method which was previously serialized by the rtnl_mutex is a potentially dangerous affair. Driver writers couldn't ensure that their internal locking scheme does the right thing even if they wanted. We could err on the side of paranoia and introduce a switch-wide lock inside the DSA framework, but that seems way overreaching. Instead, we could check as many drivers for regressions as we can, fix those first, then let this change go in once it is assumed to be fairly safe. Signed-off-by: Vladimir Oltean --- net/dsa/slave.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 662ff531d4e2..53394fb43d67 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -2381,7 +2381,6 @@ static void dsa_slave_switchdev_event_work(struct work_struct *work) dp = dsa_to_port(ds, switchdev_work->port); - rtnl_lock(); switch (switchdev_work->event) { case SWITCHDEV_FDB_ADD_TO_DEVICE: if (switchdev_work->host_addr) @@ -2416,7 +2415,6 @@ static void dsa_slave_switchdev_event_work(struct work_struct *work) break; } - rtnl_unlock(); dev_put(switchdev_work->dev); kfree(switchdev_work);