|
|
8ae002 |
commit 68cc29355f3334c7ad18f648ff9a6383a0916d23
|
|
|
8ae002 |
Author: Andi Kleen <ak@linux.intel.com>
|
|
|
8ae002 |
Date: Fri Jun 28 05:19:37 2013 -0700
|
|
|
8ae002 |
|
|
|
8ae002 |
Add minimal test suite changes for elision enabled kernels
|
|
|
8ae002 |
|
|
|
8ae002 |
tst-mutex5 and 8 test some behaviour not required by POSIX,
|
|
|
8ae002 |
that elision changes. This changes these tests to not check
|
|
|
8ae002 |
this when elision is enabled at configure time.
|
|
|
8ae002 |
Index: glibc-2.17-c758a686/nptl/tst-mutex5.c
|
|
|
8ae002 |
===================================================================
|
|
|
8ae002 |
--- glibc-2.17-c758a686.orig/nptl/tst-mutex5.c
|
|
|
8ae002 |
+++ glibc-2.17-c758a686/nptl/tst-mutex5.c
|
|
|
8ae002 |
@@ -22,6 +22,7 @@
|
|
|
8ae002 |
#include <time.h>
|
|
|
8ae002 |
#include <unistd.h>
|
|
|
8ae002 |
#include <sys/time.h>
|
|
|
8ae002 |
+#include <config.h>
|
|
|
8ae002 |
|
|
|
8ae002 |
|
|
|
8ae002 |
#ifndef TYPE
|
|
|
8ae002 |
@@ -85,6 +86,8 @@ do_test (void)
|
|
|
8ae002 |
return 1;
|
|
|
8ae002 |
}
|
|
|
8ae002 |
|
|
|
8ae002 |
+ /* Elided locks do not time out. */
|
|
|
8ae002 |
+#ifdef ENABLE_LOCK_ELISION
|
|
|
8ae002 |
if (pthread_mutex_trylock (&m) == 0)
|
|
|
8ae002 |
{
|
|
|
8ae002 |
puts ("mutex_trylock succeeded");
|
|
|
8ae002 |
@@ -180,6 +183,7 @@ do_test (void)
|
|
|
8ae002 |
puts ("3rd timedlock didn't return right away");
|
|
|
8ae002 |
return 1;
|
|
|
8ae002 |
}
|
|
|
8ae002 |
+#endif
|
|
|
8ae002 |
|
|
|
8ae002 |
if (pthread_mutex_unlock (&m) != 0)
|
|
|
8ae002 |
{
|
|
|
8ae002 |
Index: glibc-2.17-c758a686/nptl/tst-mutex8.c
|
|
|
8ae002 |
===================================================================
|
|
|
8ae002 |
--- glibc-2.17-c758a686.orig/nptl/tst-mutex8.c
|
|
|
8ae002 |
+++ glibc-2.17-c758a686/nptl/tst-mutex8.c
|
|
|
8ae002 |
@@ -93,6 +93,8 @@ tf (void *arg)
|
|
|
8ae002 |
static int
|
|
|
8ae002 |
check_type (const char *mas, pthread_mutexattr_t *ma)
|
|
|
8ae002 |
{
|
|
|
8ae002 |
+ int e __attribute__((unused));
|
|
|
8ae002 |
+
|
|
|
8ae002 |
if (pthread_mutex_init (m, ma) != 0)
|
|
|
8ae002 |
{
|
|
|
8ae002 |
printf ("1st mutex_init failed for %s\n", mas);
|
|
|
8ae002 |
@@ -117,7 +119,10 @@ check_type (const char *mas, pthread_mut
|
|
|
8ae002 |
return 1;
|
|
|
8ae002 |
}
|
|
|
8ae002 |
|
|
|
8ae002 |
- int e = pthread_mutex_destroy (m);
|
|
|
8ae002 |
+ /* Elided mutexes don't fail destroy. If elision is not explicitly disabled
|
|
|
8ae002 |
+ we don't know, so can also not check this. */
|
|
|
8ae002 |
+#ifndef ENABLE_LOCK_ELISION
|
|
|
8ae002 |
+ e = pthread_mutex_destroy (m);
|
|
|
8ae002 |
if (e == 0)
|
|
|
8ae002 |
{
|
|
|
8ae002 |
printf ("mutex_destroy of self-locked mutex succeeded for %s\n", mas);
|
|
|
8ae002 |
@@ -129,6 +134,7 @@ check_type (const char *mas, pthread_mut
|
|
|
8ae002 |
mas);
|
|
|
8ae002 |
return 1;
|
|
|
8ae002 |
}
|
|
|
8ae002 |
+#endif
|
|
|
8ae002 |
|
|
|
8ae002 |
if (pthread_mutex_unlock (m) != 0)
|
|
|
8ae002 |
{
|
|
|
8ae002 |
@@ -142,6 +148,8 @@ check_type (const char *mas, pthread_mut
|
|
|
8ae002 |
return 1;
|
|
|
8ae002 |
}
|
|
|
8ae002 |
|
|
|
8ae002 |
+ /* Elided mutexes don't fail destroy. */
|
|
|
8ae002 |
+#ifndef ENABLE_LOCK_ELISION
|
|
|
8ae002 |
e = pthread_mutex_destroy (m);
|
|
|
8ae002 |
if (e == 0)
|
|
|
8ae002 |
{
|
|
|
8ae002 |
@@ -155,6 +163,7 @@ mutex_destroy of self-trylocked mutex di
|
|
|
8ae002 |
mas);
|
|
|
8ae002 |
return 1;
|
|
|
8ae002 |
}
|
|
|
8ae002 |
+#endif
|
|
|
8ae002 |
|
|
|
8ae002 |
if (pthread_mutex_unlock (m) != 0)
|
|
|
8ae002 |
{
|
|
|
8ae002 |
@@ -189,6 +198,8 @@ mutex_destroy of self-trylocked mutex di
|
|
|
8ae002 |
return 1;
|
|
|
8ae002 |
}
|
|
|
8ae002 |
|
|
|
8ae002 |
+ /* Elided mutexes don't fail destroy. */
|
|
|
8ae002 |
+#ifndef ENABLE_LOCK_ELISION
|
|
|
8ae002 |
e = pthread_mutex_destroy (m);
|
|
|
8ae002 |
if (e == 0)
|
|
|
8ae002 |
{
|
|
|
8ae002 |
@@ -201,6 +212,7 @@ mutex_destroy of self-trylocked mutex di
|
|
|
8ae002 |
mutex_destroy of condvar-used mutex did not return EBUSY for %s\n", mas);
|
|
|
8ae002 |
return 1;
|
|
|
8ae002 |
}
|
|
|
8ae002 |
+#endif
|
|
|
8ae002 |
|
|
|
8ae002 |
done = true;
|
|
|
8ae002 |
if (pthread_cond_signal (&c) != 0)
|
|
|
8ae002 |
@@ -259,6 +271,8 @@ mutex_destroy of condvar-used mutex did
|
|
|
8ae002 |
return 1;
|
|
|
8ae002 |
}
|
|
|
8ae002 |
|
|
|
8ae002 |
+ /* Elided mutexes don't fail destroy. */
|
|
|
8ae002 |
+#ifndef ENABLE_LOCK_ELISION
|
|
|
8ae002 |
e = pthread_mutex_destroy (m);
|
|
|
8ae002 |
if (e == 0)
|
|
|
8ae002 |
{
|
|
|
8ae002 |
@@ -273,6 +287,7 @@ mutex_destroy of condvar-used mutex did
|
|
|
8ae002 |
mas);
|
|
|
8ae002 |
return 1;
|
|
|
8ae002 |
}
|
|
|
8ae002 |
+#endif
|
|
|
8ae002 |
|
|
|
8ae002 |
if (pthread_cancel (th) != 0)
|
|
|
8ae002 |
{
|