Re: [PATCH v2] fix ___SYNC () build error when PROFILE_ALL_BRANCHES is enabled

From: kernel test robot
Date: Thu Apr 27 2023 - 23:21:25 EST


Hi Genjian,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.3 next-20230427]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Genjian/fix-___SYNC-build-error-when-PROFILE_ALL_BRANCHES-is-enabled/20230427-230626
base: linus/master
patch link: https://lore.kernel.org/r/20230427150332.2978867-1-zhanggenjian%40kylinos.cn
patch subject: [PATCH v2] fix ___SYNC () build error when PROFILE_ALL_BRANCHES is enabled
config: mips-randconfig-s053-20230427 (https://download.01.org/0day-ci/archive/20230428/202304281115.mEqaC6GM-lkp@xxxxxxxxx/config)
compiler: mipsel-linux-gcc (GCC) 12.1.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-39-gce1a6720-dirty
# https://github.com/intel-lab-lkp/linux/commit/6eb50851d61ca808629a062e0545704eba5be950
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Genjian/fix-___SYNC-build-error-when-PROFILE_ALL_BRANCHES-is-enabled/20230427-230626
git checkout 6eb50851d61ca808629a062e0545704eba5be950
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=mips olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=mips SHELL=/bin/bash arch/mips/dec/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202304281115.mEqaC6GM-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> arch/mips/dec/kn01-berr.c:104:34: sparse: sparse: cast removes address space '__user' of expression

vim +/__user +104 arch/mips/dec/kn01-berr.c

69c75fb458cd81 Maciej W. Rozycki 2005-06-22 59
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 60 static int dec_kn01_be_backend(struct pt_regs *regs, int is_fixup, int invoker)
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 61 {
a5fc9c0bbee8b9 Maciej W. Rozycki 2005-07-01 62 volatile u32 *kn01_erraddr = (void *)CKSEG1ADDR(KN01_SLOT_BASE +
a5fc9c0bbee8b9 Maciej W. Rozycki 2005-07-01 63 KN01_ERRADDR);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 64
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 65 static const char excstr[] = "exception";
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 66 static const char intstr[] = "interrupt";
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 67 static const char cpustr[] = "CPU";
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 68 static const char mreadstr[] = "memory read";
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 69 static const char readstr[] = "read";
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 70 static const char writestr[] = "write";
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 71 static const char timestr[] = "timeout";
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 72 static const char paritystr[] = "parity error";
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 73
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 74 int data = regs->cp0_cause & 4;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 75 unsigned int __user *pc = (unsigned int __user *)regs->cp0_epc +
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 76 ((regs->cp0_cause & CAUSEF_BD) != 0);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 77 union mips_instruction insn;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 78 unsigned long entrylo, offset;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 79 long asid, entryhi, vaddr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 80
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 81 const char *kind, *agent, *cycle, *event;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 82 unsigned long address;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 83
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 84 u32 erraddr = *kn01_erraddr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 85 int action = MIPS_BE_FATAL;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 86
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 87 /* Ack ASAP, so that any subsequent errors get caught. */
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 88 dec_kn01_be_ack();
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 89
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 90 kind = invoker ? intstr : excstr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 91
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 92 agent = cpustr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 93
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 94 if (invoker)
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 95 address = erraddr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 96 else {
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 97 /* Bloody hardware doesn't record the address for reads... */
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 98 if (data) {
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 99 /* This never faults. */
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 100 __get_user(insn.word, pc);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 101 vaddr = regs->regs[insn.i_format.rs] +
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 102 insn.i_format.simmediate;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 103 } else
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 @104 vaddr = (long)pc;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 105 if (KSEGX(vaddr) == CKSEG0 || KSEGX(vaddr) == CKSEG1)
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 106 address = CPHYSADDR(vaddr);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 107 else {
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 108 /* Peek at what physical address the CPU used. */
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 109 asid = read_c0_entryhi();
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 110 entryhi = asid & (PAGE_SIZE - 1);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 111 entryhi |= vaddr & ~(PAGE_SIZE - 1);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 112 write_c0_entryhi(entryhi);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 113 BARRIER;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 114 tlb_probe();
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 115 /* No need to check for presence. */
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 116 tlb_read();
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 117 entrylo = read_c0_entrylo0();
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 118 write_c0_entryhi(asid);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 119 offset = vaddr & (PAGE_SIZE - 1);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 120 address = (entrylo & ~(PAGE_SIZE - 1)) | offset;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 121 }
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 122 }
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 123
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 124 /* Treat low 256MB as memory, high -- as I/O. */
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 125 if (address < 0x10000000) {
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 126 cycle = mreadstr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 127 event = paritystr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 128 } else {
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 129 cycle = invoker ? writestr : readstr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 130 event = timestr;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 131 }
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 132
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 133 if (is_fixup)
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 134 action = MIPS_BE_FIXUP;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 135
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 136 if (action != MIPS_BE_FIXUP)
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 137 printk(KERN_ALERT "Bus error %s: %s %s %s at %#010lx\n",
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 138 kind, agent, cycle, event, address);
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 139
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 140 return action;
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 141 }
69c75fb458cd81 Maciej W. Rozycki 2005-06-22 142

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