linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/powerpc: Fix earlyclobber in tm-vmxcopy
@ 2019-06-17 21:24 Gustavo Romero
  2019-06-18 12:00 ` Segher Boessenkool
  2019-06-30  8:37 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo Romero @ 2019-06-17 21:24 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: mikey

In some cases, compiler can allocate the same register for operand 'res'
and 'vecoutptr', resulting in segfault at 'stxvd2x 40,0,%[vecoutptr]'
because base register will contain 1, yielding a false-positive.

This is because output 'res' must be marked as an earlyclobber operand so
it may not overlap an input operand ('vecoutptr').

Signed-off-by: Gustavo Romero <gromero@linux.vnet.ibm.com>
---
 tools/testing/selftests/powerpc/tm/tm-vmxcopy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/powerpc/tm/tm-vmxcopy.c b/tools/testing/selftests/powerpc/tm/tm-vmxcopy.c
index 147c6dc..c1e788a 100644
--- a/tools/testing/selftests/powerpc/tm/tm-vmxcopy.c
+++ b/tools/testing/selftests/powerpc/tm/tm-vmxcopy.c
@@ -79,7 +79,7 @@ int test_vmxcopy()
 
 		"5:;"
 		"stxvd2x 40,0,%[vecoutptr];"
-		: [res]"=r"(aborted)
+		: [res]"=&r"(aborted)
 		: [vecinptr]"r"(&vecin),
 		  [vecoutptr]"r"(&vecout),
 		  [map]"r"(a)
-- 
2.7.4


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

* Re: [PATCH] selftests/powerpc: Fix earlyclobber in tm-vmxcopy
  2019-06-17 21:24 [PATCH] selftests/powerpc: Fix earlyclobber in tm-vmxcopy Gustavo Romero
@ 2019-06-18 12:00 ` Segher Boessenkool
  2019-06-30  8:37 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Segher Boessenkool @ 2019-06-18 12:00 UTC (permalink / raw)
  To: Gustavo Romero; +Cc: mikey, linuxppc-dev

On Mon, Jun 17, 2019 at 05:24:58PM -0400, Gustavo Romero wrote:
> In some cases, compiler can allocate the same register for operand 'res'
> and 'vecoutptr', resulting in segfault at 'stxvd2x 40,0,%[vecoutptr]'
> because base register will contain 1, yielding a false-positive.
> 
> This is because output 'res' must be marked as an earlyclobber operand so
> it may not overlap an input operand ('vecoutptr').
> 
> Signed-off-by: Gustavo Romero <gromero@linux.vnet.ibm.com>

Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>


Segher


> ---
>  tools/testing/selftests/powerpc/tm/tm-vmxcopy.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/powerpc/tm/tm-vmxcopy.c b/tools/testing/selftests/powerpc/tm/tm-vmxcopy.c
> index 147c6dc..c1e788a 100644
> --- a/tools/testing/selftests/powerpc/tm/tm-vmxcopy.c
> +++ b/tools/testing/selftests/powerpc/tm/tm-vmxcopy.c
> @@ -79,7 +79,7 @@ int test_vmxcopy()
>  
>  		"5:;"
>  		"stxvd2x 40,0,%[vecoutptr];"
> -		: [res]"=r"(aborted)
> +		: [res]"=&r"(aborted)
>  		: [vecinptr]"r"(&vecin),
>  		  [vecoutptr]"r"(&vecout),
>  		  [map]"r"(a)
> -- 
> 2.7.4

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

* Re: [PATCH] selftests/powerpc: Fix earlyclobber in tm-vmxcopy
  2019-06-17 21:24 [PATCH] selftests/powerpc: Fix earlyclobber in tm-vmxcopy Gustavo Romero
  2019-06-18 12:00 ` Segher Boessenkool
@ 2019-06-30  8:37 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2019-06-30  8:37 UTC (permalink / raw)
  To: Gustavo Romero, linuxppc-dev; +Cc: mikey

On Mon, 2019-06-17 at 21:24:58 UTC, Gustavo Romero wrote:
> In some cases, compiler can allocate the same register for operand 'res'
> and 'vecoutptr', resulting in segfault at 'stxvd2x 40,0,%[vecoutptr]'
> because base register will contain 1, yielding a false-positive.
> 
> This is because output 'res' must be marked as an earlyclobber operand so
> it may not overlap an input operand ('vecoutptr').
> 
> Signed-off-by: Gustavo Romero <gromero@linux.vnet.ibm.com>
> Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/8d0f1e05ab16c4bd628ddaefd20b94ffb36d799c

cheers

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

end of thread, other threads:[~2019-06-30  8:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-17 21:24 [PATCH] selftests/powerpc: Fix earlyclobber in tm-vmxcopy Gustavo Romero
2019-06-18 12:00 ` Segher Boessenkool
2019-06-30  8:37 ` 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).