netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "davem@davemloft.net" <davem@davemloft.net>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"leon@kernel.org" <leon@kernel.org>
Cc: "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Leon Romanovsky <leonro@mellanox.com>,
	Moshe Shemesh <moshe@mellanox.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net/mlx5: reduce stack usage in qp_read_field
Date: Tue, 28 Apr 2020 21:44:44 +0000	[thread overview]
Message-ID: <c75a430dcdf4ca2eec177cacb9d425279ce43d27.camel@mellanox.com> (raw)
In-Reply-To: <20200428212357.2708786-1-arnd@arndb.de>

On Tue, 2020-04-28 at 23:23 +0200, Arnd Bergmann wrote:
> Moving the mlx5_ifc_query_qp_out_bits structure on the stack was a
> bit
> excessive and now causes the compiler to complain on 32-bit
> architectures:
> 
> drivers/net/ethernet/mellanox/mlx5/core/debugfs.c: In function
> 'qp_read_field':
> drivers/net/ethernet/mellanox/mlx5/core/debugfs.c:274:1: error: the
> frame size of 1104 bytes is larger than 1024 bytes [-Werror=frame-
> larger-than=]
> 
> Revert the previous patch partially to use dynamically allocation as
> the code did before. Unfortunately there is no good error handling
> in case the allocation fails.
> 

I don't really mind this, since this is only for debugfs and 0 is not a
valid value anyway.

Acked-by: Saeed Mahameed <saeedm@mellanox.com> 

this should go to mlx5-next, i will let Leon decide and pick this up.

> Fixes: 57a6c5e992f5 ("net/mlx5: Replace hand written QP context
> struct with automatic getters")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/debugfs.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
> b/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
> index 6409090b3ec5..d2d57213511b 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
> @@ -202,18 +202,23 @@ void mlx5_cq_debugfs_cleanup(struct
> mlx5_core_dev *dev)
>  static u64 qp_read_field(struct mlx5_core_dev *dev, struct
> mlx5_core_qp *qp,
>  			 int index, int *is_str)
>  {
> -	u32 out[MLX5_ST_SZ_BYTES(query_qp_out)] = {};
> +	int outlen = MLX5_ST_SZ_BYTES(query_qp_out);
>  	u32 in[MLX5_ST_SZ_DW(query_qp_in)] = {};
>  	u64 param = 0;
> +	u32 *out;
>  	int state;
>  	u32 *qpc;
>  	int err;
>  
> +	out = kzalloc(outlen, GFP_KERNEL);
> +	if (!out)
> +		return 0;
> +
>  	MLX5_SET(query_qp_in, in, opcode, MLX5_CMD_OP_QUERY_QP);
>  	MLX5_SET(query_qp_in, in, qpn, qp->qpn);
>  	err = mlx5_cmd_exec_inout(dev, query_qp, in, out);
>  	if (err)
> -		return 0;
> +		goto out;
>  
>  	*is_str = 0;
>  
> @@ -269,7 +274,8 @@ static u64 qp_read_field(struct mlx5_core_dev
> *dev, struct mlx5_core_qp *qp,
>  		param = MLX5_GET(qpc, qpc, remote_qpn);
>  		break;
>  	}
> -
> +out:
> +	kfree(out);
>  	return param;
>  }
>  

  reply	other threads:[~2020-04-28 21:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28 21:23 [PATCH] net/mlx5: reduce stack usage in qp_read_field Arnd Bergmann
2020-04-28 21:44 ` Saeed Mahameed [this message]
2020-04-30  5:21 ` Leon Romanovsky
2020-04-30 14:37   ` Arnd Bergmann
2020-05-03  5:30     ` Leon Romanovsky
2020-05-04 15:41       ` Arnd Bergmann
2020-05-05  6:10         ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c75a430dcdf4ca2eec177cacb9d425279ce43d27.camel@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=leon@kernel.org \
    --cc=leonro@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=moshe@mellanox.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).