* [PATCH] dmaengine: dw-edma: fix unnecessary stack usage
@ 2019-06-17 13:16 Arnd Bergmann
2019-06-21 8:21 ` Gustavo Pimentel
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2019-06-17 13:16 UTC (permalink / raw)
To: Gustavo Pimentel, Vinod Koul
Cc: Arnd Bergmann, Dan Williams, Andy Shevchenko, Russell King,
Joao Pinto, dmaengine, linux-kernel
Putting large constant data on the stack causes unnecessary overhead
and stack usage:
drivers/dma/dw-edma/dw-edma-v0-debugfs.c:285:6: error: stack frame size of 1376 bytes in function 'dw_edma_v0_debugfs_on' [-Werror,-Wframe-larger-than=]
Mark the variable 'static const' in order for the compiler to move it
into the .rodata section where it does no such harm.
Fixes: 305aebeff879 ("dmaengine: Add Synopsys eDMA IP version 0 debugfs support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c
index affa1ccaf7a0..42739508c0d8 100644
--- a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c
+++ b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c
@@ -48,7 +48,7 @@ static struct {
} lim[2][EDMA_V0_MAX_NR_CH];
struct debugfs_entries {
- char name[24];
+ const char *name;
dma_addr_t *reg;
};
--
2.20.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] dmaengine: dw-edma: fix unnecessary stack usage
2019-06-17 13:16 [PATCH] dmaengine: dw-edma: fix unnecessary stack usage Arnd Bergmann
@ 2019-06-21 8:21 ` Gustavo Pimentel
2019-06-21 9:05 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo Pimentel @ 2019-06-21 8:21 UTC (permalink / raw)
To: Arnd Bergmann, Gustavo Pimentel, Vinod Koul
Cc: Dan Williams, Andy Shevchenko, Russell King, Joao Pinto,
dmaengine, linux-kernel
Hi,
On Mon, Jun 17, 2019 at 14:16:45, Arnd Bergmann <arnd@arndb.de> wrote:
> Putting large constant data on the stack causes unnecessary overhead
> and stack usage:
>
> drivers/dma/dw-edma/dw-edma-v0-debugfs.c:285:6: error: stack frame size of 1376 bytes in function 'dw_edma_v0_debugfs_on' [-Werror,-Wframe-larger-than=]
I had that warning at the beginning of the development, that's why I
divided the debugfs entries into several subfunctions. Perhaps my
configuration has configured a bigger stack frame size than your
configuration.
>
> Mark the variable 'static const' in order for the compiler to move it
> into the .rodata section where it does no such harm.
Ok, sounds good.
Thanks.
>
> Fixes: 305aebeff879 ("dmaengine: Add Synopsys eDMA IP version 0 debugfs support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c
> index affa1ccaf7a0..42739508c0d8 100644
> --- a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c
> +++ b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c
> @@ -48,7 +48,7 @@ static struct {
> } lim[2][EDMA_V0_MAX_NR_CH];
>
> struct debugfs_entries {
> - char name[24];
> + const char *name;
> dma_addr_t *reg;
> };
>
> --
> 2.20.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dmaengine: dw-edma: fix unnecessary stack usage
2019-06-21 8:21 ` Gustavo Pimentel
@ 2019-06-21 9:05 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2019-06-21 9:05 UTC (permalink / raw)
To: Gustavo Pimentel
Cc: Vinod Koul, Dan Williams, Andy Shevchenko, Russell King,
Joao Pinto, dmaengine, linux-kernel
On Fri, Jun 21, 2019 at 10:21 AM Gustavo Pimentel
<Gustavo.Pimentel@synopsys.com> wrote:
> On Mon, Jun 17, 2019 at 14:16:45, Arnd Bergmann <arnd@arndb.de> wrote:
>
> > Putting large constant data on the stack causes unnecessary overhead
> > and stack usage:
> >
> > drivers/dma/dw-edma/dw-edma-v0-debugfs.c:285:6: error: stack frame size of 1376 bytes in function 'dw_edma_v0_debugfs_on' [-Werror,-Wframe-larger-than=]
>
> I had that warning at the beginning of the development, that's why I
> divided the debugfs entries into several subfunctions. Perhaps my
> configuration has configured a bigger stack frame size than your
> configuration.
I suspect the problem is CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE,
which is a farily new configuration option that has the unintended side-effect
of sometimes preventing the compiler combining local variables from functions
inlined into the caller. Adding 'noinline_for_stack' to the sub-functions would
have also prevented this, but I think just not having the strings on the
stack is better anyway.
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-21 9:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-17 13:16 [PATCH] dmaengine: dw-edma: fix unnecessary stack usage Arnd Bergmann
2019-06-21 8:21 ` Gustavo Pimentel
2019-06-21 9:05 ` Arnd Bergmann
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).