linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/watchpoint: Don't call dar_within_range() for Book3S
@ 2020-02-22  8:20 Ravi Bangoria
  2020-02-22 11:26 ` Christophe Leroy
  2020-02-27 12:31 ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Ravi Bangoria @ 2020-02-22  8:20 UTC (permalink / raw)
  To: mpe; +Cc: christophe.leroy, mikey, linuxppc-dev, linux-kernel, 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_hwbreak

After patch:
  TESTED: No overlap
  TESTED: Partial overlap
  TESTED: Partial overlap
  TESTED: No overlap
  TESTED: Full overlap
  success: perf_hwbreak

Fixes: 39413ae00967 ("powerpc/hw_breakpoints: Rewrite 8xx breakpoints to allow any address range size.")
Reported-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 arch/powerpc/kernel/hw_breakpoint.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
index 2462cd7c565c..d0854320bb50 100644
--- a/arch/powerpc/kernel/hw_breakpoint.c
+++ b/arch/powerpc/kernel/hw_breakpoint.c
@@ -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'
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/watchpoint: Don't call dar_within_range() for Book3S
  2020-02-22  8:20 [PATCH] powerpc/watchpoint: Don't call dar_within_range() for Book3S Ravi Bangoria
@ 2020-02-22 11:26 ` Christophe Leroy
  2020-02-22 13:16   ` Ravi Bangoria
  2020-02-27 12:31 ` Michael Ellerman
  1 sibling, 1 reply; 4+ messages in thread
From: Christophe Leroy @ 2020-02-22 11:26 UTC (permalink / raw)
  To: Ravi Bangoria, mpe; +Cc: mikey, linuxppc-dev, linux-kernel



On 02/22/2020 08:20 AM, Ravi Bangoria wrote:
> 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
> 
> 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 <christophe.leroy@c-s.fr>

> Reported-by: Michael Ellerman <mpe@ellerman.id.au>
> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> ---
>   arch/powerpc/kernel/hw_breakpoint.c | 12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
> index 2462cd7c565c..d0854320bb50 100644
> --- a/arch/powerpc/kernel/hw_breakpoint.c
> +++ b/arch/powerpc/kernel/hw_breakpoint.c
> @@ -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'
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/watchpoint: Don't call dar_within_range() for Book3S
  2020-02-22 11:26 ` Christophe Leroy
@ 2020-02-22 13:16   ` Ravi Bangoria
  0 siblings, 0 replies; 4+ messages in thread
From: Ravi Bangoria @ 2020-02-22 13:16 UTC (permalink / raw)
  To: Christophe Leroy; +Cc: mpe, mikey, linuxppc-dev, linux-kernel, Ravi Bangoria



On 2/22/20 4:56 PM, Christophe Leroy wrote:
> 
> 
> On 02/22/2020 08:20 AM, Ravi Bangoria wrote:
>> 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
>>
>> 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 <christophe.leroy@c-s.fr>

No worries. Thanks for the review :)

Ravi


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/watchpoint: Don't call dar_within_range() for Book3S
  2020-02-22  8:20 [PATCH] powerpc/watchpoint: Don't call dar_within_range() for Book3S Ravi Bangoria
  2020-02-22 11:26 ` Christophe Leroy
@ 2020-02-27 12:31 ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2020-02-27 12:31 UTC (permalink / raw)
  To: Ravi Bangoria; +Cc: Ravi Bangoria, mikey, linuxppc-dev, linux-kernel

On Sat, 2020-02-22 at 08:20:49 UTC, Ravi Bangoria wrote:
> 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
> 
> Fixes: 39413ae00967 ("powerpc/hw_breakpoints: Rewrite 8xx breakpoints to allow any address range size.")
> Reported-by: Michael Ellerman <mpe@ellerman.id.au>
> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/e08658a657f974590809290c62e889f0fd420200

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-27 12:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-22  8:20 [PATCH] powerpc/watchpoint: Don't call dar_within_range() for Book3S Ravi Bangoria
2020-02-22 11:26 ` Christophe Leroy
2020-02-22 13:16   ` Ravi Bangoria
2020-02-27 12:31 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).