public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* -fsanitize=thread support on ppc64
@ 2017-01-23 11:34 ` Jakub Jelinek
  2017-01-23 12:54   ` Maxim Ostapenko
  0 siblings, 1 reply; 10+ messages in thread
From: Jakub Jelinek @ 2017-01-23 11:34 UTC (permalink / raw)
  To: Bill Schmidt; +Cc: gcc

Hi!

I've noticed today there is tsan_rtl_ppc64.S file since the latest
merge from upstream.  Does that mean tsan is supposed to work
on ppc64?  Just powerpc64le-*-linux*, or powerpc64-*-linux* too?
If yes, then libsanitizer/configure.tgt should be changed to reflect that
change.

	Jakub

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

* Re: -fsanitize=thread support on ppc64
  2017-01-23 11:34 ` -fsanitize=thread support on ppc64 Jakub Jelinek
@ 2017-01-23 12:54   ` Maxim Ostapenko
  2017-01-23 14:22     ` Bill Schmidt
  0 siblings, 1 reply; 10+ messages in thread
From: Maxim Ostapenko @ 2017-01-23 12:54 UTC (permalink / raw)
  To: Jakub Jelinek, Bill Schmidt; +Cc: gcc

Hi,

On 23/01/17 14:33, Jakub Jelinek wrote:
> Hi!
>
> I've noticed today there is tsan_rtl_ppc64.S file since the latest
> merge from upstream.  Does that mean tsan is supposed to work
> on ppc64?  Just powerpc64le-*-linux*, or powerpc64-*-linux* too?

FWIW LLVM has build bots for both ppc64le-linux and ppc64be-linux, see:
http://lab.llvm.org:8011/builders/sanitizer-ppc64le-linux
http://lab.llvm.org:8011/builders/sanitizer-ppc64be-linux

Thus TSan is supposed to work on ppc64, I guess.

-Maxim

> If yes, then libsanitizer/configure.tgt should be changed to reflect that
> change.
>
> 	Jakub
>
>

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

* Re: -fsanitize=thread support on ppc64
  2017-01-23 12:54   ` Maxim Ostapenko
@ 2017-01-23 14:22     ` Bill Schmidt
  2017-01-23 14:32       ` Jakub Jelinek
  0 siblings, 1 reply; 10+ messages in thread
From: Bill Schmidt @ 2017-01-23 14:22 UTC (permalink / raw)
  To: Maxim Ostapenko; +Cc: Jakub Jelinek, gcc

TSan support was contributed to LLVM by a student working at one of the US 
National Labs a while back.  I helped him with some of the PPC assembly
programming.  To my knowledge this is working, but I haven't tested this with
GCC.  Do you think we want to change the configuration for GCC this late in the
release?  I can run a quick test with TSan turned on to see where we're at.

-- Bill

Bill Schmidt, Ph.D.
GCC for Linux on Power
Linux on Power Toolchain
IBM Linux Technology Center
wschmidt@linux.vnet.ibm.com

> On Jan 23, 2017, at 6:53 AM, Maxim Ostapenko <m.ostapenko@samsung.com> wrote:
> 
> Hi,
> 
> On 23/01/17 14:33, Jakub Jelinek wrote:
>> Hi!
>> 
>> I've noticed today there is tsan_rtl_ppc64.S file since the latest
>> merge from upstream.  Does that mean tsan is supposed to work
>> on ppc64?  Just powerpc64le-*-linux*, or powerpc64-*-linux* too?
> 
> FWIW LLVM has build bots for both ppc64le-linux and ppc64be-linux, see:
> http://lab.llvm.org:8011/builders/sanitizer-ppc64le-linux
> http://lab.llvm.org:8011/builders/sanitizer-ppc64be-linux
> 
> Thus TSan is supposed to work on ppc64, I guess.
> 
> -Maxim
> 
>> If yes, then libsanitizer/configure.tgt should be changed to reflect that
>> change.
>> 
>> 	Jakub
>> 
>> 
> 

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

* Re: -fsanitize=thread support on ppc64
  2017-01-23 14:22     ` Bill Schmidt
@ 2017-01-23 14:32       ` Jakub Jelinek
  2017-01-23 14:41         ` Bill Schmidt
  2017-01-23 14:44         ` Bill Schmidt
  0 siblings, 2 replies; 10+ messages in thread
From: Jakub Jelinek @ 2017-01-23 14:32 UTC (permalink / raw)
  To: Bill Schmidt; +Cc: Maxim Ostapenko, gcc

On Mon, Jan 23, 2017 at 08:22:30AM -0600, Bill Schmidt wrote:
> TSan support was contributed to LLVM by a student working at one of the US 
> National Labs a while back.  I helped him with some of the PPC assembly
> programming.  To my knowledge this is working, but I haven't tested this with
> GCC.  Do you think we want to change the configuration for GCC this late in the
> release?  I can run a quick test with TSan turned on to see where we're at.

I think it should be enabled if it works, even this late.
I bet we need something like the following patch on top of
the PR79168 patch.

I'll test both patches on both ppc64le and ppc64.

Another question is, it seems upstream has s390{,x}-*-linux* support for
asan/ubsan, does that work?  In that case we should add it to configure.tgt
too (similarly to the sparc*-*-linux* entry).

2017-01-23  Jakub Jelinek  <jakub@redhat.com>

	* configure.tgt: Enable tsan and lsan on powerpc64{,le}-*-linux*.

--- libsanitizer/configure.tgt.jj	2016-11-09 15:22:50.000000000 +0100
+++ libsanitizer/configure.tgt	2017-01-23 15:25:21.059399613 +0100
@@ -1,5 +1,5 @@
 # -*- shell-script -*-
-#   Copyright (C) 2012 Free Software Foundation, Inc.
+#   Copyright (C) 2012-2017 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -31,6 +31,11 @@ case "${target}" in
 	fi
 	;;
   powerpc*-*-linux*)
+	if test x$ac_cv_sizeof_void_p = x8; then
+		TSAN_SUPPORTED=yes
+		LSAN_SUPPORTED=yes
+		TSAN_TARGET_DEPENDENT_OBJECTS=tsan_rtl_ppc64.lo
+	fi
 	;;
   sparc*-*-linux*)
 	;;


	Jakub

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

* Re: -fsanitize=thread support on ppc64
  2017-01-23 14:32       ` Jakub Jelinek
@ 2017-01-23 14:41         ` Bill Schmidt
  2017-01-23 15:10           ` Ulrich Weigand
  2017-01-23 14:44         ` Bill Schmidt
  1 sibling, 1 reply; 10+ messages in thread
From: Bill Schmidt @ 2017-01-23 14:41 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Maxim Ostapenko, gcc, Ulrich Weigand


> On Jan 23, 2017, at 8:32 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> 
> On Mon, Jan 23, 2017 at 08:22:30AM -0600, Bill Schmidt wrote:
>> TSan support was contributed to LLVM by a student working at one of the US 
>> National Labs a while back.  I helped him with some of the PPC assembly
>> programming.  To my knowledge this is working, but I haven't tested this with
>> GCC.  Do you think we want to change the configuration for GCC this late in the
>> release?  I can run a quick test with TSan turned on to see where we're at.
> 
> I think it should be enabled if it works, even this late.
> I bet we need something like the following patch on top of
> the PR79168 patch.
> 
> I'll test both patches on both ppc64le and ppc64.

Sounds good, thanks!  Let me know if I can help in any way.

> 
> Another question is, it seems upstream has s390{,x}-*-linux* support for
> asan/ubsan, does that work?  In that case we should add it to configure.tgt
> too (similarly to the sparc*-*-linux* entry).

CCing Uli for the s390 question.

Bill

> 
> 2017-01-23  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* configure.tgt: Enable tsan and lsan on powerpc64{,le}-*-linux*.
> 
> --- libsanitizer/configure.tgt.jj	2016-11-09 15:22:50.000000000 +0100
> +++ libsanitizer/configure.tgt	2017-01-23 15:25:21.059399613 +0100
> @@ -1,5 +1,5 @@
> # -*- shell-script -*-
> -#   Copyright (C) 2012 Free Software Foundation, Inc.
> +#   Copyright (C) 2012-2017 Free Software Foundation, Inc.
> 
> # This program is free software; you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> @@ -31,6 +31,11 @@ case "${target}" in
> 	fi
> 	;;
>   powerpc*-*-linux*)
> +	if test x$ac_cv_sizeof_void_p = x8; then
> +		TSAN_SUPPORTED=yes
> +		LSAN_SUPPORTED=yes
> +		TSAN_TARGET_DEPENDENT_OBJECTS=tsan_rtl_ppc64.lo
> +	fi
> 	;;
>   sparc*-*-linux*)
> 	;;
> 
> 
> 	Jakub
> 

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

* Re: -fsanitize=thread support on ppc64
  2017-01-23 14:32       ` Jakub Jelinek
  2017-01-23 14:41         ` Bill Schmidt
@ 2017-01-23 14:44         ` Bill Schmidt
  2017-01-23 14:47           ` Jakub Jelinek
  1 sibling, 1 reply; 10+ messages in thread
From: Bill Schmidt @ 2017-01-23 14:44 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Maxim Ostapenko, gcc


> On Jan 23, 2017, at 8:32 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> 
> On Mon, Jan 23, 2017 at 08:22:30AM -0600, Bill Schmidt wrote:
>> TSan support was contributed to LLVM by a student working at one of the US 
>> National Labs a while back.  I helped him with some of the PPC assembly
>> programming.  To my knowledge this is working, but I haven't tested this with
>> GCC.  Do you think we want to change the configuration for GCC this late in the
>> release?  I can run a quick test with TSan turned on to see where we're at.
> 
> I think it should be enabled if it works, even this late.
> I bet we need something like the following patch on top of
> the PR79168 patch.
> 
> I'll test both patches on both ppc64le and ppc64.
> 
> Another question is, it seems upstream has s390{,x}-*-linux* support for
> asan/ubsan, does that work?  In that case we should add it to configure.tgt
> too (similarly to the sparc*-*-linux* entry).
> 
> 2017-01-23  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* configure.tgt: Enable tsan and lsan on powerpc64{,le}-*-linux*.
> 
> --- libsanitizer/configure.tgt.jj	2016-11-09 15:22:50.000000000 +0100
> +++ libsanitizer/configure.tgt	2017-01-23 15:25:21.059399613 +0100
> @@ -1,5 +1,5 @@
> # -*- shell-script -*-
> -#   Copyright (C) 2012 Free Software Foundation, Inc.
> +#   Copyright (C) 2012-2017 Free Software Foundation, Inc.
> 
> # This program is free software; you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> @@ -31,6 +31,11 @@ case "${target}" in
> 	fi
> 	;;
>   powerpc*-*-linux*)

I think you want a separate entry for powerpc64*-*-linux* -- IIRC, the 
existing code will definitely not work for 32-bit due to TLS differences.
Thus be sure we don't enable TSAN for powerpc-*-linux.

Bill

> +	if test x$ac_cv_sizeof_void_p = x8; then
> +		TSAN_SUPPORTED=yes
> +		LSAN_SUPPORTED=yes
> +		TSAN_TARGET_DEPENDENT_OBJECTS=tsan_rtl_ppc64.lo
> +	fi
> 	;;
>   sparc*-*-linux*)
> 	;;
> 
> 
> 	Jakub
> 

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

* Re: -fsanitize=thread support on ppc64
  2017-01-23 14:44         ` Bill Schmidt
@ 2017-01-23 14:47           ` Jakub Jelinek
  2017-01-23 14:48             ` Bill Schmidt
  0 siblings, 1 reply; 10+ messages in thread
From: Jakub Jelinek @ 2017-01-23 14:47 UTC (permalink / raw)
  To: Bill Schmidt; +Cc: Maxim Ostapenko, gcc

On Mon, Jan 23, 2017 at 08:45:16AM -0600, Bill Schmidt wrote:
> > 2017-01-23  Jakub Jelinek  <jakub@redhat.com>
> > 
> > 	* configure.tgt: Enable tsan and lsan on powerpc64{,le}-*-linux*.
> > 
> > --- libsanitizer/configure.tgt.jj	2016-11-09 15:22:50.000000000 +0100
> > +++ libsanitizer/configure.tgt	2017-01-23 15:25:21.059399613 +0100
> > @@ -1,5 +1,5 @@
> > # -*- shell-script -*-
> > -#   Copyright (C) 2012 Free Software Foundation, Inc.
> > +#   Copyright (C) 2012-2017 Free Software Foundation, Inc.
> > 
> > # This program is free software; you can redistribute it and/or modify
> > # it under the terms of the GNU General Public License as published by
> > @@ -31,6 +31,11 @@ case "${target}" in
> > 	fi
> > 	;;
> >   powerpc*-*-linux*)
> 
> I think you want a separate entry for powerpc64*-*-linux* -- IIRC, the 
> existing code will definitely not work for 32-bit due to TLS differences.
> Thus be sure we don't enable TSAN for powerpc-*-linux.

That is handled by the

> > +	if test x$ac_cv_sizeof_void_p = x8; then

test (similarly how for both i?86-*-linux* and x86_64-*-linux* it is enabled
only for LP64 multilib and not others).  We want to enable it only for the
64-bit multilib, not 32-bit.

> > +		TSAN_SUPPORTED=yes
> > +		LSAN_SUPPORTED=yes
> > +		TSAN_TARGET_DEPENDENT_OBJECTS=tsan_rtl_ppc64.lo
> > +	fi
> > 	;;
> >   sparc*-*-linux*)
> > 	;;

	Jakub

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

* Re: -fsanitize=thread support on ppc64
  2017-01-23 14:47           ` Jakub Jelinek
@ 2017-01-23 14:48             ` Bill Schmidt
  0 siblings, 0 replies; 10+ messages in thread
From: Bill Schmidt @ 2017-01-23 14:48 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Maxim Ostapenko, gcc


> On Jan 23, 2017, at 8:47 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> 
> On Mon, Jan 23, 2017 at 08:45:16AM -0600, Bill Schmidt wrote:
>>> 2017-01-23  Jakub Jelinek  <jakub@redhat.com>
>>> 
>>> 	* configure.tgt: Enable tsan and lsan on powerpc64{,le}-*-linux*.
>>> 
>>> --- libsanitizer/configure.tgt.jj	2016-11-09 15:22:50.000000000 +0100
>>> +++ libsanitizer/configure.tgt	2017-01-23 15:25:21.059399613 +0100
>>> @@ -1,5 +1,5 @@
>>> # -*- shell-script -*-
>>> -#   Copyright (C) 2012 Free Software Foundation, Inc.
>>> +#   Copyright (C) 2012-2017 Free Software Foundation, Inc.
>>> 
>>> # This program is free software; you can redistribute it and/or modify
>>> # it under the terms of the GNU General Public License as published by
>>> @@ -31,6 +31,11 @@ case "${target}" in
>>> 	fi
>>> 	;;
>>>  powerpc*-*-linux*)
>> 
>> I think you want a separate entry for powerpc64*-*-linux* -- IIRC, the 
>> existing code will definitely not work for 32-bit due to TLS differences.
>> Thus be sure we don't enable TSAN for powerpc-*-linux.
> 
> That is handled by the
> 
>>> +	if test x$ac_cv_sizeof_void_p = x8; then
> 
> test (similarly how for both i?86-*-linux* and x86_64-*-linux* it is enabled
> only for LP64 multilib and not others).  We want to enable it only for the
> 64-bit multilib, not 32-bit.

Ah, quite right.  Sorry for the sloppy reading.

Bill

> 
>>> +		TSAN_SUPPORTED=yes
>>> +		LSAN_SUPPORTED=yes
>>> +		TSAN_TARGET_DEPENDENT_OBJECTS=tsan_rtl_ppc64.lo
>>> +	fi
>>> 	;;
>>>  sparc*-*-linux*)
>>> 	;;
> 
> 	Jakub
> 

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

* Re: -fsanitize=thread support on ppc64
  2017-01-23 14:41         ` Bill Schmidt
@ 2017-01-23 15:10           ` Ulrich Weigand
  2017-01-23 15:27             ` Jakub Jelinek
  0 siblings, 1 reply; 10+ messages in thread
From: Ulrich Weigand @ 2017-01-23 15:10 UTC (permalink / raw)
  To: Bill Schmidt; +Cc: Maxim Ostapenko, gcc, Jakub Jelinek

Bill Schmidt wrote:
> On Jan 23, 2017, at 8:32 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> >
> > Another question is, it seems upstream has s390{,x}-*-linux* support for
> > asan/ubsan, does that work?  In that case we should add it to configure.tgt
> > too (similarly to the sparc*-*-linux* entry).
> 
> CCing Uli for the s390 question.

Asan support was added just recently to LLVM for s390x-linux.  However,
I'm not sure it will work out-of-the-box on GCC, since we haven't done any
back-end work to enable it.  Also, LLVM is 64-bit only, so there probably
would have to be extra work in the libraries to enable 31-bit mode.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com

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

* Re: -fsanitize=thread support on ppc64
  2017-01-23 15:10           ` Ulrich Weigand
@ 2017-01-23 15:27             ` Jakub Jelinek
  0 siblings, 0 replies; 10+ messages in thread
From: Jakub Jelinek @ 2017-01-23 15:27 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: Bill Schmidt, Maxim Ostapenko, gcc

On Mon, Jan 23, 2017 at 04:10:01PM +0100, Ulrich Weigand wrote:
> Bill Schmidt wrote:
> > On Jan 23, 2017, at 8:32 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> > >
> > > Another question is, it seems upstream has s390{,x}-*-linux* support for
> > > asan/ubsan, does that work?  In that case we should add it to configure.tgt
> > > too (similarly to the sparc*-*-linux* entry).
> > 
> > CCing Uli for the s390 question.
> 
> Asan support was added just recently to LLVM for s390x-linux.  However,
> I'm not sure it will work out-of-the-box on GCC, since we haven't done any
> back-end work to enable it.  Also, LLVM is 64-bit only, so there probably
> would have to be extra work in the libraries to enable 31-bit mode.

It could be enabled for 64-bit s390 only too (by setting
UNSUPPORTED=1
if test x$ac_cv_sizeof_void_p != x8
).
And indeed, it would require at least something like:
/* Implement the TARGET_ASAN_SHADOW_OFFSET hook.  */

static unsigned HOST_WIDE_INT
s390_asan_shadow_offset (void)
{
  return TARGET_64BIT ? (HOST_WIDE_INT_1 << 52) : HOST_WIDE_INT_C (0x20000000);
}

and

#undef TARGET_ASAN_SHADOW_OFFSET
#define TARGET_ASAN_SHADOW_OFFSET s390_asan_shadow_offset

(the constants are just from quick skimming of
libsanitizer/asan/asan_mapping.h).

	Jakub

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

end of thread, other threads:[~2017-01-23 15:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170123113432epcas1p2951bfbb1968a143a14b9c54475ff3527@epcas1p2.samsung.com>
2017-01-23 11:34 ` -fsanitize=thread support on ppc64 Jakub Jelinek
2017-01-23 12:54   ` Maxim Ostapenko
2017-01-23 14:22     ` Bill Schmidt
2017-01-23 14:32       ` Jakub Jelinek
2017-01-23 14:41         ` Bill Schmidt
2017-01-23 15:10           ` Ulrich Weigand
2017-01-23 15:27             ` Jakub Jelinek
2017-01-23 14:44         ` Bill Schmidt
2017-01-23 14:47           ` Jakub Jelinek
2017-01-23 14:48             ` Bill Schmidt

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 read-only IMAP folder(s) and NNTP newsgroup(s).