linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* arch/powerpc/kernel/stacktrace.c:171:9: error: implicit declaration of function 'nmi_cpu_backtrace'
@ 2022-01-13 22:13 kernel test robot
  2022-01-14  8:37 ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2022-01-13 22:13 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: kbuild-all, linux-kernel, Catalin Marinas, Mark Rutland

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   fb3b0673b7d5b477ed104949450cd511337ba3c6
commit: 1614b2b11fab29dd4ff31ebba9d266961f5af69e arch: Make ARCH_STACKWALK independent of STACKTRACE
date:   5 weeks ago
config: powerpc64-randconfig-r025-20220113 (https://download.01.org/0day-ci/archive/20220114/202201140631.ZuSwa9QF-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 11.2.0
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
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1614b2b11fab29dd4ff31ebba9d266961f5af69e
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 1614b2b11fab29dd4ff31ebba9d266961f5af69e
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=powerpc SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

   arch/powerpc/kernel/stacktrace.c: In function 'handle_backtrace_ipi':
>> arch/powerpc/kernel/stacktrace.c:171:9: error: implicit declaration of function 'nmi_cpu_backtrace' [-Werror=implicit-function-declaration]
     171 |         nmi_cpu_backtrace(regs);
         |         ^~~~~~~~~~~~~~~~~
   arch/powerpc/kernel/stacktrace.c: At top level:
   arch/powerpc/kernel/stacktrace.c:224:6: warning: no previous prototype for 'arch_trigger_cpumask_backtrace' [-Wmissing-prototypes]
     224 | void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/kernel/stacktrace.c: In function 'arch_trigger_cpumask_backtrace':
>> arch/powerpc/kernel/stacktrace.c:226:9: error: implicit declaration of function 'nmi_trigger_cpumask_backtrace'; did you mean 'arch_trigger_cpumask_backtrace'? [-Werror=implicit-function-declaration]
     226 |         nmi_trigger_cpumask_backtrace(mask, exclude_self, raise_backtrace_ipi);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |         arch_trigger_cpumask_backtrace
   cc1: some warnings being treated as errors


vim +/nmi_cpu_backtrace +171 arch/powerpc/kernel/stacktrace.c

018cce33c5e62d Christophe Leroy 2019-01-31  167  
e08ecba17b72ae Michael Ellerman 2018-06-19  168  #if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_NMI_IPI)
5cc05910f26e6f Michael Ellerman 2018-05-02  169  static void handle_backtrace_ipi(struct pt_regs *regs)
5cc05910f26e6f Michael Ellerman 2018-05-02  170  {
5cc05910f26e6f Michael Ellerman 2018-05-02 @171  	nmi_cpu_backtrace(regs);
5cc05910f26e6f Michael Ellerman 2018-05-02  172  }
5cc05910f26e6f Michael Ellerman 2018-05-02  173  
5cc05910f26e6f Michael Ellerman 2018-05-02  174  static void raise_backtrace_ipi(cpumask_t *mask)
5cc05910f26e6f Michael Ellerman 2018-05-02  175  {
7c6986ade69e3c Michael Ellerman 2021-06-25  176  	struct paca_struct *p;
5cc05910f26e6f Michael Ellerman 2018-05-02  177  	unsigned int cpu;
7c6986ade69e3c Michael Ellerman 2021-06-25  178  	u64 delay_us;
5cc05910f26e6f Michael Ellerman 2018-05-02  179  
5cc05910f26e6f Michael Ellerman 2018-05-02  180  	for_each_cpu(cpu, mask) {
7c6986ade69e3c Michael Ellerman 2021-06-25  181  		if (cpu == smp_processor_id()) {
5cc05910f26e6f Michael Ellerman 2018-05-02  182  			handle_backtrace_ipi(NULL);
7c6986ade69e3c Michael Ellerman 2021-06-25  183  			continue;
5cc05910f26e6f Michael Ellerman 2018-05-02  184  		}
5cc05910f26e6f Michael Ellerman 2018-05-02  185  
7c6986ade69e3c Michael Ellerman 2021-06-25  186  		delay_us = 5 * USEC_PER_SEC;
7c6986ade69e3c Michael Ellerman 2021-06-25  187  
7c6986ade69e3c Michael Ellerman 2021-06-25  188  		if (smp_send_safe_nmi_ipi(cpu, handle_backtrace_ipi, delay_us)) {
7c6986ade69e3c Michael Ellerman 2021-06-25  189  			// Now wait up to 5s for the other CPU to do its backtrace
7c6986ade69e3c Michael Ellerman 2021-06-25  190  			while (cpumask_test_cpu(cpu, mask) && delay_us) {
7c6986ade69e3c Michael Ellerman 2021-06-25  191  				udelay(1);
7c6986ade69e3c Michael Ellerman 2021-06-25  192  				delay_us--;
7c6986ade69e3c Michael Ellerman 2021-06-25  193  			}
7c6986ade69e3c Michael Ellerman 2021-06-25  194  
7c6986ade69e3c Michael Ellerman 2021-06-25  195  			// Other CPU cleared itself from the mask
7c6986ade69e3c Michael Ellerman 2021-06-25  196  			if (delay_us)
7c6986ade69e3c Michael Ellerman 2021-06-25  197  				continue;
7c6986ade69e3c Michael Ellerman 2021-06-25  198  		}
7c6986ade69e3c Michael Ellerman 2021-06-25  199  
7c6986ade69e3c Michael Ellerman 2021-06-25  200  		p = paca_ptrs[cpu];
5cc05910f26e6f Michael Ellerman 2018-05-02  201  
5cc05910f26e6f Michael Ellerman 2018-05-02  202  		cpumask_clear_cpu(cpu, mask);
5cc05910f26e6f Michael Ellerman 2018-05-02  203  
5cc05910f26e6f Michael Ellerman 2018-05-02  204  		pr_warn("CPU %d didn't respond to backtrace IPI, inspecting paca.\n", cpu);
5cc05910f26e6f Michael Ellerman 2018-05-02  205  		if (!virt_addr_valid(p)) {
5cc05910f26e6f Michael Ellerman 2018-05-02  206  			pr_warn("paca pointer appears corrupt? (%px)\n", p);
5cc05910f26e6f Michael Ellerman 2018-05-02  207  			continue;
5cc05910f26e6f Michael Ellerman 2018-05-02  208  		}
5cc05910f26e6f Michael Ellerman 2018-05-02  209  
5cc05910f26e6f Michael Ellerman 2018-05-02  210  		pr_warn("irq_soft_mask: 0x%02x in_mce: %d in_nmi: %d",
5cc05910f26e6f Michael Ellerman 2018-05-02  211  			p->irq_soft_mask, p->in_mce, p->in_nmi);
5cc05910f26e6f Michael Ellerman 2018-05-02  212  
5cc05910f26e6f Michael Ellerman 2018-05-02  213  		if (virt_addr_valid(p->__current))
5cc05910f26e6f Michael Ellerman 2018-05-02  214  			pr_cont(" current: %d (%s)\n", p->__current->pid,
5cc05910f26e6f Michael Ellerman 2018-05-02  215  				p->__current->comm);
5cc05910f26e6f Michael Ellerman 2018-05-02  216  		else
5cc05910f26e6f Michael Ellerman 2018-05-02  217  			pr_cont(" current pointer corrupt? (%px)\n", p->__current);
5cc05910f26e6f Michael Ellerman 2018-05-02  218  
5cc05910f26e6f Michael Ellerman 2018-05-02  219  		pr_warn("Back trace of paca->saved_r1 (0x%016llx) (possibly stale):\n", p->saved_r1);
9cb8f069deeed7 Dmitry Safonov   2020-06-08  220  		show_stack(p->__current, (unsigned long *)p->saved_r1, KERN_WARNING);
5cc05910f26e6f Michael Ellerman 2018-05-02  221  	}
5cc05910f26e6f Michael Ellerman 2018-05-02  222  }
5cc05910f26e6f Michael Ellerman 2018-05-02  223  
5cc05910f26e6f Michael Ellerman 2018-05-02  224  void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self)
5cc05910f26e6f Michael Ellerman 2018-05-02  225  {
5cc05910f26e6f Michael Ellerman 2018-05-02 @226  	nmi_trigger_cpumask_backtrace(mask, exclude_self, raise_backtrace_ipi);

:::::: The code at line 171 was first introduced by commit
:::::: 5cc05910f26e6fd6da15f052f86f6150e4b91664 powerpc/64s: Wire up arch_trigger_cpumask_backtrace()

:::::: TO: Michael Ellerman <mpe@ellerman.id.au>
:::::: CC: Michael Ellerman <mpe@ellerman.id.au>

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

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

* Re: arch/powerpc/kernel/stacktrace.c:171:9: error: implicit declaration of function 'nmi_cpu_backtrace'
  2022-01-13 22:13 arch/powerpc/kernel/stacktrace.c:171:9: error: implicit declaration of function 'nmi_cpu_backtrace' kernel test robot
@ 2022-01-14  8:37 ` Peter Zijlstra
  2022-01-17 13:58   ` Mark Rutland
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2022-01-14  8:37 UTC (permalink / raw)
  To: kernel test robot; +Cc: kbuild-all, linux-kernel, Catalin Marinas, Mark Rutland

On Fri, Jan 14, 2022 at 06:13:37AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   fb3b0673b7d5b477ed104949450cd511337ba3c6
> commit: 1614b2b11fab29dd4ff31ebba9d266961f5af69e arch: Make ARCH_STACKWALK independent of STACKTRACE
> date:   5 weeks ago
> config: powerpc64-randconfig-r025-20220113 (https://download.01.org/0day-ci/archive/20220114/202201140631.ZuSwa9QF-lkp@intel.com/config)
> compiler: powerpc64-linux-gcc (GCC) 11.2.0
> 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
>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1614b2b11fab29dd4ff31ebba9d266961f5af69e
>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>         git fetch --no-tags linus master
>         git checkout 1614b2b11fab29dd4ff31ebba9d266961f5af69e
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=powerpc SHELL=/bin/bash
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>    arch/powerpc/kernel/stacktrace.c: In function 'handle_backtrace_ipi':
> >> arch/powerpc/kernel/stacktrace.c:171:9: error: implicit declaration of function 'nmi_cpu_backtrace' [-Werror=implicit-function-declaration]
>      171 |         nmi_cpu_backtrace(regs);
>          |         ^~~~~~~~~~~~~~~~~
>    arch/powerpc/kernel/stacktrace.c: At top level:
>    arch/powerpc/kernel/stacktrace.c:224:6: warning: no previous prototype for 'arch_trigger_cpumask_backtrace' [-Wmissing-prototypes]
>      224 | void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self)
>          |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    arch/powerpc/kernel/stacktrace.c: In function 'arch_trigger_cpumask_backtrace':
> >> arch/powerpc/kernel/stacktrace.c:226:9: error: implicit declaration of function 'nmi_trigger_cpumask_backtrace'; did you mean 'arch_trigger_cpumask_backtrace'? [-Werror=implicit-function-declaration]
>      226 |         nmi_trigger_cpumask_backtrace(mask, exclude_self, raise_backtrace_ipi);
>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>          |         arch_trigger_cpumask_backtrace
>    cc1: some warnings being treated as errors

I suppose this ought to cure things...

diff --git a/arch/powerpc/kernel/stacktrace.c b/arch/powerpc/kernel/stacktrace.c
index a2443d61728e..bde1aaedeb72 100644
--- a/arch/powerpc/kernel/stacktrace.c
+++ b/arch/powerpc/kernel/stacktrace.c
@@ -165,7 +165,7 @@ int __no_sanitize_address arch_stack_walk_reliable(stack_trace_consume_fn consum
 	return 0;
 }
 
-#if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_NMI_IPI)
+#if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_NMI_IPI) && defined(CONFIG_STACKTRACE)
 static void handle_backtrace_ipi(struct pt_regs *regs)
 {
 	nmi_cpu_backtrace(regs);

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

* Re: arch/powerpc/kernel/stacktrace.c:171:9: error: implicit declaration of function 'nmi_cpu_backtrace'
  2022-01-14  8:37 ` Peter Zijlstra
@ 2022-01-17 13:58   ` Mark Rutland
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Rutland @ 2022-01-17 13:58 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: kernel test robot, kbuild-all, linux-kernel, Catalin Marinas,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras

On Fri, Jan 14, 2022 at 09:37:41AM +0100, Peter Zijlstra wrote:
> On Fri, Jan 14, 2022 at 06:13:37AM +0800, kernel test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head:   fb3b0673b7d5b477ed104949450cd511337ba3c6
> > commit: 1614b2b11fab29dd4ff31ebba9d266961f5af69e arch: Make ARCH_STACKWALK independent of STACKTRACE
> > date:   5 weeks ago
> > config: powerpc64-randconfig-r025-20220113 (https://download.01.org/0day-ci/archive/20220114/202201140631.ZuSwa9QF-lkp@intel.com/config)
> > compiler: powerpc64-linux-gcc (GCC) 11.2.0
> > 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
> >         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1614b2b11fab29dd4ff31ebba9d266961f5af69e
> >         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> >         git fetch --no-tags linus master
> >         git checkout 1614b2b11fab29dd4ff31ebba9d266961f5af69e
> >         # save the config file to linux build tree
> >         mkdir build_dir
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=powerpc SHELL=/bin/bash
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > 
> > All errors (new ones prefixed by >>):
> > 
> >    arch/powerpc/kernel/stacktrace.c: In function 'handle_backtrace_ipi':
> > >> arch/powerpc/kernel/stacktrace.c:171:9: error: implicit declaration of function 'nmi_cpu_backtrace' [-Werror=implicit-function-declaration]
> >      171 |         nmi_cpu_backtrace(regs);
> >          |         ^~~~~~~~~~~~~~~~~
> >    arch/powerpc/kernel/stacktrace.c: At top level:
> >    arch/powerpc/kernel/stacktrace.c:224:6: warning: no previous prototype for 'arch_trigger_cpumask_backtrace' [-Wmissing-prototypes]
> >      224 | void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self)
> >          |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    arch/powerpc/kernel/stacktrace.c: In function 'arch_trigger_cpumask_backtrace':
> > >> arch/powerpc/kernel/stacktrace.c:226:9: error: implicit declaration of function 'nmi_trigger_cpumask_backtrace'; did you mean 'arch_trigger_cpumask_backtrace'? [-Werror=implicit-function-declaration]
> >      226 |         nmi_trigger_cpumask_backtrace(mask, exclude_self, raise_backtrace_ipi);
> >          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >          |         arch_trigger_cpumask_backtrace
> >    cc1: some warnings being treated as errors
> 
> I suppose this ought to cure things...
> 
> diff --git a/arch/powerpc/kernel/stacktrace.c b/arch/powerpc/kernel/stacktrace.c
> index a2443d61728e..bde1aaedeb72 100644
> --- a/arch/powerpc/kernel/stacktrace.c
> +++ b/arch/powerpc/kernel/stacktrace.c
> @@ -165,7 +165,7 @@ int __no_sanitize_address arch_stack_walk_reliable(stack_trace_consume_fn consum
>  	return 0;
>  }
>  
> -#if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_NMI_IPI)
> +#if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_NMI_IPI) && defined(CONFIG_STACKTRACE)
>  static void handle_backtrace_ipi(struct pt_regs *regs)
>  {
>  	nmi_cpu_backtrace(regs);

Hmm...

In include/linux/nmi.h we have:

| #ifdef arch_trigger_cpumask_backtrace
| ...
| bool nmi_cpu_backtrace(struct pt_regs *regs);
| #else
| ...
| #endif 

... and in lib/nmi_backtrace.c we have:

| #ifdef arch_trigger_cpumask_backtrace
| ...
| bool nmi_cpu_backtrace(struct pt_regs *regs)
| {
|    ...
| }
| ...
| #endif 

In arch/powerpc/include/asm/nmi.h we have:

| #if defined(CONFIG_NMI_IPI) && defined(CONFIG_STACKTRACE)
| extern void arch_trigger_cpumask_backtrace(const cpumask_t *mask,
|                                            bool exclude_self);
| #define arch_trigger_cpumask_backtrace arch_trigger_cpumask_backtrace
| #endif

Either it's sufficient to check only CONFIG_NMI_IPI &&
CONFIG_STACKTRACE, or there's a latent bug when CONFIG_NMI_IPI &&
CONFIG_STACKTRACE && !CONFIG_PPC_BOOK3S_64.

For consistency with teh other ifedeffery I reckon this should be:

| #if defined(CONFIG_NMI_IPI) && defined(CONFIG_STACKTRACE)

... and we need to adjust the comment for hte #endif, too.

Otherwise, this makes sense to me -- did you plan to send this as a
patch, or did you want someone else to spin one?

Thanks,
Mark.

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

end of thread, other threads:[~2022-01-17 13:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 22:13 arch/powerpc/kernel/stacktrace.c:171:9: error: implicit declaration of function 'nmi_cpu_backtrace' kernel test robot
2022-01-14  8:37 ` Peter Zijlstra
2022-01-17 13:58   ` Mark Rutland

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).