powerpc/watchpoint: Don't call dar_within_range() for Book3S
PATCH 1/1 powerpc/watchpoint: Don't call dar_within_range() for Book3S
DAR is set to the first byte of overlap between actual access and watched range at DSI on Book3S processor. But actual access range might or might not be within user asked range. So for Book3S, it must not call dar_within_range().
This revert portion of commit 39413ae00967 ("powerpc/hw_breakpoints:
Rewrite 8xx breakpoints to allow any address range size.").
Before patch:
# ./tools/testing/selftests/powerpc/ptrace/perf-hwbreak ... TESTED: No overlap FAILED: Partial overlap: 0 != 2 TESTED: Partial overlap TESTED: No overlap FAILED: Full overlap: 0 != 2 failure: perf_hwbreak
After patch:
TESTED: No overlap
TESTED: Partial overlap
TESTED: Partial overlap
TESTED: No overlap
TESTED: Full overlap
success: perf_hwbreak
--- arch/powerpc/kernel/hw_breakpoint.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
arch/powerpc/kernel/hw_breakpoint.c +7 -5
@@ -331,11 +331,13 @@ int hw_breakpoint_handler(struct die_args *args) } info->type &= ~HW_BRK_TYPE_EXTRANEOUS_IRQ ; -if (!dar_within_range (regs->dar, info)) - info->type |=HW_BRK_TYPE_EXTRANEOUS_IRQ ; - -if (!IS_ENABLED (CONFIG_PPC_8xx) && !stepping_handler (regs, bp, info)) - goto out; +if (IS_ENABLED (CONFIG_PPC_8xx)) { +if (!dar_within_range (regs->dar, info)) + info->type |=HW_BRK_TYPE_EXTRANEOUS_IRQ ; + }else { +if (!stepping_handler (regs, bp, info)) + goto out; + }/* * As a policy, the callback is invoked in a 'trigger-after-execute'
Signature · 1 line
2.21.1
Quoted 26 lines · Ravi Bangoria
DAR is set to the first byte of overlap between actual access and watched range at DSI on Book3S processor. But actual access range might or might not be within user asked range. So for Book3S, it must not call
dar_within_range().This revert portion of commit
39413ae00967("powerpc/hw_breakpoints:
Rewrite 8xx breakpoints to allow any address range size.").Before patch:
# ./tools/testing/selftests/powerpc/ptrace/perf-hwbreak ... TESTED: No overlap FAILED: Partial overlap: 0 != 2 TESTED: Partial overlap TESTED: No overlap FAILED: Full overlap: 0 != 2 failure: perf_hwbreakAfter patch:
TESTED: No overlap
TESTED: Partial overlap
TESTED: Partial overlap
TESTED: No overlap
TESTED: Full overlap
success:perf_hwbreak
Quoted 1 line
Fixes 39413ae00967 ("powerpc/hw_breakpoints: Rewrite 8xx breakpoints to allow any address range size.")
Oh, this seems to have been introduced by 27985b2a640e ("powerpc/watchpoint: Don't ignore extraneous exceptions blindly").
I must have lost it through a rebase as we were doing our series approximately at the same time, sorry for that.
Quoted 30 lines
Reported-by Michael Ellerman <[email protected]>Signed-off-by Ravi Bangoria <[email protected]>--- arch/powerpc/kernel/hw_breakpoint.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)arch/powerpc/kernel/hw_breakpoint.c +7
-5@@ -331,11 +331,13 @@ int hw_breakpoint_handler(struct die_args *args) } info->type &= ~HW_BRK_TYPE_EXTRANEOUS_IRQ ; -if (!dar_within_range (regs->dar, info)) - info->type |=HW_BRK_TYPE_EXTRANEOUS_IRQ ; - -if (!IS_ENABLED (CONFIG_PPC_8xx) && !stepping_handler (regs, bp, info)) - goto out; +if (IS_ENABLED (CONFIG_PPC_8xx)) { +if (!dar_within_range (regs->dar, info)) + info->type |=HW_BRK_TYPE_EXTRANEOUS_IRQ ; + }else { +if (!stepping_handler (regs, bp, info)) + goto out; + }/* * As a policy, the callback is invoked in a 'trigger-after-execute'
Quoted 29 lines · Christophe Leroy
Quoted 26 lines · Ravi Bangoria
DAR is set to the first byte of overlap between actual access and watched range at DSI on Book3S processor. But actual access range might or might not be within user asked range. So for Book3S, it must not call
dar_within_range().This revert portion of commit
39413ae00967("powerpc/hw_breakpoints:
Rewrite 8xx breakpoints to allow any address range size.").Before patch:
# ./tools/testing/selftests/powerpc/ptrace/perf-hwbreak ... TESTED: No overlap FAILED: Partial overlap: 0 != 2 TESTED: Partial overlap TESTED: No overlap FAILED: Full overlap: 0 != 2 failure: perf_hwbreakAfter patch:
TESTED: No overlap
TESTED: Partial overlap
TESTED: Partial overlap
TESTED: No overlap
TESTED: Full overlap
success:perf_hwbreak
Quoted 7 lines
Quoted 1 line
Fixes 39413ae00967 ("powerpc/hw_breakpoints: Rewrite 8xx breakpoints to allow any address range size.")Oh, this seems to have been introduced by
27985b2a640e("powerpc/watchpoint: Don't ignore extraneous exceptions blindly").I must have lost it through a rebase as we were doing our series approximately at the same time, sorry for that.
Reviewed-by Christophe Leroy <[email protected]>
No worries. Thanks for the review :)
Ravi
Michael Ellerman
AppliedQuoted 26 lines · Ravi Bangoria
DAR is set to the first byte of overlap between actual access and watched range at DSI on Book3S processor. But actual access range might or might not be within user asked range. So for Book3S, it must not call
dar_within_range().This revert portion of commit
39413ae00967("powerpc/hw_breakpoints:
Rewrite 8xx breakpoints to allow any address range size.").Before patch:
# ./tools/testing/selftests/powerpc/ptrace/perf-hwbreak ... TESTED: No overlap FAILED: Partial overlap: 0 != 2 TESTED: Partial overlap TESTED: No overlap FAILED: Full overlap: 0 != 2 failure: perf_hwbreakAfter patch:
TESTED: No overlap
TESTED: Partial overlap
TESTED: Partial overlap
TESTED: No overlap
TESTED: Full overlap
success:perf_hwbreak
Quoted 3 lines
Fixes 39413ae00967 ("powerpc/hw_breakpoints: Rewrite 8xx breakpoints to allow any address range size.")Reported-by Michael Ellerman <[email protected]>Signed-off-by Ravi Bangoria <[email protected]>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/e08658a657f974590809290c62e889f0fd420200
cheers