[PATCH rdma-next 0/9] RDMA/mlx5: Don't lose port configuration events during probe
From: Edward Srouji
Date: Sun Nov 22 2026 - 12:39:51 EST
mlx5_ib registers its event notifier after ib_register_device() and
dispatches no event until the device is active, so a port
configuration change that races with probe is lost: ib_core and the
clients keep what they read. A lost P_Key change leaves ib_sa on a
stale P_Key index and IPoIB without a carrier for good, as OpenSM
writes a P_Key block only when it differs from the one on the port.
This is hit on hypervisor setups, where the SM can program a VF's
partitions while it probes.
Patches 1-3 fix the event handling the rest builds on: the port
number taken from the EQE is validated before use, a slave port no
longer marks its master active, and the work of the system error and
slave port notifiers is flushed once they are unregistered. Patches 4-5
add ib_dispatch_event_sync(), which processes an event before it
returns, and patches 6-7 prepare mlx5_ib. Patch 8 records the
configuration changes of InfiniBand ports while the device is inactive
and replays them with ib_dispatch_event_sync() once it is active, which
lets patch 9 register the notifier before ib_register_device() and
flush its work before teardown.
Patch 1 overlaps with "RDMA/mlx5: Validate EQE port and GSI port before
indexing devr.ports[]" from Yishai's adversarial mode series [1].
Whichever lands first, the other can be trivially rebased.
I'll drop my patch if that series is applied first.
[1] lore.kernel.org/r/20261117170914.27410-1-yishaih@xxxxxxxxxx
Signed-off-by: Edward Srouji <edwards@xxxxxxxxxx>
---
Edward Srouji (9):
RDMA/mlx5: Validate port number in handle_port_change()
RDMA/mlx5: Don't let a slave port mark its master active
RDMA/mlx5: Flush system error and slave port event work
RDMA/core: Derive enforce_security from the cache event
RDMA/core: Add ib_dispatch_event_sync()
RDMA/mlx5: Pass the port and subtype to handle_port_change()
RDMA/mlx5: Activate the device in a stage of its own
RDMA/mlx5: Replay port configuration events after probe
RDMA/mlx5: Register event notifier before IB registration
drivers/infiniband/core/cache.c | 67 +++++++---
drivers/infiniband/hw/mlx5/main.c | 246 +++++++++++++++++++++++++++++------
drivers/infiniband/hw/mlx5/mlx5_ib.h | 17 ++-
include/rdma/ib_verbs.h | 1 +
4 files changed, 274 insertions(+), 57 deletions(-)
---
base-commit: 7404c82cbf1246e0e84e2ec21834d23c26f9a8ed
change-id: 20261122-mlx5-port-events-probe-710a67521354
Best regards,
--
Edward Srouji <edwards@xxxxxxxxxx>