public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Ingo Molnar <mingo@redhat.com>,
	clang-built-linux@googlegroups.com,
	Nick Desaulniers <ndesaulniers@google.com>,
	Nathan Chancellor <natechancellor@gmail.com>,
	linux-s390 <linux-s390@vger.kernel.org>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 10/12] s390: avoid __builtin_return_address(n) on clang
Date: Thu, 11 Apr 2019 09:32:34 +0200	[thread overview]
Message-ID: <20190411093234.5f212a2e@mschwideX1> (raw)
In-Reply-To: <CAK8P3a2n+nEcaNrATQVO8NSGzfrMP5n+SrvjpTYcH4ikCN5LGg@mail.gmail.com>

On Wed, 10 Apr 2019 21:07:56 +0200
Arnd Bergmann <arnd@arndb.de> wrote:

> On Wed, Apr 10, 2019 at 6:14 PM Steven Rostedt <rostedt@goodmis.org> wrote:
> > On Wed, 10 Apr 2019 18:03:57 +0200 Martin Schwidefsky <schwidefsky@de.ibm.com> wrote:
> >  
> > > > --- a/arch/s390/include/asm/ftrace.h
> > > > +++ b/arch/s390/include/asm/ftrace.h
> > > > @@ -13,7 +13,12 @@
> > > >
> > > >  #ifndef __ASSEMBLY__
> > > >
> > > > +#ifdef CONFIG_CC_IS_CLANG
> > > > +/* https://bugs.llvm.org/show_bug.cgi?id=41424 */
> > > > +#define ftrace_return_address(n) __builtin_return_address(0)
> > > > +#else
> > > >  #define ftrace_return_address(n) __builtin_return_address(n)
> > > > +#endif
> > > >
> > > >  void _mcount(void);
> > > >  void ftrace_caller(void);  
> > >
> > > I can say I like this one. If the compiler can not do __builtin_return_address(n)
> > > it feels wrong to just use __builtin_return_address(0).  
> >
> > I agree. The proper return value is 0UL, see include/linux/ftrace.h
> >
> > /* Archs may use other ways for ADDR1 and beyond */
> > #ifndef ftrace_return_address
> > # ifdef CONFIG_FRAME_POINTER
> > #  define ftrace_return_address(n) __builtin_return_address(n)
> > # else
> > #  define ftrace_return_address(n) 0UL
> > # endif
> > #endif
> >
> > This is why we treat zero differently:
> >
> > #define CALLER_ADDR0 ((unsigned long)ftrace_return_address0)
> > #define CALLER_ADDR1 ((unsigned long)ftrace_return_address(1))
> > #define CALLER_ADDR2 ((unsigned long)ftrace_return_address(2))
> > #define CALLER_ADDR3 ((unsigned long)ftrace_return_address(3))
> > #define CALLER_ADDR4 ((unsigned long)ftrace_return_address(4))
> > #define CALLER_ADDR5 ((unsigned long)ftrace_return_address(5))
> > #define CALLER_ADDR6 ((unsigned long)ftrace_return_address(6))  
> 
> Right, got it.
> 
> Martin, do you want me to send a replacement patch, or can you
> commit the patch with
> 
> #ifdef CONFIG_CC_IS_CLANG
> /* https://bugs.llvm.org/show_bug.cgi?id=41424 */
> #define ftrace_return_address(n) 0UL
> #else
> #define ftrace_return_address(n) __builtin_return_address(n)
> #endif
> 
> instead?

Ok, done.

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.


  reply	other threads:[~2019-04-11  7:32 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-08 21:26 [PATCH 01/12] s390: remove -fno-strength-reduce flag Arnd Bergmann
2019-04-08 21:26 ` [PATCH 02/12] s390: don't build vdso32 with clang Arnd Bergmann
2019-04-10 15:57   ` Martin Schwidefsky
2019-04-10 16:26   ` Nick Desaulniers
2019-04-10 19:00     ` Arnd Bergmann
2019-04-08 21:26 ` [PATCH 03/12] s390: purgatory: pass --target option to clang Arnd Bergmann
2019-04-08 22:03   ` Nathan Chancellor
2019-04-09  6:43     ` Arnd Bergmann
2019-04-09 16:30       ` Nathan Chancellor
2019-04-09 18:11         ` Nick Desaulniers
2019-04-08 21:26 ` [PATCH 04/12] s390: qeth: address type mismatch warning Arnd Bergmann
2019-04-08 22:16   ` Nathan Chancellor
2019-04-09  6:44     ` Arnd Bergmann
2019-04-10 15:58   ` Martin Schwidefsky
2019-04-08 21:26 ` [PATCH 05/12] s390: zcrypt: initialize variables before_use Arnd Bergmann
2019-04-08 22:31   ` Nathan Chancellor
2019-04-09  9:54   ` Harald Freudenberger
2019-04-09 10:13     ` Arnd Bergmann
2019-04-10 15:59     ` Martin Schwidefsky
2019-04-10 18:57       ` Arnd Bergmann
2019-04-11  7:40         ` Martin Schwidefsky
2019-04-08 21:26 ` [PATCH 06/12] s390: ctcm: fix ctcm_new_device error return code Arnd Bergmann
2019-04-08 22:33   ` Nathan Chancellor
2019-04-10 16:00   ` Martin Schwidefsky
2019-04-08 21:26 ` [PATCH 07/12] s390: cio: fix cio_irb declaration Arnd Bergmann
2019-04-08 22:35   ` Nathan Chancellor
2019-04-09 13:13   ` Sebastian Ott
2019-04-08 21:26 ` [PATCH 08/12] s390: syscall_wrapper: avoid clang warning Arnd Bergmann
2019-04-10 16:00   ` Martin Schwidefsky
2019-04-08 21:26 ` [PATCH 09/12] s390: make __load_psw_mask work with clang Arnd Bergmann
2019-04-10 16:01   ` Martin Schwidefsky
2019-04-08 21:26 ` [PATCH 10/12] s390: avoid __builtin_return_address(n) on clang Arnd Bergmann
2019-04-10 16:03   ` Martin Schwidefsky
2019-04-10 16:14     ` Steven Rostedt
2019-04-10 19:07       ` Arnd Bergmann
2019-04-11  7:32         ` Martin Schwidefsky [this message]
2019-04-08 21:26 ` [PATCH 11/12] s390: make chkbss work with clang Arnd Bergmann
2019-04-10 16:02   ` Martin Schwidefsky
2019-04-08 21:26 ` [PATCH 12/12] [PROBABLY WRONG] s390: void '0' constraint in inline assembly Arnd Bergmann
2019-04-10 13:55   ` Martin Schwidefsky
2019-04-10 16:35     ` Nick Desaulniers
2019-04-10 18:55     ` Arnd Bergmann
2019-04-10 15:57 ` [PATCH 01/12] s390: remove -fno-strength-reduce flag Martin Schwidefsky

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=20190411093234.5f212a2e@mschwideX1 \
    --to=schwidefsky@de.ibm.com \
    --cc=arnd@arndb.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=gor@linux.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=natechancellor@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=rostedt@goodmis.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