Content-Type: multipart/mixed; boundary="===============9129704262567881860==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH 1/3] arm64: selftests: Generate all the possible logical immediates as a header Date: Fri, 28 Jan 2022 10:47:07 +0800 Message-ID: <202201281052.Nzl9wJM4-lkp@intel.com> In-Reply-To: <20220127162127.2391947-2-james.morse@arm.com> List-Id: --===============9129704262567881860== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi James, I love your patch! Perhaps something to improve: [auto build test WARNING on arm64/for-next/core] [also build test WARNING on arm/for-next xilinx-xlnx/master soc/for-next kv= marm/next v5.17-rc1 next-20220127] [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/James-Morse/arm64-insn-Gen= erate-64-bit-mask-immediates-correctly/20220128-002213 base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for= -next/core config: arm64-randconfig-p001-20220128 (https://download.01.org/0day-ci/arc= hive/20220128/202201281052.Nzl9wJM4-lkp(a)intel.com/config) compiler: aarch64-linux-gcc (GCC) 11.2.0 reproduce (this is a W=3D1 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/1ead98d2c8c4c28ea27964dbf= 7b5b89a83b8e7ec git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review James-Morse/arm64-insn-Generate-64= -bit-mask-immediates-correctly/20220128-002213 git checkout 1ead98d2c8c4c28ea27964dbf7b5b89a83b8e7ec # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dgcc-11.2.0 make.cross= O=3Dbuild_dir ARCH=3Darm64 prepare If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): arch/arm64/tools/gen_logic_imm.c: In function 'validate': >> arch/arm64/tools/gen_logic_imm.c:81:2: warning: ignoring return value of= 'write' declared with attribute 'warn_unused_result' [-Wunused-result] 81 | write(fd, &insn, sizeof(insn)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- arch/arm64/tools/gen_logic_imm.c: In function 'validate': >> arch/arm64/tools/gen_logic_imm.c:81:2: warning: ignoring return value of= 'write' declared with attribute 'warn_unused_result' [-Wunused-result] 81 | write(fd, &insn, sizeof(insn)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/arm64/kernel/vdso/vgettimeofday.c:9:5: warning: no previous prototy= pe for '__kernel_clock_gettime' [-Wmissing-prototypes] 9 | int __kernel_clock_gettime(clockid_t clock, | ^~~~~~~~~~~~~~~~~~~~~~ arch/arm64/kernel/vdso/vgettimeofday.c:15:5: warning: no previous protot= ype for '__kernel_gettimeofday' [-Wmissing-prototypes] 15 | int __kernel_gettimeofday(struct __kernel_old_timeval *tv, | ^~~~~~~~~~~~~~~~~~~~~ arch/arm64/kernel/vdso/vgettimeofday.c:21:5: warning: no previous protot= ype for '__kernel_clock_getres' [-Wmissing-prototypes] 21 | int __kernel_clock_getres(clockid_t clock_id, | ^~~~~~~~~~~~~~~~~~~~~ vim +81 arch/arm64/tools/gen_logic_imm.c 55 = 56 #define PIPE_READ 0 57 #define PIPE_WRITE 1 58 /* 59 * Use objdump to decode the encoded instruction, and compare the im= mediate. 60 * On error, returns the bad instruction, otherwise returns 0. 61 */ 62 static int validate(u64 val, u32 immN, u32 imms, u32 immr, char *obj= dump) 63 { 64 pid_t child; 65 char *immediate; 66 char val_str[32]; 67 u32 insn =3D 0x12000000; 68 char output[1024] =3D {0}; 69 int fd, pipefd[2], bytes; 70 char filename[] =3D "validate_gen_logic_imm.XXXXXX"; 71 = 72 insn |=3D 1 << 31; 73 insn |=3D (immN & 0x1)<<22; 74 insn |=3D (immr & 0x3f)<<16; 75 insn |=3D (imms & 0x3f)<<10; 76 = 77 fd =3D mkstemp(filename); 78 if (fd < 0) 79 abort(); 80 = > 81 write(fd, &insn, sizeof(insn)); 82 close(fd); 83 = 84 if (pipe(pipefd)) 85 return 0; 86 = 87 child =3D vfork(); 88 if (child) { 89 close(pipefd[PIPE_WRITE]); 90 waitpid(child, NULL, 0); 91 = 92 bytes =3D read(pipefd[PIPE_READ], output, sizeof(output)); 93 close(pipefd[PIPE_READ]); 94 if (!bytes || bytes =3D=3D sizeof(output)) 95 return insn; 96 = 97 immediate =3D strstr(output, "x0, x0, #"); 98 if (!immediate) 99 return insn; 100 immediate +=3D strlen("x0, x0, #"); 101 = 102 /* 103 * strtoll() has its own ideas about overflow and underflow. 104 * Do a string comparison. immediate ends in a newline. 105 */ 106 snprintf(val_str, sizeof(val_str), "0x%lx", val); 107 if (strncmp(val_str, immediate, strlen(val_str))) { 108 fprintf(stderr, "Unexpected decode from objdump: %s\n", 109 immediate); 110 return insn; 111 } 112 } else { 113 close(pipefd[PIPE_READ]); 114 close(1); 115 dup2(pipefd[PIPE_WRITE], 1); 116 execl(objdump, objdump, "-b", "binary", "-m", "aarch64", "-D", 117 filename, (char *) NULL); 118 abort(); 119 } 120 = 121 unlink(filename); 122 return 0; 123 } 124 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============9129704262567881860==--