Message ID | c8cb7c89c468882cc7f9ce0d98e17e147630ed52.1528388122.git.petrm@mellanox.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Ido Schimmel |
Headers | show
Return-Path: <linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 330C460467 for <patchwork-linux-mlxsw@patchwork.kernel.org>; Thu, 7 Jun 2018 16:17:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 222F8299D5 for <patchwork-linux-mlxsw@patchwork.kernel.org>; Thu, 7 Jun 2018 16:17:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16E7F299E6; Thu, 7 Jun 2018 16:17:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3EBC0299D5 for <patchwork-linux-mlxsw@patchwork.kernel.org>; Thu, 7 Jun 2018 16:17:43 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 411rKw40WFzF34t for <patchwork-linux-mlxsw@patchwork.kernel.org>; Fri, 8 Jun 2018 02:17:40 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="G0Y+e+YT"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=40.107.3.63; helo=eur03-am5-obe.outbound.protection.outlook.com; envelope-from=petrm@mellanox.com; receiver=<UNKNOWN>) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="G0Y+e+YT"; dkim-atps=neutral Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30063.outbound.protection.outlook.com [40.107.3.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 411rKm5yPKzF34J for <linux-mlxsw@lists.ozlabs.org>; Fri, 8 Jun 2018 02:17:31 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IMNM/BAtRNjVtzRno47dCnKtw+n5SMA0LKH4K2O8T5A=; b=G0Y+e+YTnd8WnJ8qqAW0UEzF7mk8wjWPabnnNOgMwQfpgsIurmHYt4r7xalzf3zsSUTX/k93MqeP1/8IqXL+AKh4tW31QM+uLdFkXd0OxQwpj2Azx4Tsk+8a/EDN90QVEsZB7sa+U/Q5dbyD9dEKdlg6QMB8BI/G3lcl4o/OLHo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by AM6PR05MB4184.eurprd05.prod.outlook.com (2603:10a6:209:40::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.15; Thu, 7 Jun 2018 16:17:23 +0000 From: Petr Machata <petrm@mellanox.com> To: <linux-internal@mellanox.com> Subject: [PATCH net mlxsw v2] mlxsw: spectrum_switchdev: Fix port_vlan refcounting Message-Id: <c8cb7c89c468882cc7f9ce0d98e17e147630ed52.1528388122.git.petrm@mellanox.com> Date: Thu, 07 Jun 2018 18:17:17 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [78.45.160.211] X-ClientProxiedBy: LO2P265CA0024.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:62::36) To AM6PR05MB4184.eurprd05.prod.outlook.com (2603:10a6:209:40::29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:AM6PR05MB4184; X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4184; 3:M4NRzcmn75xOW9cUseCbDN9JxqzimJ1GPpTzAlohqAKczvlCadQGtPQ4YQdjTwT6YGml8iaDstkF1ih8ocC3zul14N5SK+qZX3BiDZHgmhGip9VPx7p428M8TNNJ2BXlitE0zwVy9Awv7oaP1F24dNPXM8zJRym+QGbv9y2MNVNWM43Rl5LgnhzYRmKKNwzjLJ8CBsWlwMmabyjihU24EwmtL2r/1MkuzmpQ0g5vW4Lv2mlcUWBMHkxsFh2Rqjkg; 25:PxEbso8ewTQ+fXzAJ0Y7nNVnLcoXmzyN7cODGGqO5PWIpS5uYSTRpKxKplkDihkWQY5+AqLoPeQZYBliKQv+ovqMem3wExFAOhwG3Aw937lcBwMRKxIJ3wPZFBkBhHy8O2obPy/4DUn59mO9aJbDuPxn8eippoQwBJq1oVtvVdCwb06zH77cGLw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cUuFWG0GmAbbg5PWq94a/7ycwujNJTGNtgSxmM19k0wP7HPZ/a5Jr+yEW1sf62gtjLSgxwkmVagzc3HNJndemIlwdOjFwzZKomJrwfqnmIUZsGaJlJ3FUOMM5l44MOYOQYGy/Cgpi+J2sGmOyHhBIQWdOwR/KULeJCAaKDkJ71e7UFCUlBxkLy0nU6tk8T2xX6Tg+Kiwj9xZRw/lFqHOpI5WRWhFztO69IpGRFivlH X-Microsoft-Antispam-PRVS: <AM6PR05MB4184E0DC37E0EDC4F28F319EDB640@AM6PR05MB4184.eurprd05.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:AM6PR05MB4184; BCL:0; PCL:0; RULEID:; SRVR:AM6PR05MB4184; X-Forefront-PRVS: 06968FD8C4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(376002)(346002)(396003)(366004)(199004)(189003)(66066001)(47776003)(2906002)(6636002)(6666003)(68736007)(5660300001)(8676002)(6862004)(106356001)(2351001)(105586002)(36756003)(6486002)(478600001)(7736002)(53936002)(8936002)(305945005)(3846002)(6116002)(25786009)(81156014)(81166006)(16526019)(86362001)(186003)(118296001)(956004)(26005)(6496006)(2616005)(316002)(16586007)(486006)(50466002)(476003)(48376002)(58126008)(52116002)(51416003)(97736004)(386003)(59450400001)(37006003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB4184; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM6PR05MB4184; 23:DIqPz33WTITXZ5DsntfwUyt44PDVu4mWmiy43ePi0?= =?us-ascii?Q?dYi1ej3+nEFY/Q9rF8K6YwrlkOHGpgqVNGeRdG7D6BwDG+L/gpWqtEEYPLGU?= =?us-ascii?Q?dyr6mQPSvaFMGb6W+YmTiURXahHu6BhJav33JpRghDJvVeM+yL0zm7+nYiok?= =?us-ascii?Q?EZWQ70YYO0Cm7yRo4sa8JUGuVAp/iEnRdsixOXWEmFnDQiYx7ZcNcReMT6PW?= =?us-ascii?Q?inLK20KP4/0TuIoVgs68IpOGsKXXLgilonQ3jJECGiCxgjumtMx//VX+ilAA?= =?us-ascii?Q?txjmgM1/ZrmG8eUe7q2TzEoZiZ5CAlCNEY60Yk09pW1msvzM0vSG7JHUV/tM?= =?us-ascii?Q?7uPQJvoTyAROUUzBoM8R4RFEk0lmUVjID7DPCnF9Ji9GOV/T85jFjcDnp52j?= =?us-ascii?Q?8WCMZ/cDhp3EN2nDgXiOn2/XGBmKI+THsGQTSgaAhTzxgo6zK9rr/U4Z/5Nr?= =?us-ascii?Q?RqVvRSrpaYOTKiQHbTVIYORpPt7bheCZGcW99gBLtp4ygq5yII4D/9fQg/Hk?= =?us-ascii?Q?LfcbeUZMr6v512cfNsHtatS7JmVdItdInyPDYugPq0E9OeRiqB8rebYTu+rI?= =?us-ascii?Q?6GQYjfSSn5+TSvawfF0KJ3RIKudjJMl88PWafzFPj8a+mAthigbCbH+51m0P?= =?us-ascii?Q?lGxIuC2+xexuJj3dmNLHxX5e8hDb7WMgK1ru2MROjXbQummSZorkYNxmqzOb?= =?us-ascii?Q?8P+wYKiJYJLH9qOqQR5Qub7iECbg4aVuJCam8adOIKKlFl1dVzdxso5aXC7V?= =?us-ascii?Q?UJyVzK04cFQpJu+etnc7DGtQtud6siy9KCmy3WXTy0fg+j5teqhULcGlMZFd?= =?us-ascii?Q?b7km2q0YPIi2img2SQR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zi22Au21AoBkc6sbY/RTlV7RU95bmSAI9ymXaaFhJan+rxyhLAYgNSYkB8Qn3jaoz+YZNqBRCRWf3rPAJKnPAKqQiEerB45NeoqoB1cvzw==; 5:gAadVumiEAJOEAndG14kstdSbXrvBrjHnICmTS4+GSVggFaQP6xOuo/Jwyf8dm9mXQPCkbVVKaEnY1DkcOanMAsXeGtdiO2CNtMcJSEUsCwAvk2Dbp/cBWqsIdjbCHTPOMgxz9j0Onh9w0/iU+QqDP4ZzEn4hNSG3tzpwdNjWwA=; 24:yRCt1zuzD5y7xN4/Y01fm4gxp8o8ghvmN73cuMoP3ehj/AAWA7ZVNW0oNz+lfmhdE3Z9b+IDo3iLwVqG+OQhw+2xr2SZH6Sf1GPW03uahUA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4184; 7:nnCWvz6BmrDZgbvA7ps6yggquuOkwUfjuXfbuHZ3snYMZ/ylOZCyux5sIrVUbWn6YEjffd3byjti6Xa3yrSmDva4oL1Xlo0zypzVmr861ursiRMIi9+4iVtEa7Mn/2nSzHcYDN4h4cO9g7I8KWY62XVQg2rE/gqSXSY3bJg8OLtUL+08EumrrkYI518wLcje5i/fnP6mXhrxueQuB5PEaeYQWC2qE200x2EMd4ytmil7JfHJzCb6hBkC8NezPKGe X-MS-Office365-Filtering-Correlation-Id: 056c004e-7a6e-4240-3bde-08d5cc9226fc X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2018 16:17:23.1987 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 056c004e-7a6e-4240-3bde-08d5cc9226fc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB4184 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: mlxsw driver development <linux-mlxsw.lists.ozlabs.org> List-Unsubscribe: <https://lists.ozlabs.org/options/linux-mlxsw>, <mailto:linux-mlxsw-request@lists.ozlabs.org?subject=unsubscribe> List-Archive: <http://lists.ozlabs.org/pipermail/linux-mlxsw/> List-Post: <mailto:linux-mlxsw@lists.ozlabs.org> List-Help: <mailto:linux-mlxsw-request@lists.ozlabs.org?subject=help> List-Subscribe: <https://lists.ozlabs.org/listinfo/linux-mlxsw>, <mailto:linux-mlxsw-request@lists.ozlabs.org?subject=subscribe> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index e97652c..eea5666 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -1018,8 +1018,10 @@ mlxsw_sp_port_vlan_bridge_join(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan, int err; /* No need to continue if only VLAN flags were changed */ - if (mlxsw_sp_port_vlan->bridge_port) + if (mlxsw_sp_port_vlan->bridge_port) { + mlxsw_sp_port_vlan_put(mlxsw_sp_port_vlan); return 0; + } err = mlxsw_sp_port_vlan_fid_join(mlxsw_sp_port_vlan, bridge_port); if (err)
Switchdev notifications for addition of SWITCHDEV_OBJ_ID_PORT_VLAN are distributed not only on clean addition, but also when flags on an existing VLAN are changed. mlxsw_sp_bridge_port_vlan_add() calls mlxsw_sp_port_vlan_get() to get at the port_vlan in question, which implicitly references the object. This then leads to discrepancies in reference counting when the VLAN is removed. spectrum.c warns about the problem when the module is removed: [13578.493090] WARNING: CPU: 0 PID: 2454 at drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2973 mlxsw_sp_port_remove+0xfd/0x110 [mlxsw_spectrum] [...] [13578.627106] Call Trace: [13578.629617] mlxsw_sp_fini+0x2a/0xe0 [mlxsw_spectrum] [13578.634748] mlxsw_core_bus_device_unregister+0x3e/0x130 [mlxsw_core] [13578.641290] mlxsw_pci_remove+0x13/0x40 [mlxsw_pci] [13578.646238] pci_device_remove+0x31/0xb0 [13578.650244] device_release_driver_internal+0x14f/0x220 [13578.655562] driver_detach+0x32/0x70 [13578.659183] bus_remove_driver+0x47/0xa0 [13578.663134] pci_unregister_driver+0x1e/0x80 [13578.667486] mlxsw_sp_module_exit+0xc/0x3fa [mlxsw_spectrum] [13578.673207] __x64_sys_delete_module+0x13b/0x1e0 [13578.677888] ? exit_to_usermode_loop+0x78/0x80 [13578.682374] do_syscall_64+0x39/0xe0 [13578.685976] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Fix by putting the port_vlan when mlxsw_sp_port_vlan_bridge_join() determines it's a flag-only change. Fixes: c57529e1d5d8 ("mlxsw: spectrum: Replace vPorts with Port-VLAN") Signed-off-by: Petr Machata <petrm@mellanox.com> --- Notes: Changes from v1 to v2: - Instead of replacing the problematic get() with find_by_pvid() and create(), put() the port_vlan in mlxsw_sp_port_vlan_bridge_join(). Besides being simpler, this approach is also correct. The error path was broken in v1, as reference would only be acquired sometimes, but after an error it would always be dropped. drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)