All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v1 00/21] Move devlink_register to be last devlink command
@ 2021-09-25 11:22 ` Leon Romanovsky
  0 siblings, 0 replies; 65+ messages in thread
From: Leon Romanovsky @ 2021-09-25 11:22 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: Leon Romanovsky, Alexandre Belloni, Andrew Lunn, Ariel Elior,
	Bin Luo, Claudiu Manoil, Coiby Xu, Derek Chickles, drivers,
	Felix Manlunas, Florian Fainelli, Geetha sowjanya,
	Greg Kroah-Hartman, GR-everest-linux-l2, GR-Linux-NIC-Dev,
	hariprasad, Ido Schimmel, Intel Corporation, intel-wired-lan,
	Ioana Ciornei, Jerin Jacob, Jesse Brandeburg, Jiri Pirko,
	Jonathan Lemon, Linu Cherian, linux-kernel, linux-omap,
	linux-rdma, linux-staging, Loic Poulain, Manish Chopra,
	M Chetan Kumar, Michael Chan, Michael Guralnik, netdev,
	oss-drivers, Richard Cochran, Saeed Mahameed, Satanand Burla,
	Sergey Ryazanov, Shannon Nelson, Simon Horman, Subbaraya Sundeep,
	Sunil Goutham, Taras Chornyi, Tariq Toukan, Tony Nguyen,
	UNGLinuxDriver, Vadym Kochan, Vivien Didelot, Vladimir Oltean

From: Leon Romanovsky <leonro@nvidia.com>

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


^ permalink raw reply	[flat|nested] 65+ messages in thread

end of thread, other threads:[~2021-09-29 13:07 UTC | newest]

Thread overview: 65+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-25 11:22 [PATCH net-next v1 00/21] Move devlink_register to be last devlink command Leon Romanovsky
2021-09-25 11:22 ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:22 ` [PATCH net-next v1 01/21] devlink: Notify users when objects are accessible Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-28  2:49   ` Eric Dumazet
2021-09-28  2:49     ` [Intel-wired-lan] " Eric Dumazet
2021-09-28  7:34     ` Leon Romanovsky
2021-09-28  7:34       ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:22 ` [PATCH net-next v1 02/21] bnxt_en: Register devlink instance at the end devlink configuration Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:22 ` [PATCH net-next v1 03/21] liquidio: Overcome missing device lock protection in init/remove flows Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:22 ` [PATCH net-next v1 04/21] dpaa2-eth: Register devlink instance at the end of probe Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:22 ` [PATCH net-next v1 05/21] net: hinic: Open device for the user access when it is ready Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:22 ` [PATCH net-next v1 06/21] ice: Open devlink when device " Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-27 19:47   ` Jesse Brandeburg
2021-09-27 19:47     ` [Intel-wired-lan] " Jesse Brandeburg
2021-09-25 11:22 ` [PATCH net-next v1 07/21] octeontx2: Move devlink registration to be last devlink command Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:22 ` [PATCH net-next v1 08/21] net/prestera: Split devlink and traps registrations to separate routines Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:22 ` [PATCH net-next v1 09/21] net/mlx4: Move devlink_register to be the last initialization command Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:22 ` [PATCH net-next v1 10/21] net/mlx5: Accept devlink user input after driver initialization complete Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:22 ` [PATCH net-next v1 11/21] mlxsw: core: Register devlink instance last Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-26 14:56   ` Ido Schimmel
2021-09-26 14:56     ` [Intel-wired-lan] " Ido Schimmel
2021-09-26 14:56     ` Ido Schimmel
2021-09-25 11:22 ` [PATCH net-next v1 12/21] net: mscc: ocelot: delay devlink registration to the end Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:22 ` [PATCH net-next v1 13/21] nfp: Move delink_register to be last command Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-27  8:39   ` Simon Horman
2021-09-27  8:39     ` [Intel-wired-lan] " Simon Horman
2021-09-27 11:53     ` Leon Romanovsky
2021-09-27 11:53       ` [Intel-wired-lan] " Leon Romanovsky
2021-09-27 12:20       ` Simon Horman
2021-09-27 12:20         ` [Intel-wired-lan] " Simon Horman
2021-09-25 11:22 ` [PATCH net-next v1 14/21] ionic: Move devlink registration to be last devlink command Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-27 16:07   ` Shannon Nelson
2021-09-27 16:07     ` [Intel-wired-lan] " Shannon Nelson
2021-09-25 11:22 ` [PATCH net-next v1 15/21] qed: " Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:22 ` [PATCH net-next v1 16/21] net: ethernet: ti: " Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:22 ` [PATCH net-next v1 17/21] netdevsim: " Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:22 ` [PATCH net-next v1 18/21] net: wwan: iosm: Move devlink_register " Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:22 ` [PATCH net-next v1 19/21] ptp: ocp: Move devlink registration " Leon Romanovsky
2021-09-25 11:22   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:23 ` [PATCH net-next v1 20/21] staging: qlge: " Leon Romanovsky
2021-09-25 11:23   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-25 11:23 ` [PATCH net-next v1 21/21] net: dsa: " Leon Romanovsky
2021-09-25 11:23   ` [Intel-wired-lan] " Leon Romanovsky
2021-09-29 13:02   ` Vladimir Oltean
2021-09-29 13:02     ` [Intel-wired-lan] " Vladimir Oltean
2021-09-29 13:07     ` Leon Romanovsky
2021-09-29 13:07       ` [Intel-wired-lan] " Leon Romanovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.