[PATCH, rs6000] Allow libitm to use HTM on newer hw and kernels

Segher Boessenkool segher@kernel.crashing.org
Wed Dec 12 20:52:00 GMT 2018


On Wed, Dec 12, 2018 at 01:47:02PM -0600, Peter Bergner wrote:
> Libitm on POWER hardware looks for the "htm" bit in AT_HWCAP2 to determine
> whether it can use HTM when executing code within __transaction_atomic
> code blocks.  However, on newer hardware and kernels, the "htm" bit is no
> longer set and instead the "htm-no-suspend" bit is set, so we currently
> don't use HTM on new hw and kernels.  The following patch adds support
> for htm-no-suspend to libitm.  I have also added code to use the
> __builtin_cpu_supports() builtin if it is available, since that is
> much faster than using the getauxval libc call.
> 
> This passed bootstrap and regtesting with no errors and someone within
> IBM how had a POWER9 box with a newish kernel how ran into the problem
> confirmed it works for his test case.
> 
> Ok for mainline?  Should be backport this?

Okay for trunk (but see comment below).  I think it should be backported
yes, to 8 at least, probably 7.  Okay for those too.

> +/* This is a fairly new feature bit, so handle it not being defined.  */
> +#ifndef PPC_FEATURE2_HTM_NO_SUSPEND
> +# define PPC_FEATURE2_HTM_NO_SUSPEND 0
> +#endif

Doing it this way can be pretty surprising for users not aware you defined
it to 0.  Since there are no other users yet it's no big deal.


Segher



More information about the Gcc-patches mailing list