Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2328413pxb; Sat, 25 Sep 2021 04:25:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyyZ6TKwpSb/rf8v/BGq4gddEdP37nGK1wsJYuz0+vIhJvw4pbN/mSeeQnE5f+kPfXqiHa X-Received: by 2002:a50:e0c9:: with SMTP id j9mr10695363edl.336.1632569157576; Sat, 25 Sep 2021 04:25:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632569157; cv=none; d=google.com; s=arc-20160816; b=tv08el5R+B6oxZg3HJI+77H0K9/tORsn6vxDGypnhn4v0f/Ch+H6bFYT08TAJt17AN rd0mVRfZMUT6i8O6jlwXxPltTl2VnRVXRKUZbWczFguSvLtATOP6JYpidDdIJq66NQwo i1qT8KfxEEctukb7Pjh22d+EBSlWLCw1kgJXU/CG6kr8JsmPIOLcZ1yMS1xyaMx9Lp5I 5WffG46LKE9Xn6XNyH9EFzojTOz/AAg/IS9UV90VSkAkr2al9S0rp5/fs4n/bO6Eqixk ioqv99hBUaJokc2KyLpjymGIc/tH+lwWVk/ASXCyLd9uwOWQeKy6vkZFWjN3NcgeBcg6 HuPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=j0SK/7y9+PGxqrJTzAN8cfXOa6GlJ3laFrJPNlr3J9o=; b=VJ0bePNcecvXWsMEkxV2udAx0VYvJkxqhuRiuP8fQiYtnqQJFFaMhHERC7dLcEndZB 9KlrrrESz1YZk2TMR7+Ur0F65D8zFxBddSfUuZhXiZpQt8k2cqLoKdstwWIDt4cOGfQJ BDw9xHoLtarj9VOAiJB+vTz6wrgUp1uACFE+89tbfHa8Qo1ymuCAM/jIjHsyIN33UMxg y7FA1nnVuJa11oPNtwvZY2/rIA0yTKGJr8wThgefSA78AXT+Z04h6HYv2eoaNlAZWZVH yCBTs23sqwaIiOMl7ZiEyFX3dSH065F9soebrnompJeWCTK5s1G6s/TKKZofIr77oqF3 kjmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="hpCTP/If"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y13si13242137edm.398.2021.09.25.04.25.18; Sat, 25 Sep 2021 04:25:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="hpCTP/If"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244531AbhIYLYm (ORCPT + 99 others); Sat, 25 Sep 2021 07:24:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:55240 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236171AbhIYLYl (ORCPT ); Sat, 25 Sep 2021 07:24:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 10A496103B; Sat, 25 Sep 2021 11:23:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632568986; bh=9vQ7Jy6vxv+17KL8sYGHu0D+tMeIG2i6YIeiCDwml2M=; h=From:To:Cc:Subject:Date:From; b=hpCTP/IfVfGHBzOHP5/ERVih7Np+6S1CF2jaWxQBoSaPpWxvmWDrfmi7KtqGbIaVj 4OMP9F328p7IEKsQzcAUW5dQQZYTXDjoQuwu64EE7m2nYqbjppu/uR38XLj8XZIz7k tRfvIx0CnP2L6dSIHqOzY5bRfwrLvqQDlcJnq1VfFHVYWyTvhdVEHmtM8lyZU08CB5 pGGeo0dbRn2QmrPwLTpyFDlqv0X0xbge20cSdYgMMwH28HeTweZHf7K4m97G8m+PMS HvoMMFLiqX8Bo6SQ1BDgqdXOzuUK17iTJZMKO1OupxzLl6OnuXkShCsq0tTaFU/EGp tBeh0G+D96Qhw== From: Leon Romanovsky To: "David S . Miller" , Jakub Kicinski Cc: Leon Romanovsky , Alexandre Belloni , Andrew Lunn , Ariel Elior , Bin Luo , Claudiu Manoil , Coiby Xu , Derek Chickles , drivers@pensando.io, Felix Manlunas , Florian Fainelli , Geetha sowjanya , Greg Kroah-Hartman , GR-everest-linux-l2@marvell.com, GR-Linux-NIC-Dev@marvell.com, hariprasad , Ido Schimmel , Intel Corporation , intel-wired-lan@lists.osuosl.org, Ioana Ciornei , Jerin Jacob , Jesse Brandeburg , Jiri Pirko , Jonathan Lemon , Linu Cherian , linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-rdma@vger.kernel.org, linux-staging@lists.linux.dev, Loic Poulain , Manish Chopra , M Chetan Kumar , Michael Chan , Michael Guralnik , netdev@vger.kernel.org, oss-drivers@corigine.com, Richard Cochran , Saeed Mahameed , Satanand Burla , Sergey Ryazanov , Shannon Nelson , Simon Horman , Subbaraya Sundeep , Sunil Goutham , Taras Chornyi , Tariq Toukan , Tony Nguyen , UNGLinuxDriver@microchip.com, Vadym Kochan , Vivien Didelot , Vladimir Oltean Subject: [PATCH net-next v1 00/21] Move devlink_register to be last devlink command Date: Sat, 25 Sep 2021 14:22:40 +0300 Message-Id: X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leon Romanovsky This is second version of patch series https://lore.kernel.org/netdev/cover.1628599239.git.leonro@nvidia.com/ The main change is addition of delayed notification logic that will allowed us to delete devlink_params_publish API (future series will remove it completely) and conversion of all drivers to have devlink_register being last commend. The series itself is pretty straightforward, except liquidio driver which performs initializations in various workqueues without proper locks. That driver doesn't hole device_lock and it is clearly broken for any parallel driver core flows (modprobe + devlink + PCI reset will 100% crash it). In order to annotate devlink_register() will lockdep of holding device_lock, I added workaround in this driver. Thanks ---------------------- From previous cover letter: Hi Dave and Jakub, This series prepares code to remove devlink_reload_enable/_disable API and in order to do, we move all devlink_register() calls to be right before devlink_reload_enable(). The best place for such a call should be right before exiting from the probe(). This is done because devlink_register() opens devlink netlink to the users and gives them a venue to issue commands before initialization is finished. 1. Some drivers were aware of such "functionality" and tried to protect themselves with extra locks, state machines and devlink_reload_enable(). Let's assume that it worked for them, but I'm personally skeptical about it. 2. Some drivers copied that pattern, but without locks and state machines. That protected them from reload flows, but not from any _set_ routines. 3. And all other drivers simply didn't understand the implications of early devlink_register() and can be seen as "broken". Thanks Leon Romanovsky (21): devlink: Notify users when objects are accessible bnxt_en: Register devlink instance at the end devlink configuration liquidio: Overcome missing device lock protection in init/remove flows dpaa2-eth: Register devlink instance at the end of probe net: hinic: Open device for the user access when it is ready ice: Open devlink when device is ready octeontx2: Move devlink registration to be last devlink command net/prestera: Split devlink and traps registrations to separate routines net/mlx4: Move devlink_register to be the last initialization command net/mlx5: Accept devlink user input after driver initialization complete mlxsw: core: Register devlink instance last net: mscc: ocelot: delay devlink registration to the end nfp: Move delink_register to be last command ionic: Move devlink registration to be last devlink command qed: Move devlink registration to be last devlink command net: ethernet: ti: Move devlink registration to be last devlink command netdevsim: Move devlink registration to be last devlink command net: wwan: iosm: Move devlink_register to be last devlink command ptp: ocp: Move devlink registration to be last devlink command staging: qlge: Move devlink registration to be last devlink command net: dsa: Move devlink registration to be last devlink command .../net/ethernet/broadcom/bnxt/bnxt_devlink.c | 15 +-- .../net/ethernet/cavium/liquidio/lio_main.c | 19 ++-- .../freescale/dpaa2/dpaa2-eth-devlink.c | 14 ++- .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 9 +- .../net/ethernet/freescale/dpaa2/dpaa2-eth.h | 5 +- .../net/ethernet/huawei/hinic/hinic_hw_dev.c | 7 +- drivers/net/ethernet/intel/ice/ice_main.c | 6 +- .../marvell/octeontx2/af/rvu_devlink.c | 10 +- .../marvell/octeontx2/nic/otx2_devlink.c | 15 +-- .../marvell/prestera/prestera_devlink.c | 29 +---- .../marvell/prestera/prestera_devlink.h | 4 +- .../ethernet/marvell/prestera/prestera_main.c | 8 +- drivers/net/ethernet/mellanox/mlx4/main.c | 8 +- .../net/ethernet/mellanox/mlx5/core/devlink.c | 9 +- .../net/ethernet/mellanox/mlx5/core/main.c | 2 + .../mellanox/mlx5/core/sf/dev/driver.c | 2 + drivers/net/ethernet/mellanox/mlxsw/core.c | 19 +--- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 5 +- .../ethernet/netronome/nfp/devlink_param.c | 9 +- .../net/ethernet/netronome/nfp/nfp_net_main.c | 5 +- .../ethernet/pensando/ionic/ionic_devlink.c | 4 +- drivers/net/ethernet/qlogic/qed/qed_devlink.c | 7 +- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 15 +-- drivers/net/ethernet/ti/cpsw_new.c | 7 +- drivers/net/netdevsim/dev.c | 8 +- drivers/net/wwan/iosm/iosm_ipc_devlink.c | 7 +- drivers/ptp/ptp_ocp.c | 6 +- drivers/staging/qlge/qlge_main.c | 8 +- net/core/devlink.c | 107 +++++++++++++++--- net/dsa/dsa2.c | 10 +- 30 files changed, 202 insertions(+), 177 deletions(-) -- 2.31.1