The following might override the HTM lock elision. Can someone try it to see if it works?
bergner@ampere:~$ cat pthread_mutex_lock.c #include <pthread.h>
#define PTHREAD_MUTEX_NO_ELISION_NP 512 extern int __pthread_mutex_lock (pthread_mutex_t *);
int pthread_mutex_lock (pthread_mutex_t *mutex) { mutex->__data.__kind |= PTHREAD_MUTEX_NO_ELISION_NP; return __pthread_mutex_lock (mutex); } bergner@ampere:~$ gcc -c -fPIC pthread_mutex_lock.c bergner@ampere:~$ gcc -shared -Wl,-soname,libfoo.so.1 -o libfoo.so.1 pthread_mutex_lock.o bergner@ampere:~$ LD_PRELOAD=./libfoo.so.1 ./a.out
...replacing ./a.out with the binary you want to run without lock elision.
The following might override the HTM lock elision. Can someone try it to see if it works?
bergner@ampere:~$ cat pthread_ mutex_lock. c
#include <pthread.h>
#define PTHREAD_ MUTEX_NO_ ELISION_ NP 512 mutex_lock (pthread_mutex_t *);
extern int __pthread_
int >__data. __kind |= PTHREAD_ MUTEX_NO_ ELISION_ NP; mutex_lock (mutex); mutex_lock. c libfoo. so.1 -o libfoo.so.1 pthread_ mutex_lock. o ./libfoo. so.1 ./a.out
pthread_mutex_lock (pthread_mutex_t *mutex)
{
mutex-
return __pthread_
}
bergner@ampere:~$ gcc -c -fPIC pthread_
bergner@ampere:~$ gcc -shared -Wl,-soname,
bergner@ampere:~$ LD_PRELOAD=
...replacing ./a.out with the binary you want to run without lock elision.