Re: [PATCH bpf-next v6 04/11] bpf: Rename BPF_XADD and prepare to encode other atomics in .imm

From: kernel test robot
Date: Tue Jan 12 2021 - 21:22:00 EST


Hi Brendan,

I love your patch! Yet something to improve:

[auto build test ERROR on bpf-next/master]

url: https://github.com/0day-ci/linux/commits/Brendan-Jackman/bpf-x86-Factor-out-emission-of-ModR-M-for-reg-off/20210113-004228
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: riscv-randconfig-p001-20210112 (attached as .config)
compiler: riscv32-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://github.com/0day-ci/linux/commit/29323517f0749d2ec9d023d97443d8d18e2e916b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Brendan-Jackman/bpf-x86-Factor-out-emission-of-ModR-M-for-reg-off/20210113-004228
git checkout 29323517f0749d2ec9d023d97443d8d18e2e916b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

arch/riscv/net/bpf_jit_comp32.c: In function 'emit_store_r64':
>> arch/riscv/net/bpf_jit_comp32.c:884:46: error: 'imm' undeclared (first use in this function)
884 | if (mode == BPF_ATOMIC && (size != BPF_W || imm != BPF_ADD))
| ^~~
arch/riscv/net/bpf_jit_comp32.c:884:46: note: each undeclared identifier is reported only once for each function it appears in


vim +/imm +884 arch/riscv/net/bpf_jit_comp32.c

874
875 static int emit_store_r64(const s8 *dst, const s8 *src, s16 off,
876 struct rv_jit_context *ctx, const u8 size,
877 const u8 mode)
878 {
879 const s8 *tmp1 = bpf2rv32[TMP_REG_1];
880 const s8 *tmp2 = bpf2rv32[TMP_REG_2];
881 const s8 *rd = bpf_get_reg64(dst, tmp1, ctx);
882 const s8 *rs = bpf_get_reg64(src, tmp2, ctx);
883
> 884 if (mode == BPF_ATOMIC && (size != BPF_W || imm != BPF_ADD))
885 return -1;
886
887 emit_imm(RV_REG_T0, off, ctx);
888 emit(rv_add(RV_REG_T0, RV_REG_T0, lo(rd)), ctx);
889
890 switch (size) {
891 case BPF_B:
892 emit(rv_sb(RV_REG_T0, 0, lo(rs)), ctx);
893 break;
894 case BPF_H:
895 emit(rv_sh(RV_REG_T0, 0, lo(rs)), ctx);
896 break;
897 case BPF_W:
898 switch (mode) {
899 case BPF_MEM:
900 emit(rv_sw(RV_REG_T0, 0, lo(rs)), ctx);
901 break;
902 case BPF_ATOMIC: /* .imm checked above - only BPF_ADD allowed */
903 emit(rv_amoadd_w(RV_REG_ZERO, lo(rs), RV_REG_T0, 0, 0),
904 ctx);
905 break;
906 }
907 break;
908 case BPF_DW:
909 emit(rv_sw(RV_REG_T0, 0, lo(rs)), ctx);
910 emit(rv_sw(RV_REG_T0, 4, hi(rs)), ctx);
911 break;
912 }
913
914 return 0;
915 }
916

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

Attachment: .config.gz
Description: application/gzip