The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH rdma-rc 0/3] RDMA: Prevent RCU callbacks from outliving modules
@ 2026-07-09  9:06 Leon Romanovsky
  2026-07-09  9:06 ` [PATCH rdma-rc 1/3] RDMA/core: Wait for RCU callbacks before unloading ib_core Leon Romanovsky
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Leon Romanovsky @ 2026-07-09  9:06 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky
  Cc: linux-rdma, linux-kernel, Sebastian Andrzej Siewior

ib_core, mlx5_ib, and ib_ipoib use call_rcu() with callbacks implemented by
their modules. Stopping callback producers does not drain callbacks already
queued. If module unload completes first, RCU can later invoke code that has
been unloaded. synchronize_rcu() and SRCU waits do not wait for queued
callbacks.

IPoIB reclamation completions are signaled from inside the callbacks, so
they can wake teardown before a callback returns. Initialization unwind
also needs protection because registration can attach existing devices and
undo their setup on failure.

Wait for queued callbacks after all producers have stopped.

Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Closes: https://lore.kernel.org/linux-rdma/20260708092316.Qb39F_B0@linutronix.de/
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
Leon Romanovsky (3):
      RDMA/core: Wait for RCU callbacks before unloading ib_core
      RDMA/mlx5: Drain RCU callbacks during module teardown
      RDMA/ipoib: Drain RCU callbacks during module teardown

 drivers/infiniband/core/device.c          | 1 +
 drivers/infiniband/hw/mlx5/main.c         | 2 ++
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 2 ++
 3 files changed, 5 insertions(+)
---
base-commit: 5f9576c6734abca88a02db72c466e09d2eddf160
change-id: 20260709-unload-rcu-67c6de79b589

Best regards,
--  
Leon Romanovsky <leonro@nvidia.com>


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

end of thread, other threads:[~2026-07-09 11:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-09  9:06 [PATCH rdma-rc 0/3] RDMA: Prevent RCU callbacks from outliving modules Leon Romanovsky
2026-07-09  9:06 ` [PATCH rdma-rc 1/3] RDMA/core: Wait for RCU callbacks before unloading ib_core Leon Romanovsky
2026-07-09  9:06 ` [PATCH rdma-rc 2/3] RDMA/mlx5: Drain RCU callbacks during module teardown Leon Romanovsky
2026-07-09  9:06 ` [PATCH rdma-rc 3/3] RDMA/ipoib: " Leon Romanovsky
2026-07-09  9:59 ` [PATCH rdma-rc 0/3] RDMA: Prevent RCU callbacks from outliving modules Sebastian Andrzej Siewior
2026-07-09 11:05   ` Leon Romanovsky
2026-07-09 11:59     ` Sebastian Andrzej Siewior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox