CC: [email protected]
CC: [email protected]
TO: Max Filippov <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   8ab774587903771821b59471cc723bba6d893942
commit: 0b5372570b1f3fcb35255d28e707846e613c27f2 xtensa: implement call0 ABI 
support in assembly
date:   4 weeks ago
:::::: branch date: 2 days ago
:::::: commit date: 4 weeks ago
config: xtensa-randconfig-s032-20211116 (attached as .config)
compiler: xtensa-linux-gcc (GCC) 11.2.0
reproduce:
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0b5372570b1f3fcb35255d28e707846e613c27f2
        git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 0b5372570b1f3fcb35255d28e707846e613c27f2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=xtensa 
SHELL=/bin/bash arch/xtensa/kernel/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


sparse warnings: (new ones prefixed by >>)
   arch/xtensa/kernel/process.c: note: in included file (through 
arch/xtensa/include/asm/thread_info.h, arch/xtensa/include/asm/current.h, 
include/linux/sched.h):
   arch/xtensa/include/asm/processor.h:107:2: sparse: sparse: Unsupported 
xtensa ABI
   arch/xtensa/include/asm/processor.h:137:2: sparse: sparse: Unsupported 
Xtensa ABI
>> arch/xtensa/kernel/process.c:224:2: sparse: sparse: Unsupported Xtensa ABI
   arch/xtensa/kernel/process.c:299:2: sparse: sparse: Unsupported Xtensa ABI
   arch/xtensa/kernel/process.c:232:32: sparse: sparse: undefined identifier 
'MAKE_RA_FOR_CALL'
   arch/xtensa/kernel/process.c:279:32: sparse: sparse: undefined identifier 
'MAKE_RA_FOR_CALL'
   arch/xtensa/kernel/process.c:332:14: sparse: sparse: undefined identifier 
'MAKE_PC_FROM_RA'
   arch/xtensa/kernel/process.c:344:22: sparse: sparse: undefined identifier 
'MAKE_PC_FROM_RA'

vim +224 arch/xtensa/kernel/process.c

39070cb8a39a84 Chris Zankel     2012-10-17  213  
0b5372570b1f3f Max Filippov     2021-05-01  214  #if 
defined(__XTENSA_WINDOWED_ABI__)
5a0015d62668e6 Chris Zankel     2005-06-23  215         /* Create a call4 
dummy-frame: a0 = 0, a1 = childregs. */
062b1c19b879e7 Max Filippov     2015-01-27  216         SPILL_SLOT(childregs, 
1) = (unsigned long)childregs;
062b1c19b879e7 Max Filippov     2015-01-27  217         SPILL_SLOT(childregs, 
0) = 0;
5a0015d62668e6 Chris Zankel     2005-06-23  218  
5a0015d62668e6 Chris Zankel     2005-06-23  219         p->thread.sp = 
(unsigned long)childregs;
0b5372570b1f3f Max Filippov     2021-05-01  220  #elif 
defined(__XTENSA_CALL0_ABI__)
0b5372570b1f3f Max Filippov     2021-05-01  221         /* Reserve 16 bytes for 
the _switch_to stack frame. */
0b5372570b1f3f Max Filippov     2021-05-01  222         p->thread.sp = 
(unsigned long)childregs - 16;
0b5372570b1f3f Max Filippov     2021-05-01  223  #else
0b5372570b1f3f Max Filippov     2021-05-01 @224  #error Unsupported Xtensa ABI
0b5372570b1f3f Max Filippov     2021-05-01  225  #endif
c658eac628aa8d Chris Zankel     2008-02-12  226  
4727dc20e04222 Jens Axboe       2021-02-17  227         if (!(p->flags & 
(PF_KTHREAD | PF_IO_WORKER))) {
3306a72669a2af Max Filippov     2012-10-25  228                 struct pt_regs 
*regs = current_pt_regs();
3306a72669a2af Max Filippov     2012-10-25  229                 unsigned long 
usp = usp_thread_fn ?
3306a72669a2af Max Filippov     2012-10-25  230                         
usp_thread_fn : regs->areg[1];
5a0015d62668e6 Chris Zankel     2005-06-23  231  
3306a72669a2af Max Filippov     2012-10-25  232                 p->thread.ra = 
MAKE_RA_FOR_CALL(
3306a72669a2af Max Filippov     2012-10-25  233                                 
(unsigned long)ret_from_fork, 0x1);
3306a72669a2af Max Filippov     2012-10-25  234  
3306a72669a2af Max Filippov     2012-10-25  235                 /* This does 
not copy all the regs.
3306a72669a2af Max Filippov     2012-10-25  236                  * In a bout of 
brilliance or madness,
3306a72669a2af Max Filippov     2012-10-25  237                  * ARs beyond 
a0-a15 exist past the end of the struct.
3306a72669a2af Max Filippov     2012-10-25  238                  */
3306a72669a2af Max Filippov     2012-10-25  239                 *childregs = 
*regs;
5a0015d62668e6 Chris Zankel     2005-06-23  240                 
childregs->areg[1] = usp;
3306a72669a2af Max Filippov     2012-10-25  241                 
childregs->areg[2] = 0;
6ebe7da25b7879 Chris Zankel     2012-10-24  242  
6ebe7da25b7879 Chris Zankel     2012-10-24  243                 /* When sharing 
memory with the parent thread, the child
6ebe7da25b7879 Chris Zankel     2012-10-24  244                    usually 
starts on a pristine stack, so we have to reset
6ebe7da25b7879 Chris Zankel     2012-10-24  245                    windowbase, 
windowstart and wmask.
6ebe7da25b7879 Chris Zankel     2012-10-24  246                    (Note that 
such a new thread is required to always create
6ebe7da25b7879 Chris Zankel     2012-10-24  247                    an initial 
call4 frame)
6ebe7da25b7879 Chris Zankel     2012-10-24  248                    The 
exception is vfork, where the new thread continues to
6ebe7da25b7879 Chris Zankel     2012-10-24  249                    run on the 
parent's stack until it calls execve. This could
6ebe7da25b7879 Chris Zankel     2012-10-24  250                    be a call8 
or call12, which requires a legal stack frame
6ebe7da25b7879 Chris Zankel     2012-10-24  251                    of the 
previous caller for the overflow handlers to work.
6ebe7da25b7879 Chris Zankel     2012-10-24  252                    (Note that 
it's always legal to overflow live registers).
6ebe7da25b7879 Chris Zankel     2012-10-24  253                    In this 
case, ensure to spill at least the stack pointer
6ebe7da25b7879 Chris Zankel     2012-10-24  254                    of that 
frame. */
6ebe7da25b7879 Chris Zankel     2012-10-24  255  
84ed30538b5d9a Marc Gauthier    2012-10-15  256                 if (clone_flags 
& CLONE_VM) {
6ebe7da25b7879 Chris Zankel     2012-10-24  257                         /* 
check that caller window is live and same stack */
6ebe7da25b7879 Chris Zankel     2012-10-24  258                         int len 
= childregs->wmask & ~0xf;
6ebe7da25b7879 Chris Zankel     2012-10-24  259                         if 
(regs->areg[1] == usp && len != 0) {
6ebe7da25b7879 Chris Zankel     2012-10-24  260                                 
int callinc = (regs->areg[0] >> 30) & 3;
6ebe7da25b7879 Chris Zankel     2012-10-24  261                                 
int caller_ars = XCHAL_NUM_AREGS - callinc * 4;
6ebe7da25b7879 Chris Zankel     2012-10-24  262                                 
put_user(regs->areg[caller_ars+1],
6ebe7da25b7879 Chris Zankel     2012-10-24  263                                 
         (unsigned __user*)(usp - 12));
6ebe7da25b7879 Chris Zankel     2012-10-24  264                         }
6ebe7da25b7879 Chris Zankel     2012-10-24  265                         
childregs->wmask = 1;
6ebe7da25b7879 Chris Zankel     2012-10-24  266                         
childregs->windowstart = 1;
6ebe7da25b7879 Chris Zankel     2012-10-24  267                         
childregs->windowbase = 0;
84ed30538b5d9a Marc Gauthier    2012-10-15  268                 } else {
84ed30538b5d9a Marc Gauthier    2012-10-15  269                         int len 
= childregs->wmask & ~0xf;
5a0015d62668e6 Chris Zankel     2005-06-23  270                         
memcpy(&childregs->areg[XCHAL_NUM_AREGS - len/4],
5a0015d62668e6 Chris Zankel     2005-06-23  271                                
&regs->areg[XCHAL_NUM_AREGS - len/4], len);
84ed30538b5d9a Marc Gauthier    2012-10-15  272                 }
c50842df47970e Chris Zankel     2013-02-23  273  
ba9c1d65991a8b Max Filippov     2019-11-25  274                 
childregs->syscall = regs->syscall;
ba9c1d65991a8b Max Filippov     2019-11-25  275  
5a0015d62668e6 Chris Zankel     2005-06-23  276                 if (clone_flags 
& CLONE_SETTLS)
c346b94f8c5d1b Amanieu d'Antras 2020-01-02  277                         
childregs->threadptr = tls;
5a0015d62668e6 Chris Zankel     2005-06-23  278         } else {
3306a72669a2af Max Filippov     2012-10-25  279                 p->thread.ra = 
MAKE_RA_FOR_CALL(
3306a72669a2af Max Filippov     2012-10-25  280                                 
(unsigned long)ret_from_kernel_thread, 1);
3306a72669a2af Max Filippov     2012-10-25  281  
0b5372570b1f3f Max Filippov     2021-05-01  282                 /* pass 
parameters to ret_from_kernel_thread: */
0b5372570b1f3f Max Filippov     2021-05-01  283  #if 
defined(__XTENSA_WINDOWED_ABI__)
0b5372570b1f3f Max Filippov     2021-05-01  284                 /*
0b5372570b1f3f Max Filippov     2021-05-01  285                  * a2 = 
thread_fn, a3 = thread_fn arg.
0b5372570b1f3f Max Filippov     2021-05-01  286                  * Window 
underflow will load registers from the
0b5372570b1f3f Max Filippov     2021-05-01  287                  * spill slots 
on the stack on return from _switch_to.
3306a72669a2af Max Filippov     2012-10-25  288                  */
062b1c19b879e7 Max Filippov     2015-01-27  289                 
SPILL_SLOT(childregs, 2) = usp_thread_fn;
0b5372570b1f3f Max Filippov     2021-05-01  290                 
SPILL_SLOT(childregs, 3) = thread_fn_arg;
0b5372570b1f3f Max Filippov     2021-05-01  291  #elif 
defined(__XTENSA_CALL0_ABI__)
0b5372570b1f3f Max Filippov     2021-05-01  292                 /*
0b5372570b1f3f Max Filippov     2021-05-01  293                  * a12 = 
thread_fn, a13 = thread_fn arg.
0b5372570b1f3f Max Filippov     2021-05-01  294                  * _switch_to 
epilogue will load registers from the stack.
0b5372570b1f3f Max Filippov     2021-05-01  295                  */
0b5372570b1f3f Max Filippov     2021-05-01  296                 ((unsigned long 
*)p->thread.sp)[0] = usp_thread_fn;
0b5372570b1f3f Max Filippov     2021-05-01  297                 ((unsigned long 
*)p->thread.sp)[1] = thread_fn_arg;
0b5372570b1f3f Max Filippov     2021-05-01  298  #else
0b5372570b1f3f Max Filippov     2021-05-01  299  #error Unsupported Xtensa ABI
0b5372570b1f3f Max Filippov     2021-05-01  300  #endif
3306a72669a2af Max Filippov     2012-10-25  301  
3306a72669a2af Max Filippov     2012-10-25  302                 /* Childregs 
are only used when we're going to userspace
3306a72669a2af Max Filippov     2012-10-25  303                  * in which 
case start_thread will set them up.
3306a72669a2af Max Filippov     2012-10-25  304                  */
5a0015d62668e6 Chris Zankel     2005-06-23  305         }
c658eac628aa8d Chris Zankel     2008-02-12  306  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to