Message ID | 20220315110926.1060-1-thunder.leizhen@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | arm64: add the printing of tpidr_elx in __show_regs() | expand |
Hi Zhen, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on arm64/for-next/core] [also build test WARNING on arm-perf/for-next/perf arm/for-next xilinx-xlnx/master soc/for-next kvmarm/next v5.17-rc8 next-20220315] [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/Zhen-Lei/arm64-add-the-printing-of-tpidr_elx-in-__show_regs/20220315-191234 base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core config: arm64-buildonly-randconfig-r002-20220313 (https://download.01.org/0day-ci/archive/20220316/202203160347.f7ls2XFW-lkp@intel.com/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project a6b2f50fb47da3baeee10b1906da6e30ac5d26ec) 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 arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # https://github.com/0day-ci/linux/commit/1a42e34104d70b0b90fe074ba96f2c04d33ffb23 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Zhen-Lei/arm64-add-the-printing-of-tpidr_elx-in-__show_regs/20220315-191234 git checkout 1a42e34104d70b0b90fe074ba96f2c04d33ffb23 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash arch/arm64/kernel/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> arch/arm64/kernel/process.c:220:30: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] printk("tpidr : %016lx\n", this_cpu_ptr(NULL)); ^~~~~~~~~~~~~~~~~~ include/linux/printk.h:446:60: note: expanded from macro 'printk' #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__) ^~~~~~~~~~~ include/linux/printk.h:418:19: note: expanded from macro 'printk_index_wrap' _p_func(_fmt, ##__VA_ARGS__); \ ^~~~~~~~~~~ include/linux/percpu-defs.h:252:27: note: expanded from macro 'this_cpu_ptr' #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) ^~~~~~~~~~~~~~~~ include/linux/percpu-defs.h:241:2: note: expanded from macro 'raw_cpu_ptr' __verify_pcpu_ptr(ptr); \ ^~~~~~~~~~~~~~~~~~~~~~ include/linux/percpu-defs.h:219:52: note: expanded from macro '__verify_pcpu_ptr' const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \ ~~~~~ ^ >> arch/arm64/kernel/process.c:220:30: warning: format specifies type 'unsigned long' but the argument has type 'typeof (*(((void *)0))) *' (aka 'void *') [-Wformat] printk("tpidr : %016lx\n", this_cpu_ptr(NULL)); ~~~~~~ ^~~~~~~~~~~~~~~~~~ include/linux/printk.h:446:60: note: expanded from macro 'printk' #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__) ~~~ ^~~~~~~~~~~ include/linux/printk.h:418:19: note: expanded from macro 'printk_index_wrap' _p_func(_fmt, ##__VA_ARGS__); \ ~~~~ ^~~~~~~~~~~ include/linux/percpu-defs.h:252:27: note: expanded from macro 'this_cpu_ptr' #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) ^~~~~~~~~~~~~~~~ include/linux/percpu-defs.h:239:31: note: expanded from macro 'raw_cpu_ptr' #define raw_cpu_ptr(ptr) \ ^ 2 warnings generated. vim +220 arch/arm64/kernel/process.c 200 201 void __show_regs(struct pt_regs *regs) 202 { 203 int i, top_reg; 204 u64 lr, sp; 205 206 if (compat_user_mode(regs)) { 207 lr = regs->compat_lr; 208 sp = regs->compat_sp; 209 top_reg = 12; 210 } else { 211 lr = regs->regs[30]; 212 sp = regs->sp; 213 top_reg = 29; 214 } 215 216 show_regs_print_info(KERN_DEFAULT); 217 print_pstate(regs); 218 219 if (IS_ENABLED(CONFIG_SMP)) > 220 printk("tpidr : %016lx\n", this_cpu_ptr(NULL)); 221 222 if (!user_mode(regs)) { 223 printk("pc : %pS\n", (void *)regs->pc); 224 printk("lr : %pS\n", (void *)ptrauth_strip_insn_pac(lr)); 225 } else { 226 printk("pc : %016llx\n", regs->pc); 227 printk("lr : %016llx\n", lr); 228 } 229 230 printk("sp : %016llx\n", sp); 231 232 if (system_uses_irq_prio_masking()) 233 printk("pmr_save: %08llx\n", regs->pmr_save); 234 235 i = top_reg; 236 237 while (i >= 0) { 238 printk("x%-2d: %016llx", i, regs->regs[i]); 239 240 while (i-- % 3) 241 pr_cont(" x%-2d: %016llx", i, regs->regs[i]); 242 243 pr_cont("\n"); 244 } 245 } 246 --- 0-DAY CI Kernel Test Service https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Zhen, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on arm64/for-next/core] [also build test WARNING on arm-perf/for-next/perf arm/for-next xilinx-xlnx/master soc/for-next kvmarm/next v5.17-rc8 next-20220315] [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/Zhen-Lei/arm64-add-the-printing-of-tpidr_elx-in-__show_regs/20220315-191234 base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core config: arm64-randconfig-r024-20220313 (https://download.01.org/0day-ci/archive/20220316/202203160424.FIKayRYG-lkp@intel.com/config) compiler: aarch64-linux-gcc (GCC) 11.2.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/1a42e34104d70b0b90fe074ba96f2c04d33ffb23 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Zhen-Lei/arm64-add-the-printing-of-tpidr_elx-in-__show_regs/20220315-191234 git checkout 1a42e34104d70b0b90fe074ba96f2c04d33ffb23 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm64 SHELL=/bin/bash arch/arm64/kernel/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): In file included from include/asm-generic/bug.h:22, from arch/arm64/include/asm/bug.h:26, from include/linux/bug.h:5, from arch/arm64/include/asm/cpufeature.h:19, from arch/arm64/include/asm/hwcap.h:9, from arch/arm64/include/asm/arch_timer.h:12, from arch/arm64/include/asm/timex.h:8, from include/linux/timex.h:65, from include/linux/time32.h:13, from include/linux/time.h:60, from include/linux/compat.h:10, from arch/arm64/kernel/process.c:9: arch/arm64/kernel/process.c: In function '__show_regs': >> arch/arm64/kernel/process.c:220:24: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'void *' [-Wformat=] 220 | printk("tpidr : %016lx\n", this_cpu_ptr(NULL)); | ^~~~~~~~~~~~~~~~~~ include/linux/printk.h:418:25: note: in definition of macro 'printk_index_wrap' 418 | _p_func(_fmt, ##__VA_ARGS__); \ | ^~~~ arch/arm64/kernel/process.c:220:17: note: in expansion of macro 'printk' 220 | printk("tpidr : %016lx\n", this_cpu_ptr(NULL)); | ^~~~~~ arch/arm64/kernel/process.c:220:38: note: format string is defined here 220 | printk("tpidr : %016lx\n", this_cpu_ptr(NULL)); | ~~~~~^ | | | long unsigned int | %016p vim +220 arch/arm64/kernel/process.c 200 201 void __show_regs(struct pt_regs *regs) 202 { 203 int i, top_reg; 204 u64 lr, sp; 205 206 if (compat_user_mode(regs)) { 207 lr = regs->compat_lr; 208 sp = regs->compat_sp; 209 top_reg = 12; 210 } else { 211 lr = regs->regs[30]; 212 sp = regs->sp; 213 top_reg = 29; 214 } 215 216 show_regs_print_info(KERN_DEFAULT); 217 print_pstate(regs); 218 219 if (IS_ENABLED(CONFIG_SMP)) > 220 printk("tpidr : %016lx\n", this_cpu_ptr(NULL)); 221 222 if (!user_mode(regs)) { 223 printk("pc : %pS\n", (void *)regs->pc); 224 printk("lr : %pS\n", (void *)ptrauth_strip_insn_pac(lr)); 225 } else { 226 printk("pc : %016llx\n", regs->pc); 227 printk("lr : %016llx\n", lr); 228 } 229 230 printk("sp : %016llx\n", sp); 231 232 if (system_uses_irq_prio_masking()) 233 printk("pmr_save: %08llx\n", regs->pmr_save); 234 235 i = top_reg; 236 237 while (i >= 0) { 238 printk("x%-2d: %016llx", i, regs->regs[i]); 239 240 while (i-- % 3) 241 pr_cont(" x%-2d: %016llx", i, regs->regs[i]); 242 243 pr_cont("\n"); 244 } 245 } 246 --- 0-DAY CI Kernel Test Service https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Zhen, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on arm64/for-next/core] [also build test WARNING on arm-perf/for-next/perf arm/for-next xilinx-xlnx/master soc/for-next kvmarm/next v5.17-rc8 next-20220315] [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/Zhen-Lei/arm64-add-the-printing-of-tpidr_elx-in-__show_regs/20220315-191234 base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core config: arm64-randconfig-s032-20220313 (https://download.01.org/0day-ci/archive/20220316/202203160439.K5AL4Spr-lkp@intel.com/config) compiler: aarch64-linux-gcc (GCC) 11.2.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-dirty # https://github.com/0day-ci/linux/commit/1a42e34104d70b0b90fe074ba96f2c04d33ffb23 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Zhen-Lei/arm64-add-the-printing-of-tpidr_elx-in-__show_regs/20220315-191234 git checkout 1a42e34104d70b0b90fe074ba96f2c04d33ffb23 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 SHELL=/bin/bash arch/arm64/kernel/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> sparse warnings: (new ones prefixed by >>) >> arch/arm64/kernel/process.c:220:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got void * @@ arch/arm64/kernel/process.c:220:17: sparse: expected void const [noderef] __percpu *__vpp_verify arch/arm64/kernel/process.c:220:17: sparse: got void * arch/arm64/kernel/process.c:437:1: sparse: sparse: symbol '__pcpu_scope___entry_task' was not declared. Should it be static? vim +220 arch/arm64/kernel/process.c 200 201 void __show_regs(struct pt_regs *regs) 202 { 203 int i, top_reg; 204 u64 lr, sp; 205 206 if (compat_user_mode(regs)) { 207 lr = regs->compat_lr; 208 sp = regs->compat_sp; 209 top_reg = 12; 210 } else { 211 lr = regs->regs[30]; 212 sp = regs->sp; 213 top_reg = 29; 214 } 215 216 show_regs_print_info(KERN_DEFAULT); 217 print_pstate(regs); 218 219 if (IS_ENABLED(CONFIG_SMP)) > 220 printk("tpidr : %016lx\n", this_cpu_ptr(NULL)); 221 222 if (!user_mode(regs)) { 223 printk("pc : %pS\n", (void *)regs->pc); 224 printk("lr : %pS\n", (void *)ptrauth_strip_insn_pac(lr)); 225 } else { 226 printk("pc : %016llx\n", regs->pc); 227 printk("lr : %016llx\n", lr); 228 } 229 230 printk("sp : %016llx\n", sp); 231 232 if (system_uses_irq_prio_masking()) 233 printk("pmr_save: %08llx\n", regs->pmr_save); 234 235 i = top_reg; 236 237 while (i >= 0) { 238 printk("x%-2d: %016llx", i, regs->regs[i]); 239 240 while (i-- % 3) 241 pr_cont(" x%-2d: %016llx", i, regs->regs[i]); 242 243 pr_cont("\n"); 244 } 245 } 246 --- 0-DAY CI Kernel Test Service https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 5369e649fa79ff8..14924810a1d9d76 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -216,6 +216,9 @@ void __show_regs(struct pt_regs *regs) show_regs_print_info(KERN_DEFAULT); print_pstate(regs); + if (IS_ENABLED(CONFIG_SMP)) + printk("tpidr : %016lx\n", this_cpu_ptr(NULL)); + if (!user_mode(regs)) { printk("pc : %pS\n", (void *)regs->pc); printk("lr : %pS\n", (void *)ptrauth_strip_insn_pac(lr));
Commit 7158627686f0 ("arm64: percpu: implement optimised pcpu access using tpidr_el1") and commit 6d99b68933fb ("arm64: alternatives: use tpidr_el2 on VHE hosts") use tpidr_elx to cache my_cpu_offset to optimize pcpu access. However, when performing reverse execution based on the registers and the memory contents in kdump, this information is sometimes required if there is a pcpu access. Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> --- arch/arm64/kernel/process.c | 3 +++ 1 file changed, 3 insertions(+)