diff mbox

libitm: Introduce target macro TARGET_BEGIN_TRANSACTION_ATTRIBUTE.

Message ID 20160201131848.GB7253@linux.vnet.ibm.com
State New
Headers show

Commit Message

Dominik Vogt Feb. 1, 2016, 1:18 p.m. UTC
The attached patch adds the a target specific attribute via the
new target macro TARGET_BEGIN_TRANSACTION_ATTRIBUTE to the
function begin_transaction().  S/390 uses this to set the
soft-float target attribute which is needed to fix a crash with
-m31.

As there seems to be no place in libitm to document internal macros like
USE_HTM_FASTPATH or the new macro, I've put the documentation in a
comment where the macro is used.

Ciao

Dominik ^_^  ^_^

Comments

Dominik Vogt Feb. 22, 2016, 11:50 a.m. UTC | #1
On Mon, Feb 01, 2016 at 02:18:48PM +0100, Dominik Vogt wrote:
> The attached patch adds the a target specific attribute via the
> new target macro TARGET_BEGIN_TRANSACTION_ATTRIBUTE to the
> function begin_transaction().  S/390 uses this to set the
> soft-float target attribute which is needed to fix a crash with
> -m31.
> 
> As there seems to be no place in libitm to document internal macros like
> USE_HTM_FASTPATH or the new macro, I've put the documentation in a
> comment where the macro is used.

Please note that we're waiting for approval of the libitm
maintainer, not for approval of the s390 maintainer.

> libitm/ChangeLog
> 
> 	* config/s390/target.h (TARGET_BEGIN_TRANSACTION_ATTRIBUTE): Define
> 	function attribute to disable floating point in begin_transaction() on
> 	S/390.
> 	* beginend.cc (begin_transaction): Use
> 	TARGET_BEGIN_TRANSACTION_ATTRIBUTE.

> >From a5c8087753ab1f42082b9ab44d443005ed2c53ba Mon Sep 17 00:00:00 2001
> From: Dominik Vogt <vogt@linux.vnet.ibm.com>
> Date: Mon, 1 Feb 2016 14:07:55 +0100
> Subject: [PATCH] libitm: Introduce target macro
>  TARGET_BEGIN_TRANSACTION_ATTRIBUTE.
> 
> The macro can be used to add attributes to the function begin_transaction.  Set
> it for S/390 to switch of harware floating point.
> ---
>  libitm/beginend.cc          | 6 ++++++
>  libitm/config/s390/target.h | 3 +++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/libitm/beginend.cc b/libitm/beginend.cc
> index 1a258ad..20b5547 100644
> --- a/libitm/beginend.cc
> +++ b/libitm/beginend.cc
> @@ -149,6 +149,12 @@ choose_code_path(uint32_t prop, abi_dispatch *disp)
>      return a_runInstrumentedCode;
>  }
>  
> +#ifdef TARGET_BEGIN_TRANSACTION_ATTRIBUTE
> +/* This macro can be used to define target specific attributes for this
> +   function.  For example, S/390 requires floating point to be disabled in
> +   begin_transaction.  */
> +TARGET_BEGIN_TRANSACTION_ATTRIBUTE
> +#endif
>  uint32_t
>  GTM::gtm_thread::begin_transaction (uint32_t prop, const gtm_jmpbuf *jb)
>  {
> diff --git a/libitm/config/s390/target.h b/libitm/config/s390/target.h
> index 44819a4..c9d5203 100644
> --- a/libitm/config/s390/target.h
> +++ b/libitm/config/s390/target.h
> @@ -69,6 +69,9 @@ cpu_relax (void)
>  /* Number of retries for transient failures.  */
>  #define _HTM_ITM_RETRIES 10
>  #define USE_HTM_FASTPATH
> +#define TARGET_BEGIN_TRANSACTION_ATTRIBUTE \
> +  __attribute__ ((target("soft-float")))
> +
>  
>  static inline bool
>  htm_available ()
> -- 
> 2.3.0
> 



Ciao

Dominik ^_^  ^_^
Dominik Vogt March 2, 2016, 6:36 a.m. UTC | #2
On Mon, Feb 01, 2016 at 02:18:48PM +0100, Dominik Vogt wrote:
> The attached patch adds the a target specific attribute via the
> new target macro TARGET_BEGIN_TRANSACTION_ATTRIBUTE to the
> function begin_transaction().  S/390 uses this to set the
> soft-float target attribute which is needed to fix a crash with
> -m31.
> 
> As there seems to be no place in libitm to document internal macros like
> USE_HTM_FASTPATH or the new macro, I've put the documentation in a
> comment where the macro is used.

Please note that we're waiting for approval of the libitm
maintainer, not for approval of the s390 maintainer.

> libitm/ChangeLog
> 
> 	* config/s390/target.h (TARGET_BEGIN_TRANSACTION_ATTRIBUTE): Define
> 	function attribute to disable floating point in begin_transaction() on
> 	S/390.
> 	* beginend.cc (begin_transaction): Use
> 	TARGET_BEGIN_TRANSACTION_ATTRIBUTE.

> >From a5c8087753ab1f42082b9ab44d443005ed2c53ba Mon Sep 17 00:00:00 2001
> From: Dominik Vogt <vogt@linux.vnet.ibm.com>
> Date: Mon, 1 Feb 2016 14:07:55 +0100
> Subject: [PATCH] libitm: Introduce target macro
>  TARGET_BEGIN_TRANSACTION_ATTRIBUTE.
> 
> The macro can be used to add attributes to the function begin_transaction.  Set
> it for S/390 to switch of harware floating point.
> ---
>  libitm/beginend.cc          | 6 ++++++
>  libitm/config/s390/target.h | 3 +++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/libitm/beginend.cc b/libitm/beginend.cc
> index 1a258ad..20b5547 100644
> --- a/libitm/beginend.cc
> +++ b/libitm/beginend.cc
> @@ -149,6 +149,12 @@ choose_code_path(uint32_t prop, abi_dispatch *disp)
>      return a_runInstrumentedCode;
>  }
>  
> +#ifdef TARGET_BEGIN_TRANSACTION_ATTRIBUTE
> +/* This macro can be used to define target specific attributes for this
> +   function.  For example, S/390 requires floating point to be disabled in
> +   begin_transaction.  */
> +TARGET_BEGIN_TRANSACTION_ATTRIBUTE
> +#endif
>  uint32_t
>  GTM::gtm_thread::begin_transaction (uint32_t prop, const gtm_jmpbuf *jb)
>  {
> diff --git a/libitm/config/s390/target.h b/libitm/config/s390/target.h
> index 44819a4..c9d5203 100644
> --- a/libitm/config/s390/target.h
> +++ b/libitm/config/s390/target.h
> @@ -69,6 +69,9 @@ cpu_relax (void)
>  /* Number of retries for transient failures.  */
>  #define _HTM_ITM_RETRIES 10
>  #define USE_HTM_FASTPATH
> +#define TARGET_BEGIN_TRANSACTION_ATTRIBUTE \
> +  __attribute__ ((target("soft-float")))
> +
>  
>  static inline bool
>  htm_available ()
> -- 
> 2.3.0
> 



Ciao

Dominik ^_^  ^_^
Torvald Riegel March 2, 2016, 7:56 p.m. UTC | #3
On Wed, 2016-03-02 at 07:36 +0100, Dominik Vogt wrote:
> On Mon, Feb 01, 2016 at 02:18:48PM +0100, Dominik Vogt wrote:
> > The attached patch adds the a target specific attribute via the
> > new target macro TARGET_BEGIN_TRANSACTION_ATTRIBUTE to the
> > function begin_transaction().  S/390 uses this to set the
> > soft-float target attribute which is needed to fix a crash with
> > -m31.
> > 
> > As there seems to be no place in libitm to document internal macros like
> > USE_HTM_FASTPATH or the new macro, I've put the documentation in a
> > comment where the macro is used.
> 
> Please note that we're waiting for approval of the libitm
> maintainer, not for approval of the s390 maintainer.

LGTM.  Sorry for missing this patch.  Please CC me on libitm patches if
I don't respond quickly.

Thanks.
Andreas Krebbel March 3, 2016, 9:32 a.m. UTC | #4
On 02/01/2016 02:18 PM, Dominik Vogt wrote:
> The attached patch adds the a target specific attribute via the
> new target macro TARGET_BEGIN_TRANSACTION_ATTRIBUTE to the
> function begin_transaction().  S/390 uses this to set the
> soft-float target attribute which is needed to fix a crash with
> -m31.
> 
> As there seems to be no place in libitm to document internal macros like
> USE_HTM_FASTPATH or the new macro, I've put the documentation in a
> comment where the macro is used.

Applied. Thanks!

-Andreas-
diff mbox

Patch

From a5c8087753ab1f42082b9ab44d443005ed2c53ba Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Mon, 1 Feb 2016 14:07:55 +0100
Subject: [PATCH] libitm: Introduce target macro
 TARGET_BEGIN_TRANSACTION_ATTRIBUTE.

The macro can be used to add attributes to the function begin_transaction.  Set
it for S/390 to switch of harware floating point.
---
 libitm/beginend.cc          | 6 ++++++
 libitm/config/s390/target.h | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/libitm/beginend.cc b/libitm/beginend.cc
index 1a258ad..20b5547 100644
--- a/libitm/beginend.cc
+++ b/libitm/beginend.cc
@@ -149,6 +149,12 @@  choose_code_path(uint32_t prop, abi_dispatch *disp)
     return a_runInstrumentedCode;
 }
 
+#ifdef TARGET_BEGIN_TRANSACTION_ATTRIBUTE
+/* This macro can be used to define target specific attributes for this
+   function.  For example, S/390 requires floating point to be disabled in
+   begin_transaction.  */
+TARGET_BEGIN_TRANSACTION_ATTRIBUTE
+#endif
 uint32_t
 GTM::gtm_thread::begin_transaction (uint32_t prop, const gtm_jmpbuf *jb)
 {
diff --git a/libitm/config/s390/target.h b/libitm/config/s390/target.h
index 44819a4..c9d5203 100644
--- a/libitm/config/s390/target.h
+++ b/libitm/config/s390/target.h
@@ -69,6 +69,9 @@  cpu_relax (void)
 /* Number of retries for transient failures.  */
 #define _HTM_ITM_RETRIES 10
 #define USE_HTM_FASTPATH
+#define TARGET_BEGIN_TRANSACTION_ATTRIBUTE \
+  __attribute__ ((target("soft-float")))
+
 
 static inline bool
 htm_available ()
-- 
2.3.0