Message ID | 20201020054454.194343-2-ravi.bangoria@linux.ibm.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [1/2] powerpc: Introduce POWER10_DD1 feature | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch powerpc/merge (96b5a60d059984a2f0eaef90e97f59ac4a76bff4) |
snowpatch_ozlabs/build-ppc64le | warning | Upstream build failed, couldn't test patch |
snowpatch_ozlabs/build-ppc64be | warning | Upstream build failed, couldn't test patch |
snowpatch_ozlabs/build-ppc64e | warning | Upstream build failed, couldn't test patch |
snowpatch_ozlabs/build-pmac32 | warning | Upstream build failed, couldn't test patch |
snowpatch_ozlabs/checkpatch | success | |
snowpatch_ozlabs/needsstable | success | Patch has no Fixes tags |
Hi Ravi, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on powerpc/next] [also build test WARNING on v5.9 next-20201016] [cannot apply to mpe/next scottwood/next] [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/Ravi-Bangoria/powerpc-Introduce-POWER10_DD1-feature/20201020-134813 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc-allmodconfig (attached as .config) compiler: powerpc64-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/a873a50e35b4c881b6bb53f48ae8ef7bb3e576eb git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Ravi-Bangoria/powerpc-Introduce-POWER10_DD1-feature/20201020-134813 git checkout a873a50e35b4c881b6bb53f48ae8ef7bb3e576eb # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc 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/powerpc/kernel/hw_breakpoint.c: In function 'handle_p10dd1_spurious_exception': >> arch/powerpc/kernel/hw_breakpoint.c:561:16: warning: variable 'hw_start_addr' set but not used [-Wunused-but-set-variable] 561 | unsigned long hw_start_addr; | ^~~~~~~~~~~~~ vim +/hw_start_addr +561 arch/powerpc/kernel/hw_breakpoint.c 556 557 static void handle_p10dd1_spurious_exception(struct arch_hw_breakpoint **info, 558 int *hit, unsigned long ea) 559 { 560 int i; > 561 unsigned long hw_start_addr; 562 unsigned long hw_end_addr; 563 564 /* 565 * Handle spurious exception only when any bp_per_reg is set. 566 * Otherwise this might be created by xmon and not actually a 567 * spurious exception. 568 */ 569 for (i = 0; i < nr_wp_slots(); i++) { 570 if (!info[i]) 571 continue; 572 573 hw_start_addr = ALIGN_DOWN(info[i]->address, HW_BREAKPOINT_SIZE); 574 hw_end_addr = ALIGN(info[i]->address + info[i]->len, HW_BREAKPOINT_SIZE); 575 576 /* 577 * Ending address of DAWR range is less than starting 578 * address of op. 579 */ 580 if ((hw_end_addr - 1) >= ea) 581 continue; 582 583 /* 584 * Those addresses need to be in the same or in two 585 * consecutive 512B blocks; 586 */ 587 if (((hw_end_addr - 1) >> 10) != (ea >> 10)) 588 continue; 589 590 /* 591 * 'op address + 64B' generates an address that has a 592 * carry into bit 52 (crosses 2K boundary). 593 */ 594 if ((ea & 0x800) == ((ea + 64) & 0x800)) 595 continue; 596 597 break; 598 } 599 600 if (i == nr_wp_slots()) 601 return; 602 603 for (i = 0; i < nr_wp_slots(); i++) { 604 if (info[i]) { 605 hit[i] = 1; 606 info[i]->type |= HW_BRK_TYPE_EXTRANEOUS_IRQ; 607 } 608 } 609 } 610 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c index f4e8f21046f5..4514745d27c3 100644 --- a/arch/powerpc/kernel/hw_breakpoint.c +++ b/arch/powerpc/kernel/hw_breakpoint.c @@ -499,6 +499,11 @@ static bool is_larx_stcx_instr(int type) return type == LARX || type == STCX; } +static bool is_octword_vsx_instr(int type, int size) +{ + return ((type == LOAD_VSX || type == STORE_VSX) && size == 32); +} + /* * We've failed in reliably handling the hw-breakpoint. Unregister * it and throw a warning message to let the user know about it. @@ -549,6 +554,60 @@ static bool stepping_handler(struct pt_regs *regs, struct perf_event **bp, return true; } +static void handle_p10dd1_spurious_exception(struct arch_hw_breakpoint **info, + int *hit, unsigned long ea) +{ + int i; + unsigned long hw_start_addr; + unsigned long hw_end_addr; + + /* + * Handle spurious exception only when any bp_per_reg is set. + * Otherwise this might be created by xmon and not actually a + * spurious exception. + */ + for (i = 0; i < nr_wp_slots(); i++) { + if (!info[i]) + continue; + + hw_start_addr = ALIGN_DOWN(info[i]->address, HW_BREAKPOINT_SIZE); + hw_end_addr = ALIGN(info[i]->address + info[i]->len, HW_BREAKPOINT_SIZE); + + /* + * Ending address of DAWR range is less than starting + * address of op. + */ + if ((hw_end_addr - 1) >= ea) + continue; + + /* + * Those addresses need to be in the same or in two + * consecutive 512B blocks; + */ + if (((hw_end_addr - 1) >> 10) != (ea >> 10)) + continue; + + /* + * 'op address + 64B' generates an address that has a + * carry into bit 52 (crosses 2K boundary). + */ + if ((ea & 0x800) == ((ea + 64) & 0x800)) + continue; + + break; + } + + if (i == nr_wp_slots()) + return; + + for (i = 0; i < nr_wp_slots(); i++) { + if (info[i]) { + hit[i] = 1; + info[i]->type |= HW_BRK_TYPE_EXTRANEOUS_IRQ; + } + } +} + int hw_breakpoint_handler(struct die_args *args) { bool err = false; @@ -607,8 +666,14 @@ int hw_breakpoint_handler(struct die_args *args) goto reset; if (!nr_hit) { - rc = NOTIFY_DONE; - goto out; + if (cpu_has_feature(CPU_FTR_POWER10_DD1) && + !IS_ENABLED(CONFIG_PPC_8xx) && + is_octword_vsx_instr(type, size)) { + handle_p10dd1_spurious_exception(info, hit, ea); + } else { + rc = NOTIFY_DONE; + goto out; + } } /*
POWER10 DD1 has an issue where it generates watchpoint exceptions when it shouldn't. The conditions where this occur are: - octword op - ending address of DAWR range is less than starting address of op - those addresses need to be in the same or in two consecutive 512B blocks - 'op address + 64B' generates an address that has a carry into bit 52 (crosses 2K boundary) Handle such spurious exception by considering them as extraneous and emulating/single-steeping instruction without generating an event. Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com> --- Dependency: VSX-32 byte emulation support patches https://lore.kernel.org/r/20201011050908.72173-1-ravi.bangoria@linux.ibm.com arch/powerpc/kernel/hw_breakpoint.c | 69 ++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 2 deletions(-)