net/mlx5e: Batch RCU grace periods on channel open and close
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest2 patches 0 repliesNew
- v22 patches 1 replySuperseded
- v12 patches 2 repliesSuperseded
Changes in v3 from the cover letter
- Wait for one more grace period after napi_disable() in deactivate, so close can destroy the queues before its single synchronize_net(). This fixes the page pool and PTP SQ recovery issues from V2, and makes the close path simpler and cleaner, with no separate page pool unlink step.
- Drop the synchronize_net() in mlx5e_close_xdpsq() instead of splitting it, as its callers already wait for a grace period or run before NAPI is enabled.
- Test and clear the XSK state bit once on close, instead of using xsk_pool to decide on XSK teardown.
- Add a sync_needed parameter to mlx5e_qos_close_queues() instead of a separate variant without the wait.
- Keep the original mlx5e_xdp_tx_disable() name instead of renaming it to _pre_sync, and only drop its synchronize_net().
- Build the single object paths from pre_sync, synchronize_net() and post_sync, and keep mlx5e_close_locked() calling the existing wrappers.
- Remove the priv level deactivate wrappers.
- Order the new functions as pre_sync, post_sync, then the wrapper.
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | net/mlx5e: Batch NAPI RCU grace periods on channel closedrivers/ drivers/ drivers/ +6 more | +185 | 0 replies | |
| 2/2 | net/mlx5e: Batch ICOSQ trigger RCU synchronizationdrivers/ | +22 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.
Cover letter [PATCH net-next V3 0/2] net/mlx5e: Batch RCU grace periods on channel open and close
Hi,
This series by Carolina reduces the time mlx5e spends waiting for RCU grace periods when bringing an interface up or down with many channels.
Today the channel open and close flows call synchronize_net() per object. On close, RQ, ICOSQ, TX SQ and NAPI teardown each require a grace period, so the number of waits scales with the number of channels. TX SQ teardown adds a wait per traffic class, and XDP and QoS can add more. On activation, mlx5e_activate_channels() triggers the ICOSQ of every channel, and each trigger waits for its own grace period. With a large channel count this makes link down and link up slow.
Patch 1 batches the waits on channel close. Channel deactivate and close are split into pre_sync and post_sync phases: the ENABLED state is first cleared on all queues of all channels, a single grace period is awaited, and only then does the teardown continue. Once NAPI is disabled on all channels, one more grace period is awaited, as the poll may still arm the CQs after napi_complete_done(). The queues are then closed and the NAPI instances are unlinked with __netif_napi_del_locked(), followed by one synchronize_net() before the channels are freed. The existing per object synchronize_net() calls are kept for single queue paths. The change touches the regular channels as well as the PTP, QoS, XDP and XSK queues.
Patch 2 does the same for the ICOSQ trigger on activation: all channel ICOSQs are first marked as requiring locking, one grace period is awaited, and then all of them are triggered. mlx5e_trigger_napi_icosq() keeps its existing semantics for standalone callers.
Results with 248 channels and rcu_normal=1:
- ip link set eth2 down: 11.837s before, 0.817s after.
- ip link set eth2 up: 4.087s before, 1.080s after.
Regards,
Tariq
V3:
- Wait for one more grace period after napi_disable() in deactivate, so close can destroy the queues before its single synchronize_net(). This fixes the page pool and PTP SQ recovery issues from V2, and makes the close path simpler and cleaner, with no separate page pool unlink step.
- Drop the synchronize_net() in mlx5e_close_xdpsq() instead of splitting it, as its callers already wait for a grace period or run before NAPI is enabled.
- Test and clear the XSK state bit once on close, instead of using xsk_pool to decide on XSK teardown.
- Add a sync_needed parameter to mlx5e_qos_close_queues() instead of a separate variant without the wait.
- Keep the original mlx5e_xdp_tx_disable() name instead of renaming it to _pre_sync, and only drop its synchronize_net().
- Build the single object paths from pre_sync, synchronize_net() and post_sync, and keep mlx5e_close_locked() calling the existing wrappers.
- Remove the priv level deactivate wrappers.
- Order the new functions as pre_sync, post_sync, then the wrapper.
V2:
https://lore.kernel.org/all/[email protected]/
V1:
https://lore.kernel.org/all/[email protected]/
Carolina Jubran (2):
net/mlx5e: Batch NAPI RCU grace periods on channel close net/mlx5e: Batch ICOSQ trigger RCU synchronization
drivers/net/ethernet/mellanox/mlx5/core/en.h | 4 + .../net/ethernet/mellanox/mlx5/core/en/ptp.c | 27 ++- .../net/ethernet/mellanox/mlx5/core/en/ptp.h | 4 +- .../net/ethernet/mellanox/mlx5/core/en/qos.c | 42 ++++- .../net/ethernet/mellanox/mlx5/core/en/qos.h | 5 +- .../net/ethernet/mellanox/mlx5/core/en/xdp.h | 2 - .../mellanox/mlx5/core/en/xsk/setup.c | 22 ++- .../mellanox/mlx5/core/en/xsk/setup.h | 2 + .../net/ethernet/mellanox/mlx5/core/en_main.c | 154 ++++++++++++++---- 9 files changed, 207 insertions(+), 55 deletions(-)
base-commit: 7ccc5e05043b1bb84326b19a2b05938d8f7a2ae6
Signature · 1 line
2.44.0