]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMa/mlx5: Avoid frame overflow warning
authorArnd Bergmann <arnd@arndb.de>
Fri, 12 Jun 2026 20:15:59 +0000 (22:15 +0200)
committerLeon Romanovsky <leon@kernel.org>
Wed, 1 Jul 2026 12:33:13 +0000 (08:33 -0400)
Building mlx5 on s390 shows a rather high stack usage that can exceed
the warning limit when that is set to a lower but still reasonable value:

drivers/infiniband/hw/mlx5/wr.c:1051:5: error: stack frame size (1328) exceeds limit (1280) in 'mlx5_ib_post_send' [-Werror,-Wframe-larger-than]

The problem here is 'struct ib_reg_wr' on the stack of
handle_reg_mr_integrity(), which gets inlined into mlx5_ib_post_send()
along with a number of smaller functions.

Keeping the inner function out of line like gcc does avoids the
warning and reduces the total stack usage in other functions called
from mlx5_ib_post_send(), though handle_reg_mr_integrity() itself
still has the same problem as before.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20260612201611.4127750-1-arnd@kernel.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/mlx5/wr.c

index 9947feb7fb8a0bcd1ecf9e5d136e9ea7e326e8e7..fca9e1d9d5e9bda8d2463630c8f1d6f2112e0c9c 100644 (file)
@@ -840,13 +840,15 @@ out:
        return err;
 }
 
-static int handle_reg_mr_integrity(struct mlx5_ib_dev *dev,
-                                  struct mlx5_ib_qp *qp,
-                                  const struct ib_send_wr *wr,
-                                  struct mlx5_wqe_ctrl_seg **ctrl, void **seg,
-                                  int *size, void **cur_edge,
-                                  unsigned int *idx, int nreq, u8 fence,
-                                  u8 next_fence)
+static noinline_for_stack int handle_reg_mr_integrity(struct mlx5_ib_dev *dev,
+                                                     struct mlx5_ib_qp *qp,
+                                                     const struct ib_send_wr *wr,
+                                                     struct mlx5_wqe_ctrl_seg **ctrl,
+                                                     void **seg,
+                                                     int *size, void **cur_edge,
+                                                     unsigned int *idx, int nreq,
+                                                     u8 fence,
+                                                     u8 next_fence)
 {
        struct mlx5_ib_mr *mr;
        struct mlx5_ib_mr *pi_mr;