All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 4103/11953] arch/arm/kernel/ftrace.c:229:6: warning: no previous prototype for function 'prepare_ftrace_return'
@ 2022-03-11  1:44 kernel test robot
  2022-03-11  2:04   ` Steven Rostedt
  0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2022-03-11  1:44 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: llvm, kbuild-all, Linux Memory Management List, Steven Rostedt (Google)

Hi Ard,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   71941773e143369a73c9c4a3b62fbb60736a1182
commit: 41918ec82eb6f80c8b401422f27ca76c85aa0cb7 [4103/11953] ARM: ftrace: enable the graph tracer with the EABI unwinder
config: arm-aspeed_g4_defconfig (https://download.01.org/0day-ci/archive/20220311/202203110903.3xDyTUVl-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 276ca87382b8f16a65bddac700202924228982f6)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=41918ec82eb6f80c8b401422f27ca76c85aa0cb7
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 41918ec82eb6f80c8b401422f27ca76c85aa0cb7
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash arch/arm/kernel/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> arch/arm/kernel/ftrace.c:229:6: warning: no previous prototype for function 'prepare_ftrace_return' [-Wmissing-prototypes]
   void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
        ^
   arch/arm/kernel/ftrace.c:229:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
   ^
   static 
   1 warning generated.


vim +/prepare_ftrace_return +229 arch/arm/kernel/ftrace.c

376cfa8730c08c Tim Bird                2010-10-09  226  
376cfa8730c08c Tim Bird                2010-10-09  227  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
41918ec82eb6f8 Ard Biesheuvel          2022-01-25  228  asmlinkage
376cfa8730c08c Tim Bird                2010-10-09 @229  void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
41918ec82eb6f8 Ard Biesheuvel          2022-01-25  230  			   unsigned long frame_pointer,
41918ec82eb6f8 Ard Biesheuvel          2022-01-25  231  			   unsigned long stack_pointer)
376cfa8730c08c Tim Bird                2010-10-09  232  {
376cfa8730c08c Tim Bird                2010-10-09  233  	unsigned long return_hooker = (unsigned long) &return_to_handler;
376cfa8730c08c Tim Bird                2010-10-09  234  	unsigned long old;
376cfa8730c08c Tim Bird                2010-10-09  235  
376cfa8730c08c Tim Bird                2010-10-09  236  	if (unlikely(atomic_read(&current->tracing_graph_pause)))
376cfa8730c08c Tim Bird                2010-10-09  237  		return;
376cfa8730c08c Tim Bird                2010-10-09  238  
953f534a7ed6b7 Ard Biesheuvel          2022-01-25  239  	if (IS_ENABLED(CONFIG_UNWINDER_FRAME_POINTER)) {
953f534a7ed6b7 Ard Biesheuvel          2022-01-25  240  		/* FP points one word below parent's top of stack */
953f534a7ed6b7 Ard Biesheuvel          2022-01-25  241  		frame_pointer += 4;
41918ec82eb6f8 Ard Biesheuvel          2022-01-25  242  	} else {
41918ec82eb6f8 Ard Biesheuvel          2022-01-25  243  		struct stackframe frame = {
41918ec82eb6f8 Ard Biesheuvel          2022-01-25  244  			.fp = frame_pointer,
41918ec82eb6f8 Ard Biesheuvel          2022-01-25  245  			.sp = stack_pointer,
41918ec82eb6f8 Ard Biesheuvel          2022-01-25  246  			.lr = self_addr,
41918ec82eb6f8 Ard Biesheuvel          2022-01-25  247  			.pc = self_addr,
41918ec82eb6f8 Ard Biesheuvel          2022-01-25  248  		};
41918ec82eb6f8 Ard Biesheuvel          2022-01-25  249  		if (unwind_frame(&frame) < 0)
41918ec82eb6f8 Ard Biesheuvel          2022-01-25  250  			return;
41918ec82eb6f8 Ard Biesheuvel          2022-01-25  251  		if (frame.lr != self_addr)
41918ec82eb6f8 Ard Biesheuvel          2022-01-25  252  			parent = frame.lr_addr;
41918ec82eb6f8 Ard Biesheuvel          2022-01-25  253  		frame_pointer = frame.sp;
953f534a7ed6b7 Ard Biesheuvel          2022-01-25  254  	}
953f534a7ed6b7 Ard Biesheuvel          2022-01-25  255  
376cfa8730c08c Tim Bird                2010-10-09  256  	old = *parent;
376cfa8730c08c Tim Bird                2010-10-09  257  	*parent = return_hooker;
376cfa8730c08c Tim Bird                2010-10-09  258  
f1f5b14afd7cce Steven Rostedt (VMware  2018-11-18  259) 	if (function_graph_enter(old, self_addr, frame_pointer, NULL))
376cfa8730c08c Tim Bird                2010-10-09  260  		*parent = old;
376cfa8730c08c Tim Bird                2010-10-09  261  }
dd686eb13959e4 Rabin Vincent           2010-11-06  262  

:::::: The code at line 229 was first introduced by commit
:::::: 376cfa8730c08c0394d0aa1d4a80fd8c9971f323 ARM: ftrace: function graph tracer support

:::::: TO: Tim Bird <tim.bird@am.sony.com>
:::::: CC: Rabin Vincent <rabin@rab.in>

---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

* Re: [linux-next:master 4103/11953] arch/arm/kernel/ftrace.c:229:6: warning: no previous prototype for function 'prepare_ftrace_return'
  2022-03-11  1:44 [linux-next:master 4103/11953] arch/arm/kernel/ftrace.c:229:6: warning: no previous prototype for function 'prepare_ftrace_return' kernel test robot
@ 2022-03-11  2:04   ` Steven Rostedt
  0 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2022-03-11  2:04 UTC (permalink / raw)
  To: kernel test robot
  Cc: Ard Biesheuvel, llvm, kbuild-all, Linux Memory Management List

On Fri, 11 Mar 2022 09:44:11 +0800
kernel test robot <lkp@intel.com> wrote:

> Hi Ard,
> 
> FYI, the error/warning still remains.
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   71941773e143369a73c9c4a3b62fbb60736a1182
> commit: 41918ec82eb6f80c8b401422f27ca76c85aa0cb7 [4103/11953] ARM: ftrace: enable the graph tracer with the EABI unwinder
> config: arm-aspeed_g4_defconfig (https://download.01.org/0day-ci/archive/20220311/202203110903.3xDyTUVl-lkp@intel.com/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 276ca87382b8f16a65bddac700202924228982f6)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # install arm cross compiling tool for clang build
>         # apt-get install binutils-arm-linux-gnueabi
>         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=41918ec82eb6f80c8b401422f27ca76c85aa0cb7
>         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
>         git fetch --no-tags linux-next master
>         git checkout 41918ec82eb6f80c8b401422f27ca76c85aa0cb7
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash arch/arm/kernel/
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
> >> arch/arm/kernel/ftrace.c:229:6: warning: no previous prototype for function 'prepare_ftrace_return' [-Wmissing-prototypes]  
>    void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
>         ^
>    arch/arm/kernel/ftrace.c:229:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
>    void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
>    ^
>    static 
>    1 warning generated.
> 

Hmm, this is only called from assembly code, which doesn't care about
prototypes. Is there a way to quiet this warning to say "this is called
only by assembly"?

Or do we just add a useless prototype to shut it up?

-- Steve


> 
> vim +/prepare_ftrace_return +229 arch/arm/kernel/ftrace.c
> 
> 376cfa8730c08c Tim Bird                2010-10-09  226  
> 376cfa8730c08c Tim Bird                2010-10-09  227  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  228  asmlinkage
> 376cfa8730c08c Tim Bird                2010-10-09 @229  void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  230  			   unsigned long frame_pointer,
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  231  			   unsigned long stack_pointer)
> 376cfa8730c08c Tim Bird                2010-10-09  232  {
> 376cfa8730c08c Tim Bird                2010-10-09  233  	unsigned long return_hooker = (unsigned long) &return_to_handler;
> 376cfa8730c08c Tim Bird                2010-10-09  234  	unsigned long old;
> 376cfa8730c08c Tim Bird                2010-10-09  235  
> 376cfa8730c08c Tim Bird                2010-10-09  236  	if (unlikely(atomic_read(&current->tracing_graph_pause)))
> 376cfa8730c08c Tim Bird                2010-10-09  237  		return;
> 376cfa8730c08c Tim Bird                2010-10-09  238  
> 953f534a7ed6b7 Ard Biesheuvel          2022-01-25  239  	if (IS_ENABLED(CONFIG_UNWINDER_FRAME_POINTER)) {
> 953f534a7ed6b7 Ard Biesheuvel          2022-01-25  240  		/* FP points one word below parent's top of stack */
> 953f534a7ed6b7 Ard Biesheuvel          2022-01-25  241  		frame_pointer += 4;
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  242  	} else {
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  243  		struct stackframe frame = {
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  244  			.fp = frame_pointer,
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  245  			.sp = stack_pointer,
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  246  			.lr = self_addr,
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  247  			.pc = self_addr,
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  248  		};
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  249  		if (unwind_frame(&frame) < 0)
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  250  			return;
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  251  		if (frame.lr != self_addr)
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  252  			parent = frame.lr_addr;
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  253  		frame_pointer = frame.sp;
> 953f534a7ed6b7 Ard Biesheuvel          2022-01-25  254  	}
> 953f534a7ed6b7 Ard Biesheuvel          2022-01-25  255  
> 376cfa8730c08c Tim Bird                2010-10-09  256  	old = *parent;
> 376cfa8730c08c Tim Bird                2010-10-09  257  	*parent = return_hooker;
> 376cfa8730c08c Tim Bird                2010-10-09  258  
> f1f5b14afd7cce Steven Rostedt (VMware  2018-11-18  259) 	if (function_graph_enter(old, self_addr, frame_pointer, NULL))
> 376cfa8730c08c Tim Bird                2010-10-09  260  		*parent = old;
> 376cfa8730c08c Tim Bird                2010-10-09  261  }
> dd686eb13959e4 Rabin Vincent           2010-11-06  262  
> 
> :::::: The code at line 229 was first introduced by commit
> :::::: 376cfa8730c08c0394d0aa1d4a80fd8c9971f323 ARM: ftrace: function graph tracer support
> 
> :::::: TO: Tim Bird <tim.bird@am.sony.com>
> :::::: CC: Rabin Vincent <rabin@rab.in>
> 
> ---
> 0-DAY CI Kernel Test Service
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


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

* Re: [linux-next:master 4103/11953] arch/arm/kernel/ftrace.c:229:6: warning: no previous prototype for function 'prepare_ftrace_return'
@ 2022-03-11  2:04   ` Steven Rostedt
  0 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2022-03-11  2:04 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5898 bytes --]

On Fri, 11 Mar 2022 09:44:11 +0800
kernel test robot <lkp@intel.com> wrote:

> Hi Ard,
> 
> FYI, the error/warning still remains.
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   71941773e143369a73c9c4a3b62fbb60736a1182
> commit: 41918ec82eb6f80c8b401422f27ca76c85aa0cb7 [4103/11953] ARM: ftrace: enable the graph tracer with the EABI unwinder
> config: arm-aspeed_g4_defconfig (https://download.01.org/0day-ci/archive/20220311/202203110903.3xDyTUVl-lkp(a)intel.com/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 276ca87382b8f16a65bddac700202924228982f6)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # install arm cross compiling tool for clang build
>         # apt-get install binutils-arm-linux-gnueabi
>         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=41918ec82eb6f80c8b401422f27ca76c85aa0cb7
>         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
>         git fetch --no-tags linux-next master
>         git checkout 41918ec82eb6f80c8b401422f27ca76c85aa0cb7
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash arch/arm/kernel/
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
> >> arch/arm/kernel/ftrace.c:229:6: warning: no previous prototype for function 'prepare_ftrace_return' [-Wmissing-prototypes]  
>    void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
>         ^
>    arch/arm/kernel/ftrace.c:229:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
>    void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
>    ^
>    static 
>    1 warning generated.
> 

Hmm, this is only called from assembly code, which doesn't care about
prototypes. Is there a way to quiet this warning to say "this is called
only by assembly"?

Or do we just add a useless prototype to shut it up?

-- Steve


> 
> vim +/prepare_ftrace_return +229 arch/arm/kernel/ftrace.c
> 
> 376cfa8730c08c Tim Bird                2010-10-09  226  
> 376cfa8730c08c Tim Bird                2010-10-09  227  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  228  asmlinkage
> 376cfa8730c08c Tim Bird                2010-10-09 @229  void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  230  			   unsigned long frame_pointer,
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  231  			   unsigned long stack_pointer)
> 376cfa8730c08c Tim Bird                2010-10-09  232  {
> 376cfa8730c08c Tim Bird                2010-10-09  233  	unsigned long return_hooker = (unsigned long) &return_to_handler;
> 376cfa8730c08c Tim Bird                2010-10-09  234  	unsigned long old;
> 376cfa8730c08c Tim Bird                2010-10-09  235  
> 376cfa8730c08c Tim Bird                2010-10-09  236  	if (unlikely(atomic_read(&current->tracing_graph_pause)))
> 376cfa8730c08c Tim Bird                2010-10-09  237  		return;
> 376cfa8730c08c Tim Bird                2010-10-09  238  
> 953f534a7ed6b7 Ard Biesheuvel          2022-01-25  239  	if (IS_ENABLED(CONFIG_UNWINDER_FRAME_POINTER)) {
> 953f534a7ed6b7 Ard Biesheuvel          2022-01-25  240  		/* FP points one word below parent's top of stack */
> 953f534a7ed6b7 Ard Biesheuvel          2022-01-25  241  		frame_pointer += 4;
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  242  	} else {
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  243  		struct stackframe frame = {
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  244  			.fp = frame_pointer,
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  245  			.sp = stack_pointer,
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  246  			.lr = self_addr,
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  247  			.pc = self_addr,
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  248  		};
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  249  		if (unwind_frame(&frame) < 0)
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  250  			return;
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  251  		if (frame.lr != self_addr)
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  252  			parent = frame.lr_addr;
> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  253  		frame_pointer = frame.sp;
> 953f534a7ed6b7 Ard Biesheuvel          2022-01-25  254  	}
> 953f534a7ed6b7 Ard Biesheuvel          2022-01-25  255  
> 376cfa8730c08c Tim Bird                2010-10-09  256  	old = *parent;
> 376cfa8730c08c Tim Bird                2010-10-09  257  	*parent = return_hooker;
> 376cfa8730c08c Tim Bird                2010-10-09  258  
> f1f5b14afd7cce Steven Rostedt (VMware  2018-11-18  259) 	if (function_graph_enter(old, self_addr, frame_pointer, NULL))
> 376cfa8730c08c Tim Bird                2010-10-09  260  		*parent = old;
> 376cfa8730c08c Tim Bird                2010-10-09  261  }
> dd686eb13959e4 Rabin Vincent           2010-11-06  262  
> 
> :::::: The code at line 229 was first introduced by commit
> :::::: 376cfa8730c08c0394d0aa1d4a80fd8c9971f323 ARM: ftrace: function graph tracer support
> 
> :::::: TO: Tim Bird <tim.bird@am.sony.com>
> :::::: CC: Rabin Vincent <rabin@rab.in>
> 
> ---
> 0-DAY CI Kernel Test Service
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

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

* Re: [kbuild-all] Re: [linux-next:master 4103/11953] arch/arm/kernel/ftrace.c:229:6: warning: no previous prototype for function 'prepare_ftrace_return'
  2022-03-11  2:04   ` Steven Rostedt
  (?)
@ 2022-03-18  2:24   ` Chen, Rong A
  -1 siblings, 0 replies; 6+ messages in thread
From: Chen, Rong A @ 2022-03-18  2:24 UTC (permalink / raw)
  To: Steven Rostedt, kernel test robot
  Cc: Ard Biesheuvel, llvm, kbuild-all, Linux Memory Management List



On 3/11/2022 10:04 AM, Steven Rostedt wrote:
> On Fri, 11 Mar 2022 09:44:11 +0800
> kernel test robot <lkp@intel.com> wrote:
> 
>> Hi Ard,
>>
>> FYI, the error/warning still remains.
>>
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
>> head:   71941773e143369a73c9c4a3b62fbb60736a1182
>> commit: 41918ec82eb6f80c8b401422f27ca76c85aa0cb7 [4103/11953] ARM: ftrace: enable the graph tracer with the EABI unwinder
>> config: arm-aspeed_g4_defconfig (https://download.01.org/0day-ci/archive/20220311/202203110903.3xDyTUVl-lkp@intel.com/config)
>> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 276ca87382b8f16a65bddac700202924228982f6)
>> reproduce (this is a W=1 build):
>>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>          chmod +x ~/bin/make.cross
>>          # install arm cross compiling tool for clang build
>>          # apt-get install binutils-arm-linux-gnueabi
>>          # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=41918ec82eb6f80c8b401422f27ca76c85aa0cb7
>>          git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
>>          git fetch --no-tags linux-next master
>>          git checkout 41918ec82eb6f80c8b401422f27ca76c85aa0cb7
>>          # save the config file to linux build tree
>>          mkdir build_dir
>>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash arch/arm/kernel/
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>> All warnings (new ones prefixed by >>):
>>
>>>> arch/arm/kernel/ftrace.c:229:6: warning: no previous prototype for function 'prepare_ftrace_return' [-Wmissing-prototypes]
>>     void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
>>          ^
>>     arch/arm/kernel/ftrace.c:229:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
>>     void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
>>     ^
>>     static
>>     1 warning generated.
>>
> 
> Hmm, this is only called from assembly code, which doesn't care about
> prototypes. Is there a way to quiet this warning to say "this is called
> only by assembly"?
> 
> Or do we just add a useless prototype to shut it up?
> 
> -- Steve

Hi Steve,

Sorry for the inconvenience, it's a duplicate false positive:
 
https://lore.kernel.org/linux-mm/2db6ea89-846a-8d4e-a5c3-954411332029@intel.com/

please ignore the report, we are still working on it.

Best Regards,
Rong Chen

> 
> 
>>
>> vim +/prepare_ftrace_return +229 arch/arm/kernel/ftrace.c
>>
>> 376cfa8730c08c Tim Bird                2010-10-09  226
>> 376cfa8730c08c Tim Bird                2010-10-09  227  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
>> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  228  asmlinkage
>> 376cfa8730c08c Tim Bird                2010-10-09 @229  void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
>> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  230  			   unsigned long frame_pointer,
>> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  231  			   unsigned long stack_pointer)
>> 376cfa8730c08c Tim Bird                2010-10-09  232  {
>> 376cfa8730c08c Tim Bird                2010-10-09  233  	unsigned long return_hooker = (unsigned long) &return_to_handler;
>> 376cfa8730c08c Tim Bird                2010-10-09  234  	unsigned long old;
>> 376cfa8730c08c Tim Bird                2010-10-09  235
>> 376cfa8730c08c Tim Bird                2010-10-09  236  	if (unlikely(atomic_read(&current->tracing_graph_pause)))
>> 376cfa8730c08c Tim Bird                2010-10-09  237  		return;
>> 376cfa8730c08c Tim Bird                2010-10-09  238
>> 953f534a7ed6b7 Ard Biesheuvel          2022-01-25  239  	if (IS_ENABLED(CONFIG_UNWINDER_FRAME_POINTER)) {
>> 953f534a7ed6b7 Ard Biesheuvel          2022-01-25  240  		/* FP points one word below parent's top of stack */
>> 953f534a7ed6b7 Ard Biesheuvel          2022-01-25  241  		frame_pointer += 4;
>> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  242  	} else {
>> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  243  		struct stackframe frame = {
>> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  244  			.fp = frame_pointer,
>> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  245  			.sp = stack_pointer,
>> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  246  			.lr = self_addr,
>> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  247  			.pc = self_addr,
>> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  248  		};
>> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  249  		if (unwind_frame(&frame) < 0)
>> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  250  			return;
>> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  251  		if (frame.lr != self_addr)
>> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  252  			parent = frame.lr_addr;
>> 41918ec82eb6f8 Ard Biesheuvel          2022-01-25  253  		frame_pointer = frame.sp;
>> 953f534a7ed6b7 Ard Biesheuvel          2022-01-25  254  	}
>> 953f534a7ed6b7 Ard Biesheuvel          2022-01-25  255
>> 376cfa8730c08c Tim Bird                2010-10-09  256  	old = *parent;
>> 376cfa8730c08c Tim Bird                2010-10-09  257  	*parent = return_hooker;
>> 376cfa8730c08c Tim Bird                2010-10-09  258
>> f1f5b14afd7cce Steven Rostedt (VMware  2018-11-18  259) 	if (function_graph_enter(old, self_addr, frame_pointer, NULL))
>> 376cfa8730c08c Tim Bird                2010-10-09  260  		*parent = old;
>> 376cfa8730c08c Tim Bird                2010-10-09  261  }
>> dd686eb13959e4 Rabin Vincent           2010-11-06  262
>>
>> :::::: The code at line 229 was first introduced by commit
>> :::::: 376cfa8730c08c0394d0aa1d4a80fd8c9971f323 ARM: ftrace: function graph tracer support
>>
>> :::::: TO: Tim Bird <tim.bird@am.sony.com>
>> :::::: CC: Rabin Vincent <rabin@rab.in>
>>
>> ---
>> 0-DAY CI Kernel Test Service
>> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> _______________________________________________
> kbuild-all mailing list -- kbuild-all@lists.01.org
> To unsubscribe send an email to kbuild-all-leave@lists.01.org
> 

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

* Re: [linux-next:master 4103/11953] arch/arm/kernel/ftrace.c:229:6: warning: no previous prototype for function 'prepare_ftrace_return'
  2022-03-11  2:04   ` Steven Rostedt
@ 2022-03-18 18:26     ` Nick Desaulniers
  -1 siblings, 0 replies; 6+ messages in thread
From: Nick Desaulniers @ 2022-03-18 18:26 UTC (permalink / raw)
  To: Steven Rostedt, Ard Biesheuvel, Marc Zyngier, Arnd Bergmann
  Cc: kernel test robot, llvm, kbuild-all,
	Linux Memory Management List, Linus Torvalds

, , On Thu, Mar 10, 2022 at 6:04 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Fri, 11 Mar 2022 09:44:11 +0800
> kernel test robot <lkp@intel.com> wrote:
>
> > Hi Ard,
> >
> > FYI, the error/warning still remains.
> >
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head:   71941773e143369a73c9c4a3b62fbb60736a1182
> > commit: 41918ec82eb6f80c8b401422f27ca76c85aa0cb7 [4103/11953] ARM: ftrace: enable the graph tracer with the EABI unwinder
> > config: arm-aspeed_g4_defconfig (https://download.01.org/0day-ci/archive/20220311/202203110903.3xDyTUVl-lkp@intel.com/config)
> > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 276ca87382b8f16a65bddac700202924228982f6)
> > reproduce (this is a W=1 build):
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # install arm cross compiling tool for clang build
> >         # apt-get install binutils-arm-linux-gnueabi
> >         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=41918ec82eb6f80c8b401422f27ca76c85aa0cb7
> >         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> >         git fetch --no-tags linux-next master
> >         git checkout 41918ec82eb6f80c8b401422f27ca76c85aa0cb7
> >         # save the config file to linux build tree
> >         mkdir build_dir
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash arch/arm/kernel/
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> arch/arm/kernel/ftrace.c:229:6: warning: no previous prototype for function 'prepare_ftrace_return' [-Wmissing-prototypes]
> >    void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
> >         ^
> >    arch/arm/kernel/ftrace.c:229:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
> >    void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
> >    ^
> >    static
> >    1 warning generated.
> >
>
> Hmm, this is only called from assembly code, which doesn't care about
> prototypes. Is there a way to quiet this warning to say "this is called
> only by assembly"?
>
> Or do we just add a useless prototype to shut it up?

So this has come up a few times before, particularly around the usage
in the kernel of `asmlinkage`. This 0day report also only comes up for
W=1 builds, which enable -Wmissing-prototypes (see
scripts/Makefile.extrawarn).

The problem is that `asmlinkage` is not a language keyword; it's a
preprocessor define (see include/linux/linkage.h,
arch/ia64/include/asm/linkage.h, arch/x86/include/asm/linkage.h), so
the compiler has no idea that this function is only called from
assembly only. The warning is meant to catch implicit defines
(-Wimplicit-function-declaration) where the signature the caller is
expecting doesn't match the callee's actual definition (because the
callee wasn't declared in a shared header).

I think IF we had a function attribute added to the compiler that
disabled -Wmissing-prototype warnings just for that definition, then
we could do something like:

#define asmlinkage CPP_ASMLINKAGE \
  __attribute__((no_wmissing_prototypes,error( \
  "Called an asmlinkage function from C; remove " \
  "asmlinkage or dont call this fn"))

or something.  We wouldn't be able to always enable
-Wmissing-prototypes until we had such an fn attr though, due to cases
like this. I think -Wmissing-prototypes is still worthwhile, and that
Arnd previously mentioned interest in this warning.

For now, I think it's worth forward declaring the function, in the .c
file (rather than a header) with a comment that this is expected to be
called from asm only. If that ever changes, then the declaration can
be moved to a header.
-- 
Thanks,
~Nick Desaulniers

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

* Re: [linux-next:master 4103/11953] arch/arm/kernel/ftrace.c:229:6: warning: no previous prototype for function 'prepare_ftrace_return'
@ 2022-03-18 18:26     ` Nick Desaulniers
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Desaulniers @ 2022-03-18 18:26 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4157 bytes --]

, , On Thu, Mar 10, 2022 at 6:04 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Fri, 11 Mar 2022 09:44:11 +0800
> kernel test robot <lkp@intel.com> wrote:
>
> > Hi Ard,
> >
> > FYI, the error/warning still remains.
> >
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head:   71941773e143369a73c9c4a3b62fbb60736a1182
> > commit: 41918ec82eb6f80c8b401422f27ca76c85aa0cb7 [4103/11953] ARM: ftrace: enable the graph tracer with the EABI unwinder
> > config: arm-aspeed_g4_defconfig (https://download.01.org/0day-ci/archive/20220311/202203110903.3xDyTUVl-lkp(a)intel.com/config)
> > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 276ca87382b8f16a65bddac700202924228982f6)
> > reproduce (this is a W=1 build):
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # install arm cross compiling tool for clang build
> >         # apt-get install binutils-arm-linux-gnueabi
> >         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=41918ec82eb6f80c8b401422f27ca76c85aa0cb7
> >         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> >         git fetch --no-tags linux-next master
> >         git checkout 41918ec82eb6f80c8b401422f27ca76c85aa0cb7
> >         # save the config file to linux build tree
> >         mkdir build_dir
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash arch/arm/kernel/
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> arch/arm/kernel/ftrace.c:229:6: warning: no previous prototype for function 'prepare_ftrace_return' [-Wmissing-prototypes]
> >    void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
> >         ^
> >    arch/arm/kernel/ftrace.c:229:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
> >    void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
> >    ^
> >    static
> >    1 warning generated.
> >
>
> Hmm, this is only called from assembly code, which doesn't care about
> prototypes. Is there a way to quiet this warning to say "this is called
> only by assembly"?
>
> Or do we just add a useless prototype to shut it up?

So this has come up a few times before, particularly around the usage
in the kernel of `asmlinkage`. This 0day report also only comes up for
W=1 builds, which enable -Wmissing-prototypes (see
scripts/Makefile.extrawarn).

The problem is that `asmlinkage` is not a language keyword; it's a
preprocessor define (see include/linux/linkage.h,
arch/ia64/include/asm/linkage.h, arch/x86/include/asm/linkage.h), so
the compiler has no idea that this function is only called from
assembly only. The warning is meant to catch implicit defines
(-Wimplicit-function-declaration) where the signature the caller is
expecting doesn't match the callee's actual definition (because the
callee wasn't declared in a shared header).

I think IF we had a function attribute added to the compiler that
disabled -Wmissing-prototype warnings just for that definition, then
we could do something like:

#define asmlinkage CPP_ASMLINKAGE \
  __attribute__((no_wmissing_prototypes,error( \
  "Called an asmlinkage function from C; remove " \
  "asmlinkage or dont call this fn"))

or something.  We wouldn't be able to always enable
-Wmissing-prototypes until we had such an fn attr though, due to cases
like this. I think -Wmissing-prototypes is still worthwhile, and that
Arnd previously mentioned interest in this warning.

For now, I think it's worth forward declaring the function, in the .c
file (rather than a header) with a comment that this is expected to be
called from asm only. If that ever changes, then the declaration can
be moved to a header.
-- 
Thanks,
~Nick Desaulniers

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

end of thread, other threads:[~2022-03-18 18:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-11  1:44 [linux-next:master 4103/11953] arch/arm/kernel/ftrace.c:229:6: warning: no previous prototype for function 'prepare_ftrace_return' kernel test robot
2022-03-11  2:04 ` Steven Rostedt
2022-03-11  2:04   ` Steven Rostedt
2022-03-18  2:24   ` [kbuild-all] " Chen, Rong A
2022-03-18 18:26   ` Nick Desaulniers
2022-03-18 18:26     ` Nick Desaulniers

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.