mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* arch/powerpc/include/asm/entry-common.h:450:15: warning: shift count >= width of type
@ 2026-11-25 19:50 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-11-25 19:50 UTC (permalink / raw)
  To: Mukesh Kumar Chaurasiya
  Cc: oe-kbuild-all, linux-kernel, Madhavan Srinivasan, Shrikanth Hegde

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4dce97c6c265544342e716e62fd24bbb232590c5
commit: bee25f97ad24641df55cb3887eb5bfcb2b9d8fbc powerpc: Enable GENERIC_ENTRY feature
date:   6 months ago
config: powerpc-randconfig-r2303-20261125 (https://download.01.org/0day-ci/archive/20261125/20261125204519.K0a0uXVo-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project a2bea097c8bf336f31f45e88e96f20d88e37ff5a)
sparse: v0.6.5-rc1-21-g84ec0658
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261125/20261125204519.K0a0uXVo-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: bee25f97ad24 ("powerpc: Enable GENERIC_ENTRY feature")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261125204519.K0a0uXVo-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from arch/powerpc/xmon/xmon.c:54:
   In file included from arch/powerpc/include/asm/interrupt.h:70:
   In file included from include/linux/irq-entry-common.h:14:
>> arch/powerpc/include/asm/entry-common.h:450:15: warning: shift count >= width of type [-Wshift-count-overflow]
     450 |             unlikely(MSR_TM_TRANSACTIONAL(regs->msr)))
         |             ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/reg.h:121:41: note: expanded from macro 'MSR_TM_TRANSACTIONAL'
     121 | #define MSR_TM_TRANSACTIONAL(x) (((x) & MSR_TS_MASK) == MSR_TS_T)
         |                                         ^
   arch/powerpc/include/asm/reg.h:119:22: note: expanded from macro 'MSR_TS_MASK'
     119 | #define MSR_TS_MASK     (MSR_TS_T | MSR_TS_S)   /* Transaction State bits */
         |                          ^
   arch/powerpc/include/asm/reg.h:118:18: note: expanded from macro 'MSR_TS_T'
     118 | #define MSR_TS_T        __MASK(MSR_TS_T_LG)     /*  Transaction Transactional */
         |                         ^
   arch/powerpc/include/asm/reg.h:66:23: note: expanded from macro '__MASK'
      66 | #define __MASK(X)       (1UL<<(X))
         |                             ^
   include/linux/compiler.h:47:68: note: expanded from macro 'unlikely'
      47 | #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
         |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   include/linux/compiler.h:34:19: note: expanded from macro '__branch_check__'
      34 |                                              expect, is_constant);      \
         |                                                      ^~~~~~~~~~~
   In file included from arch/powerpc/xmon/xmon.c:54:
   In file included from arch/powerpc/include/asm/interrupt.h:70:
   In file included from include/linux/irq-entry-common.h:14:
>> arch/powerpc/include/asm/entry-common.h:450:15: warning: shift count >= width of type [-Wshift-count-overflow]
     450 |             unlikely(MSR_TM_TRANSACTIONAL(regs->msr)))
         |             ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/reg.h:121:41: note: expanded from macro 'MSR_TM_TRANSACTIONAL'
     121 | #define MSR_TM_TRANSACTIONAL(x) (((x) & MSR_TS_MASK) == MSR_TS_T)
         |                                         ^
   arch/powerpc/include/asm/reg.h:119:33: note: expanded from macro 'MSR_TS_MASK'
     119 | #define MSR_TS_MASK     (MSR_TS_T | MSR_TS_S)   /* Transaction State bits */
         |                                     ^
   arch/powerpc/include/asm/reg.h:117:18: note: expanded from macro 'MSR_TS_S'
     117 | #define MSR_TS_S        __MASK(MSR_TS_S_LG)     /*  Transaction Suspended */
         |                         ^
   arch/powerpc/include/asm/reg.h:66:23: note: expanded from macro '__MASK'
      66 | #define __MASK(X)       (1UL<<(X))
         |                             ^
   include/linux/compiler.h:47:68: note: expanded from macro 'unlikely'
      47 | #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
         |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   include/linux/compiler.h:34:19: note: expanded from macro '__branch_check__'
      34 |                                              expect, is_constant);      \
         |                                                      ^~~~~~~~~~~
   In file included from arch/powerpc/xmon/xmon.c:54:
   In file included from arch/powerpc/include/asm/interrupt.h:70:
   In file included from include/linux/irq-entry-common.h:14:
>> arch/powerpc/include/asm/entry-common.h:450:15: warning: shift count >= width of type [-Wshift-count-overflow]
     450 |             unlikely(MSR_TM_TRANSACTIONAL(regs->msr)))
         |             ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/reg.h:121:57: note: expanded from macro 'MSR_TM_TRANSACTIONAL'
     121 | #define MSR_TM_TRANSACTIONAL(x) (((x) & MSR_TS_MASK) == MSR_TS_T)
         |                                                         ^
   arch/powerpc/include/asm/reg.h:118:18: note: expanded from macro 'MSR_TS_T'
     118 | #define MSR_TS_T        __MASK(MSR_TS_T_LG)     /*  Transaction Transactional */
         |                         ^
   arch/powerpc/include/asm/reg.h:66:23: note: expanded from macro '__MASK'
      66 | #define __MASK(X)       (1UL<<(X))
         |                             ^
   include/linux/compiler.h:47:68: note: expanded from macro 'unlikely'
      47 | #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
         |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   include/linux/compiler.h:34:19: note: expanded from macro '__branch_check__'
      34 |                                              expect, is_constant);      \
         |                                                      ^~~~~~~~~~~
   arch/powerpc/xmon/xmon.c:3262:3: warning: unsequenced accesses to volatile qualified 'tsk' [-Wunsequenced-volatile]
    3261 |         printf("%16px %16lx %16px %6d %6d %c %2d %s\n", tsk,
         |                                                         ~~~
    3262 |                 tsk->thread.ksp, tsk->thread.regs,
         |                 ^
   4 warnings generated.


vim +450 arch/powerpc/include/asm/entry-common.h

893082ac769ba9 Mukesh Kumar Chaurasiya 2026-04-27  391  
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  392  static __always_inline void arch_enter_from_user_mode(struct pt_regs *regs)
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  393  {
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  394  	kuap_lock();
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  395  
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  396  	if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG))
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  397  		BUG_ON(irq_soft_mask_return() != IRQS_ALL_DISABLED);
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  398  
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  399  	BUG_ON(regs_is_unrecoverable(regs));
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  400  	BUG_ON(!user_mode(regs));
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  401  	BUG_ON(regs_irqs_disabled(regs));
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  402  
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  403  #ifdef CONFIG_PPC_PKEY
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  404  	if (mmu_has_feature(MMU_FTR_PKEY) && trap_is_syscall(regs)) {
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  405  		unsigned long amr, iamr;
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  406  		bool flush_needed = false;
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  407  		/*
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  408  		 * When entering from userspace we mostly have the AMR/IAMR
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  409  		 * different from kernel default values. Hence don't compare.
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  410  		 */
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  411  		amr = mfspr(SPRN_AMR);
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  412  		iamr = mfspr(SPRN_IAMR);
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  413  		regs->amr  = amr;
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  414  		regs->iamr = iamr;
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  415  		if (mmu_has_feature(MMU_FTR_KUAP)) {
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  416  			mtspr(SPRN_AMR, AMR_KUAP_BLOCKED);
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  417  			flush_needed = true;
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  418  		}
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  419  		if (mmu_has_feature(MMU_FTR_BOOK3S_KUEP)) {
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  420  			mtspr(SPRN_IAMR, AMR_KUEP_BLOCKED);
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  421  			flush_needed = true;
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  422  		}
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  423  		if (flush_needed)
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  424  			isync();
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  425  	}
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  426  #endif
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  427  	kuap_assert_locked();
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  428  	booke_restore_dbcr0();
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  429  	account_cpu_user_entry();
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  430  	account_stolen_time();
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  431  
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  432  	/*
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  433  	 * This is not required for the syscall exit path, but makes the
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  434  	 * stack frame look nicer. If this was initialised in the first stack
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  435  	 * frame, or if the unwinder was taught the first stack frame always
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  436  	 * returns to user with IRQS_ENABLED, this store could be avoided!
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  437  	 */
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  438  	irq_soft_mask_regs_set_state(regs, IRQS_ENABLED);
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  439  
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  440  	/*
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  441  	 * If system call is called with TM active, set _TIF_RESTOREALL to
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  442  	 * prevent RFSCV being used to return to userspace, because POWER9
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  443  	 * TM implementation has problems with this instruction returning to
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  444  	 * transactional state. Final register values are not relevant because
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  445  	 * the transaction will be aborted upon return anyway. Or in the case
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  446  	 * of unsupported_scv SIGILL fault, the return state does not much
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  447  	 * matter because it's an edge case.
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  448  	 */
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  449  	if (IS_ENABLED(CONFIG_PPC_TRANSACTIONAL_MEM) &&
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27 @450  	    unlikely(MSR_TM_TRANSACTIONAL(regs->msr)))
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  451  		set_bits(_TIF_RESTOREALL, &current_thread_info()->flags);
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  452  
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  453  	/*
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  454  	 * If the system call was made with a transaction active, doom it and
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  455  	 * return without performing the system call. Unless it was an
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  456  	 * unsupported scv vector, in which case it's treated like an illegal
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  457  	 * instruction.
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  458  	 */
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  459  #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  460  	if (unlikely(MSR_TM_TRANSACTIONAL(regs->msr)) &&
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  461  	    !trap_is_unsupported_scv(regs)) {
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  462  		/* Enable TM in the kernel, and disable EE (for scv) */
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  463  		hard_irq_disable();
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  464  		mtmsr(mfmsr() | MSR_TM);
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  465  
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  466  		/* tabort, this dooms the transaction, nothing else */
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  467  		asm volatile(".long 0x7c00071d | ((%0) << 16)"
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  468  			     :: "r"(TM_CAUSE_SYSCALL | TM_CAUSE_PERSISTENT));
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  469  
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  470  		/*
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  471  		 * Userspace will never see the return value. Execution will
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  472  		 * resume after the tbegin. of the aborted transaction with the
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  473  		 * checkpointed register state. A context switch could occur
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  474  		 * or signal delivered to the process before resuming the
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  475  		 * doomed transaction context, but that should all be handled
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  476  		 * as expected.
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  477  		 */
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  478  		return;
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  479  	}
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  480  #endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  481  }
09a9d3a8499db6 Mukesh Kumar Chaurasiya 2026-04-27  482  

:::::: The code at line 450 was first introduced by commit
:::::: 09a9d3a8499db606563eb5e75a993419f4d1901e powerpc: introduce arch_enter_from_user_mode

:::::: TO: Mukesh Kumar Chaurasiya <mchauras@linux.ibm.com>
:::::: CC: Madhavan Srinivasan <maddy@linux.ibm.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-25 20:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 19:50 arch/powerpc/include/asm/entry-common.h:450:15: warning: shift count >= width of type kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®