Subject: Re: [PATCH v1 23/55] KVM: PPC: Book3S HV P9: Reduce mtmsrd instructions required to save host SPRs

From: kernel test robot <[email-masked]>
Date: Mon, 26 Jul 2021 14:57:26 +0800

Hi Nicholas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.14-rc3 next-20210723]
[cannot apply to powerpc/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Nicholas-Piggin/KVM-PPC-Book3S-HV-P9-entry-exit-optimisations/20210726-115329
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ff1176468d368232b684f75e82563369208bc371
config: powerpc-randconfig-r022-20210726 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project c63dbd850182797bc4b76124d08e1c320ab2365d)
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 powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # https://github.com/0day-ci/linux/commit/d173e4690cf13578686dbbce48e1f81e925b96af
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Nicholas-Piggin/KVM-PPC-Book3S-HV-P9-entry-exit-optimisations/20210726-115329
        git checkout d173e4690cf13578686dbbce48e1f81e925b96af
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc 

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

All warnings (new ones prefixed by >>):

   arch/powerpc/kernel/process.c:612:33: error: no member named 'tm_tfhar' in 'struct thread_struct'
                   current->thread.tm_tfhar = mfspr(SPRN_TFHAR);
                   ~~~~~~~~~~~~~~~ ^
   arch/powerpc/kernel/process.c:613:33: error: no member named 'tm_tfiar' in 'struct thread_struct'
                   current->thread.tm_tfiar = mfspr(SPRN_TFIAR);
                   ~~~~~~~~~~~~~~~ ^
   arch/powerpc/kernel/process.c:614:33: error: no member named 'tm_texasr' in 'struct thread_struct'
                   current->thread.tm_texasr = mfspr(SPRN_TEXASR);
                   ~~~~~~~~~~~~~~~ ^
>> arch/powerpc/kernel/process.c:596:6: warning: no previous prototype for function 'save_user_regs_kvm' [-Wmissing-prototypes]
   void save_user_regs_kvm(void)
        ^
   arch/powerpc/kernel/process.c:596:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void save_user_regs_kvm(void)
   ^
   static 
>> arch/powerpc/kernel/process.c:611:16: warning: shift count >= width of type [-Wshift-count-overflow]
           if (usermsr & MSR_TM) {
                         ^~~~~~
   arch/powerpc/include/asm/reg.h:115:17: note: expanded from macro 'MSR_TM'
   #define MSR_TM          __MASK(MSR_TM_LG)       /* Transactional Mem Available */
                           ^~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/reg.h:66:23: note: expanded from macro '__MASK'
   #define __MASK(X)       (1UL<<(X))
                               ^ ~~~
   arch/powerpc/kernel/process.c:615:47: warning: shift count >= width of type [-Wshift-count-overflow]
                   current->thread.regs->msr &= ~MSR_TM;
                                                 ^~~~~~
   arch/powerpc/include/asm/reg.h:115:17: note: expanded from macro 'MSR_TM'
   #define MSR_TM          __MASK(MSR_TM_LG)       /* Transactional Mem Available */
                           ^~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/reg.h:66:23: note: expanded from macro '__MASK'
   #define __MASK(X)       (1UL<<(X))
                               ^ ~~~
   3 warnings and 3 errors generated.

vim +/save_user_regs_kvm +596 arch/powerpc/kernel/process.c

   595	
 > 596	void save_user_regs_kvm(void)
   597	{
   598		unsigned long usermsr;
   599	
   600		if (!current->thread.regs)
   601			return;
   602	
   603		usermsr = current->thread.regs->msr;
   604	
   605		if (usermsr & MSR_FP)
   606			save_fpu(current);
   607	
   608		if (usermsr & MSR_VEC)
   609			save_altivec(current);
   610	
 > 611		if (usermsr & MSR_TM) {
   612	                current->thread.tm_tfhar = mfspr(SPRN_TFHAR);
   613	                current->thread.tm_tfiar = mfspr(SPRN_TFIAR);
   614	                current->thread.tm_texasr = mfspr(SPRN_TEXASR);
   615	                current->thread.regs->msr &= ~MSR_TM;
   616		}
   617	}
   618	EXPORT_SYMBOL_GPL(save_user_regs_kvm);
   619	

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