All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [mips-linux:mips-next 52/55] arch/mips/kernel/process.c:510:23: warning: no previous prototype for 'unwind_stack_by_address'
Date: Fri, 29 Jan 2021 21:13:00 +0800	[thread overview]
Message-ID: <202101292153.PgNSc9a2-lkp@intel.com> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git mips-next
head:   50886234e846bbf2cbf14a86c727e5fc309fdf25
commit: fa85d6ac2c2511fa4afc671f0a8f307105ce7604 [52/55] MIPS: process: Remove unnecessary headers inclusion
config: mips-randconfig-r023-20210129 (attached as .config)
compiler: mips-linux-gcc (GCC) 9.3.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/mips/linux.git/commit/?id=fa85d6ac2c2511fa4afc671f0a8f307105ce7604
        git remote add mips-linux https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git
        git fetch --no-tags mips-linux mips-next
        git checkout fa85d6ac2c2511fa4afc671f0a8f307105ce7604
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips 

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/mips/kernel/process.c:510:23: warning: no previous prototype for 'unwind_stack_by_address' [-Wmissing-prototypes]
     510 | unsigned long notrace unwind_stack_by_address(unsigned long stack_page,
         |                       ^~~~~~~~~~~~~~~~~~~~~~~
>> arch/mips/kernel/process.c:602:15: warning: no previous prototype for 'unwind_stack' [-Wmissing-prototypes]
     602 | unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
         |               ^~~~~~~~~~~~
   arch/mips/kernel/process.c:680:15: warning: no previous prototype for 'arch_align_stack' [-Wmissing-prototypes]
     680 | unsigned long arch_align_stack(unsigned long sp)
         |               ^~~~~~~~~~~~~~~~


vim +/unwind_stack_by_address +510 arch/mips/kernel/process.c

^1da177e4c3f41 Linus Torvalds  2005-04-16  506  
^1da177e4c3f41 Linus Torvalds  2005-04-16  507  
f66686f70a2a61 Atsushi Nemoto  2006-07-29  508  #ifdef CONFIG_KALLSYMS
94ea09c6a8e6c5 Daniel Kalmar   2011-05-13  509  /* generic stack unwinding function */
94ea09c6a8e6c5 Daniel Kalmar   2011-05-13 @510  unsigned long notrace unwind_stack_by_address(unsigned long stack_page,
94ea09c6a8e6c5 Daniel Kalmar   2011-05-13  511  					      unsigned long *sp,
94ea09c6a8e6c5 Daniel Kalmar   2011-05-13  512  					      unsigned long pc,
94ea09c6a8e6c5 Daniel Kalmar   2011-05-13  513  					      unsigned long *ra)
f66686f70a2a61 Atsushi Nemoto  2006-07-29  514  {
db8466c581cca1 Matt Redfearn   2017-03-21  515  	unsigned long low, high, irq_stack_high;
f66686f70a2a61 Atsushi Nemoto  2006-07-29  516  	struct mips_frame_info info;
f66686f70a2a61 Atsushi Nemoto  2006-07-29  517  	unsigned long size, ofs;
db8466c581cca1 Matt Redfearn   2017-03-21  518  	struct pt_regs *regs;
4d157d5eac29d7 Franck Bui-Huu  2006-08-03  519  	int leaf;
f66686f70a2a61 Atsushi Nemoto  2006-07-29  520  
f66686f70a2a61 Atsushi Nemoto  2006-07-29  521  	if (!stack_page)
f66686f70a2a61 Atsushi Nemoto  2006-07-29  522  		return 0;
f66686f70a2a61 Atsushi Nemoto  2006-07-29  523  
1924600cdb3143 Atsushi Nemoto  2006-09-29  524  	/*
db8466c581cca1 Matt Redfearn   2017-03-21  525  	 * IRQ stacks start at IRQ_STACK_START
db8466c581cca1 Matt Redfearn   2017-03-21  526  	 * task stacks at THREAD_SIZE - 32
1924600cdb3143 Atsushi Nemoto  2006-09-29  527  	 */
db8466c581cca1 Matt Redfearn   2017-03-21  528  	low = stack_page;
db8466c581cca1 Matt Redfearn   2017-03-21  529  	if (!preemptible() && on_irq_stack(raw_smp_processor_id(), *sp)) {
db8466c581cca1 Matt Redfearn   2017-03-21  530  		high = stack_page + IRQ_STACK_START;
db8466c581cca1 Matt Redfearn   2017-03-21  531  		irq_stack_high = high;
db8466c581cca1 Matt Redfearn   2017-03-21  532  	} else {
db8466c581cca1 Matt Redfearn   2017-03-21  533  		high = stack_page + THREAD_SIZE - 32;
db8466c581cca1 Matt Redfearn   2017-03-21  534  		irq_stack_high = 0;
db8466c581cca1 Matt Redfearn   2017-03-21  535  	}
db8466c581cca1 Matt Redfearn   2017-03-21  536  
db8466c581cca1 Matt Redfearn   2017-03-21  537  	/*
db8466c581cca1 Matt Redfearn   2017-03-21  538  	 * If we reached the top of the interrupt stack, start unwinding
db8466c581cca1 Matt Redfearn   2017-03-21  539  	 * the interrupted task stack.
db8466c581cca1 Matt Redfearn   2017-03-21  540  	 */
db8466c581cca1 Matt Redfearn   2017-03-21  541  	if (unlikely(*sp == irq_stack_high)) {
db8466c581cca1 Matt Redfearn   2017-03-21  542  		unsigned long task_sp = *(unsigned long *)*sp;
db8466c581cca1 Matt Redfearn   2017-03-21  543  
db8466c581cca1 Matt Redfearn   2017-03-21  544  		/*
db8466c581cca1 Matt Redfearn   2017-03-21  545  		 * Check that the pointer saved in the IRQ stack head points to
db8466c581cca1 Matt Redfearn   2017-03-21  546  		 * something within the stack of the current task
db8466c581cca1 Matt Redfearn   2017-03-21  547  		 */
db8466c581cca1 Matt Redfearn   2017-03-21  548  		if (!object_is_on_stack((void *)task_sp))
db8466c581cca1 Matt Redfearn   2017-03-21  549  			return 0;
db8466c581cca1 Matt Redfearn   2017-03-21  550  
db8466c581cca1 Matt Redfearn   2017-03-21  551  		/*
db8466c581cca1 Matt Redfearn   2017-03-21  552  		 * Follow pointer to tasks kernel stack frame where interrupted
db8466c581cca1 Matt Redfearn   2017-03-21  553  		 * state was saved.
db8466c581cca1 Matt Redfearn   2017-03-21  554  		 */
db8466c581cca1 Matt Redfearn   2017-03-21  555  		regs = (struct pt_regs *)task_sp;
1924600cdb3143 Atsushi Nemoto  2006-09-29  556  		pc = regs->cp0_epc;
a816b306c62195 James Hogan     2015-12-04  557  		if (!user_mode(regs) && __kernel_text_address(pc)) {
1924600cdb3143 Atsushi Nemoto  2006-09-29  558  			*sp = regs->regs[29];
1924600cdb3143 Atsushi Nemoto  2006-09-29  559  			*ra = regs->regs[31];
1924600cdb3143 Atsushi Nemoto  2006-09-29  560  			return pc;
1924600cdb3143 Atsushi Nemoto  2006-09-29  561  		}
1924600cdb3143 Atsushi Nemoto  2006-09-29  562  		return 0;
1924600cdb3143 Atsushi Nemoto  2006-09-29  563  	}
55b7428303d390 Franck Bui-Huu  2006-10-13  564  	if (!kallsyms_lookup_size_offset(pc, &size, &ofs))
f66686f70a2a61 Atsushi Nemoto  2006-07-29  565  		return 0;
1fd6909802b837 Franck Bui-Huu  2006-08-18  566  	/*
25985edcedea63 Lucas De Marchi 2011-03-30  567  	 * Return ra if an exception occurred at the first instruction
1fd6909802b837 Franck Bui-Huu  2006-08-18  568  	 */
1924600cdb3143 Atsushi Nemoto  2006-09-29  569  	if (unlikely(ofs == 0)) {
1924600cdb3143 Atsushi Nemoto  2006-09-29  570  		pc = *ra;
1924600cdb3143 Atsushi Nemoto  2006-09-29  571  		*ra = 0;
1924600cdb3143 Atsushi Nemoto  2006-09-29  572  		return pc;
1924600cdb3143 Atsushi Nemoto  2006-09-29  573  	}
f66686f70a2a61 Atsushi Nemoto  2006-07-29  574  
f66686f70a2a61 Atsushi Nemoto  2006-07-29  575  	info.func = (void *)(pc - ofs);
f66686f70a2a61 Atsushi Nemoto  2006-07-29  576  	info.func_size = ofs;	/* analyze from start to ofs */
4d157d5eac29d7 Franck Bui-Huu  2006-08-03  577  	leaf = get_frame_info(&info);
4d157d5eac29d7 Franck Bui-Huu  2006-08-03  578  	if (leaf < 0)
f66686f70a2a61 Atsushi Nemoto  2006-07-29  579  		return 0;
4d157d5eac29d7 Franck Bui-Huu  2006-08-03  580  
db8466c581cca1 Matt Redfearn   2017-03-21  581  	if (*sp < low || *sp + info.frame_size > high)
f66686f70a2a61 Atsushi Nemoto  2006-07-29  582  		return 0;
f66686f70a2a61 Atsushi Nemoto  2006-07-29  583  
4d157d5eac29d7 Franck Bui-Huu  2006-08-03  584  	if (leaf)
4d157d5eac29d7 Franck Bui-Huu  2006-08-03  585  		/*
4d157d5eac29d7 Franck Bui-Huu  2006-08-03  586  		 * For some extreme cases, get_frame_info() can
4d157d5eac29d7 Franck Bui-Huu  2006-08-03  587  		 * consider wrongly a nested function as a leaf
4d157d5eac29d7 Franck Bui-Huu  2006-08-03  588  		 * one. In that cases avoid to return always the
4d157d5eac29d7 Franck Bui-Huu  2006-08-03  589  		 * same value.
4d157d5eac29d7 Franck Bui-Huu  2006-08-03  590  		 */
1924600cdb3143 Atsushi Nemoto  2006-09-29  591  		pc = pc != *ra ? *ra : 0;
4d157d5eac29d7 Franck Bui-Huu  2006-08-03  592  	else
4d157d5eac29d7 Franck Bui-Huu  2006-08-03  593  		pc = ((unsigned long *)(*sp))[info.pc_offset];
4d157d5eac29d7 Franck Bui-Huu  2006-08-03  594  
4d157d5eac29d7 Franck Bui-Huu  2006-08-03  595  	*sp += info.frame_size;
1924600cdb3143 Atsushi Nemoto  2006-09-29  596  	*ra = 0;
4d157d5eac29d7 Franck Bui-Huu  2006-08-03  597  	return __kernel_text_address(pc) ? pc : 0;
f66686f70a2a61 Atsushi Nemoto  2006-07-29  598  }
94ea09c6a8e6c5 Daniel Kalmar   2011-05-13  599  EXPORT_SYMBOL(unwind_stack_by_address);
94ea09c6a8e6c5 Daniel Kalmar   2011-05-13  600  
94ea09c6a8e6c5 Daniel Kalmar   2011-05-13  601  /* used by show_backtrace() */
94ea09c6a8e6c5 Daniel Kalmar   2011-05-13 @602  unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
94ea09c6a8e6c5 Daniel Kalmar   2011-05-13  603  			   unsigned long pc, unsigned long *ra)
94ea09c6a8e6c5 Daniel Kalmar   2011-05-13  604  {
d42d8d106b0275 Matt Redfearn   2016-12-19  605  	unsigned long stack_page = 0;
d42d8d106b0275 Matt Redfearn   2016-12-19  606  	int cpu;
d42d8d106b0275 Matt Redfearn   2016-12-19  607  
d42d8d106b0275 Matt Redfearn   2016-12-19  608  	for_each_possible_cpu(cpu) {
d42d8d106b0275 Matt Redfearn   2016-12-19  609  		if (on_irq_stack(cpu, *sp)) {
d42d8d106b0275 Matt Redfearn   2016-12-19  610  			stack_page = (unsigned long)irq_stack[cpu];
d42d8d106b0275 Matt Redfearn   2016-12-19  611  			break;
d42d8d106b0275 Matt Redfearn   2016-12-19  612  		}
d42d8d106b0275 Matt Redfearn   2016-12-19  613  	}
d42d8d106b0275 Matt Redfearn   2016-12-19  614  
d42d8d106b0275 Matt Redfearn   2016-12-19  615  	if (!stack_page)
d42d8d106b0275 Matt Redfearn   2016-12-19  616  		stack_page = (unsigned long)task_stack_page(task);
d42d8d106b0275 Matt Redfearn   2016-12-19  617  
94ea09c6a8e6c5 Daniel Kalmar   2011-05-13  618  	return unwind_stack_by_address(stack_page, sp, pc, ra);
94ea09c6a8e6c5 Daniel Kalmar   2011-05-13  619  }
f66686f70a2a61 Atsushi Nemoto  2006-07-29  620  #endif
b5943182592ba2 Franck Bui-Huu  2006-08-18  621  

:::::: The code at line 510 was first introduced by commit
:::::: 94ea09c6a8e6c5ffb59bb1d5ca10008d37544e1a MIPS: Add new unwind_stack variant

:::::: TO: Daniel Kalmar <kalmard@homejinni.com>
:::::: CC: Robert Richter <robert.richter@amd.com>

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 26753 bytes --]

                 reply	other threads:[~2021-01-29 13:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202101292153.PgNSc9a2-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.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 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.