All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: flyingpenghao@gmail.com
Cc: gg@ziepe.ca, nathan@kernel.org, linux-rdma@vger.kernel.org,
	Peng Hao <flyingpeng@tencent.com>
Subject: Re: [PATCH v3]  infiniband/hw/ocrdma: make function ocrdma_add_stat as noinline_for_stack
Date: Thu, 11 Jul 2024 13:26:08 +0300	[thread overview]
Message-ID: <20240711102608.GR6668@unreal> (raw)
In-Reply-To: <20240711085647.81004-1-flyingpeng@tencent.com>

On Thu, Jul 11, 2024 at 04:56:47PM +0800, flyingpenghao@gmail.com wrote:
> From: Peng Hao <flyingpeng@tencent.com>
> 
> clang report:
> drivers/infiniband/hw/ocrdma/ocrdma_stats.c:686:16: error: stack frame size (20664) exceeds limit (2048) in 'ocrdma_dbgfs_ops_read' [-Werror,-Wframe-larger-than]
> static ssize_t ocrdma_dbgfs_ops_read(struct file *filp, char __user *buffer,
>                ^
> 
> A 128-byte array is defined in ocrdma_add_stat and is called multiple times
> by multiple functions (up to dozens of times), which results in a large amount
> of stack space being accumulated in ocrdma_dbgfs_ops_read. mark it as noinline_for_stack
> to prevent it from spreading to ocrdma_dbgfs_ops_read's stack size.
> 
> Signed-off-by: Peng Hao <flyingpeng@tencent.com>
> ---
>  drivers/infiniband/hw/ocrdma/ocrdma_stats.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

I merged this patch with https://lore.kernel.org/r/20240710091657.26291-1-flyingpeng@tencent.com

Thanks

> 
> diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
> index 5f831e3bdbad..0b26c4e6de53 100644
> --- a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
> +++ b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
> @@ -46,7 +46,7 @@
>  
>  static struct dentry *ocrdma_dbgfs_dir;
>  
> -static int ocrdma_add_stat(char *start, char *pcur,
> +static noinline_for_stack int ocrdma_add_stat(char *start, char *pcur,
>  				char *name, u64 count)
>  {
>  	char buff[128] = {0};
> -- 
> 2.27.0
> 
> 

      reply	other threads:[~2024-07-11 10:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-11  8:56 [PATCH v3] infiniband/hw/ocrdma: make function ocrdma_add_stat as noinline_for_stack flyingpenghao
2024-07-11 10:26 ` Leon Romanovsky [this message]

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=20240711102608.GR6668@unreal \
    --to=leon@kernel.org \
    --cc=flyingpeng@tencent.com \
    --cc=flyingpenghao@gmail.com \
    --cc=gg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=nathan@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 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.