This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 14/15] Fix tst-mutexpi8
- From: Andi Kleen <andi at firstfloor dot org>
- To: libc-alpha at sourceware dot org
- Cc: hjl dot tools at gmail dot com,Andi Kleen <ak at linux dot intel dot com>
- Date: Sat, 22 Dec 2012 19:02:41 -0800
- Subject: [PATCH 14/15] Fix tst-mutexpi8
- References: <1356231762-23777-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
tst-mutexpi8 didn't actually test PI because tst-mutex8 didn't have any
code to enable priority inheritance. Add the needed code in a ifdef.
This also fixes it for lock elision because priority inheritance turns
off elision, so we don't need to explicitely disable it.
2012-12-22 Andi Kleen <ak@linux.intel.com>
* nptl/tst-mutex8.c: Check for ENABLE_PI
* nptl/tst-mutexpi8.c: Set ENABLE_PI.
---
nptl/tst-mutex8.c | 22 +++++++++++++++++++++-
nptl/tst-mutexpi8.c | 1 +
2 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/nptl/tst-mutex8.c b/nptl/tst-mutex8.c
index f30c106..61c69b5 100644
--- a/nptl/tst-mutex8.c
+++ b/nptl/tst-mutex8.c
@@ -344,7 +344,13 @@ do_test (void)
puts ("0th mutexattr_settype failed");
return 1;
}
-
+#ifdef ENABLE_PI
+ if (pthread_mutexattr_setprotocol (&ma, PTHREAD_PRIO_INHERIT))
+ {
+ puts ("pthread_mutexattr_setprotocol2 failed");
+ return 1;
+ }
+#endif
puts ("check " NAME " mutex");
int res = check_type (NAME, &ma);
#else
@@ -362,6 +368,13 @@ do_test (void)
puts ("1st mutexattr_settype failed");
return 1;
}
+#ifdef ENABLE_PI
+ if (pthread_mutexattr_setprotocol (&ma, PTHREAD_PRIO_INHERIT))
+ {
+ puts ("pthread_mutexattr_setprotocol2 failed");
+ return 1;
+ }
+#endif
puts ("check recursive mutex");
res |= check_type ("recursive", &ma);
if (pthread_mutexattr_destroy (&ma) != 0)
@@ -380,6 +393,13 @@ do_test (void)
puts ("2nd mutexattr_settype failed");
return 1;
}
+#ifdef ENABLE_PI
+ if (pthread_mutexattr_setprotocol (&ma, PTHREAD_PRIO_INHERIT))
+ {
+ puts ("pthread_mutexattr_setprotocol3 failed");
+ return 1;
+ }
+#endif
puts ("check error-checking mutex");
res |= check_type ("error-checking", &ma);
if (pthread_mutexattr_destroy (&ma) != 0)
diff --git a/nptl/tst-mutexpi8.c b/nptl/tst-mutexpi8.c
index cea6030..4aae694 100644
--- a/nptl/tst-mutexpi8.c
+++ b/nptl/tst-mutexpi8.c
@@ -1,2 +1,3 @@
+#define TYPE PTHREAD_MUTEX_TIMED_NP
#define ENABLE_PI 1
#include "tst-mutex8.c"
--
1.7.7.6