* [PATCH] mlx5: avoid frame overflow warning
@ 2026-06-12 20:15 Arnd Bergmann
2026-06-13 5:14 ` Zhu Yanjun
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2026-06-12 20:15 UTC (permalink / raw)
To: Leon Romanovsky, Jason Gunthorpe; +Cc: Arnd Bergmann, linux-rdma, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
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>
---
Dynamically allocating ib_reg_wr would be another option, actually
reducing the stack usage but adding a little bit of complexity
from error handling.
---
drivers/infiniband/hw/mlx5/wr.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/wr.c b/drivers/infiniband/hw/mlx5/wr.c
index 9947feb7fb8a..fca9e1d9d5e9 100644
--- a/drivers/infiniband/hw/mlx5/wr.c
+++ b/drivers/infiniband/hw/mlx5/wr.c
@@ -840,13 +840,15 @@ static int handle_psv(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
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;
--
2.39.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] mlx5: avoid frame overflow warning
2026-06-12 20:15 [PATCH] mlx5: avoid frame overflow warning Arnd Bergmann
@ 2026-06-13 5:14 ` Zhu Yanjun
0 siblings, 0 replies; 2+ messages in thread
From: Zhu Yanjun @ 2026-06-13 5:14 UTC (permalink / raw)
To: Arnd Bergmann, Leon Romanovsky, Jason Gunthorpe,
yanjun.zhu@linux.dev
Cc: Arnd Bergmann, linux-rdma, linux-kernel
在 2026/6/12 13:15, Arnd Bergmann 写道:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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.
IMO, it is just a workaround to this problem. To fix this problem, the
function set_reg_wr should be rewritten.
Zhu Yanjun
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> Dynamically allocating ib_reg_wr would be another option, actually
> reducing the stack usage but adding a little bit of complexity
> from error handling.
> ---
> drivers/infiniband/hw/mlx5/wr.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mlx5/wr.c b/drivers/infiniband/hw/mlx5/wr.c
> index 9947feb7fb8a..fca9e1d9d5e9 100644
> --- a/drivers/infiniband/hw/mlx5/wr.c
> +++ b/drivers/infiniband/hw/mlx5/wr.c
> @@ -840,13 +840,15 @@ static int handle_psv(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
> 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;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-13 5:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-12 20:15 [PATCH] mlx5: avoid frame overflow warning Arnd Bergmann
2026-06-13 5:14 ` Zhu Yanjun
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.