All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/xmon: Relax frame size for clang
@ 2018-10-31  1:09 Joel Stanley
  2018-11-01 12:46 ` Michael Ellerman
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Stanley @ 2018-10-31  1:09 UTC (permalink / raw)
  To: Michael Ellerman, Naveen N . Rao, linuxppc-dev; +Cc: Nick Desaulniers

When building with clang (8 trunk, 7.0 release) the frame size limit is
hit:

 arch/powerpc/xmon/xmon.c:452:12: warning: stack frame size of 2576
 bytes in function 'xmon_core' [-Wframe-larger-than=]

Some investigation by Naveen indicates this is due to clang saving the
addresses to printf format strings on the stack.

While this issue is investigated, bump up the frame size limit for xmon
when building with clang.

Link: https://github.com/ClangBuiltLinux/linux/issues/252
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 arch/powerpc/xmon/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile
index 69e7fb47bcaa..878f9c1d3615 100644
--- a/arch/powerpc/xmon/Makefile
+++ b/arch/powerpc/xmon/Makefile
@@ -11,6 +11,12 @@ UBSAN_SANITIZE := n
 ORIG_CFLAGS := $(KBUILD_CFLAGS)
 KBUILD_CFLAGS = $(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS))
 
+ifdef CONFIG_CC_IS_CLANG
+# clang stores addresses on the stack causing the frame size to blow
+# out. See https://github.com/ClangBuiltLinux/linux/issues/252
+KBUILD_CFLAGS += -Wframe-larger-than=4096
+endif
+
 ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC)
 
 obj-y			+= xmon.o nonstdio.o spr_access.o
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: powerpc/xmon: Relax frame size for clang
  2018-10-31  1:09 [PATCH] powerpc/xmon: Relax frame size for clang Joel Stanley
@ 2018-11-01 12:46 ` Michael Ellerman
  2018-11-02 10:26   ` David Laight
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Ellerman @ 2018-11-01 12:46 UTC (permalink / raw)
  To: Joel Stanley, Naveen N . Rao, linuxppc-dev; +Cc: Nick Desaulniers

On Wed, 2018-10-31 at 01:09:34 UTC, Joel Stanley wrote:
> When building with clang (8 trunk, 7.0 release) the frame size limit is
> hit:
> 
>  arch/powerpc/xmon/xmon.c:452:12: warning: stack frame size of 2576
>  bytes in function 'xmon_core' [-Wframe-larger-than=]
> 
> Some investigation by Naveen indicates this is due to clang saving the
> addresses to printf format strings on the stack.
> 
> While this issue is investigated, bump up the frame size limit for xmon
> when building with clang.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/252
> Signed-off-by: Joel Stanley <joel@jms.id.au>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/9c87156cce5a63735d1218f0096a65

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: powerpc/xmon: Relax frame size for clang
  2018-11-01 12:46 ` Michael Ellerman
@ 2018-11-02 10:26   ` David Laight
  0 siblings, 0 replies; 3+ messages in thread
From: David Laight @ 2018-11-02 10:26 UTC (permalink / raw)
  To: 'Michael Ellerman', Joel Stanley, Naveen N . Rao, linuxppc-dev
  Cc: Nick Desaulniers

From: Linuxppc-dev [mailto:linuxppc-dev-bounces+david.laight=aculab.com@lists.ozlabs.org] On Behalf Of
> Michael Ellerman
> Subject: Re: powerpc/xmon: Relax frame size for clang
> 
> On Wed, 2018-10-31 at 01:09:34 UTC, Joel Stanley wrote:
> > When building with clang (8 trunk, 7.0 release) the frame size limit is
> > hit:
> >
> >  arch/powerpc/xmon/xmon.c:452:12: warning: stack frame size of 2576
> >  bytes in function 'xmon_core' [-Wframe-larger-than=]
> >
> > Some investigation by Naveen indicates this is due to clang saving the
> > addresses to printf format strings on the stack.
> >
> > While this issue is investigated, bump up the frame size limit for xmon
> > when building with clang.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/252
> > Signed-off-by: Joel Stanley <joel@jms.id.au>

Would it be better to stop some of the functions being inlined?

Clearly clang shouldn't be using separate on-stack temporaries
for every printf() call.
That is indicative of a bigger problem.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-02 14:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-31  1:09 [PATCH] powerpc/xmon: Relax frame size for clang Joel Stanley
2018-11-01 12:46 ` Michael Ellerman
2018-11-02 10:26   ` David Laight

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.