olga / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

Blame SOURCES/glibc-rh841653-2.patch

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