|
From: <sv...@va...> - 2008-03-24 08:48:09
|
Author: bart
Date: 2008-03-24 08:48:14 +0000 (Mon, 24 Mar 2008)
New Revision: 7771
Log:
Merged trunk changes r7760:7770 to DRDDEV branch.
Modified:
branches/DRDDEV/exp-drd/TODO.txt
branches/DRDDEV/exp-drd/docs/README.txt
branches/DRDDEV/exp-drd/drd_clientreq.c
branches/DRDDEV/exp-drd/drd_clientreq.h
branches/DRDDEV/exp-drd/drd_main.c
branches/DRDDEV/exp-drd/drd_mutex.c
branches/DRDDEV/exp-drd/drd_mutex.h
branches/DRDDEV/exp-drd/drd_pthread_intercepts.c
branches/DRDDEV/exp-drd/drd_track.h
branches/DRDDEV/glibc-2.X-drd.supp
Modified: branches/DRDDEV/exp-drd/TODO.txt
===================================================================
--- branches/DRDDEV/exp-drd/TODO.txt 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/TODO.txt 2008-03-24 08:48:14 UTC (rev 7771)
@@ -4,26 +4,15 @@
Data-race detection algorithm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Implement segment merging, such that the number of segments per thread
- remains limited even when there is no synchronization between threads.
-- Add locking order checking.
-- Discuss on the Valgrind mailing list how to make it possible to call
- POSIX thread synchronization primitives from client code (drd_intercepts.c)
- without triggering Valgrind's redirection mechanism.
- Make sure -v works again with exp-drd.
+- Add locking order checking.
- Continue the discussion on the Valgrind mailing list about docbook and
'make dist'.
-- Continue the discussion on the Valgrind mailing list about -Wformat.
-- Enable format string checking for DRD during compilation.
-- Propose to modify tl_assert() / vg_assert() such that it uses
- __builtin_expect.
- Explain on the Valgrind mailing list the difference between a bus lock
and acquire / release labels.
- Add configure tests for the name of the 'kind' member in pthread_mutex_t.
- Find out why a race is reported on std::string::string(std::string const&)
(stc test case 16).
-- Find out why no races are reported on matinv_openmp.c when "private(k)" is
- removed.
- Add support for objects that are shared over threads and that use reference
counting, e.g. std::string -- no races should be reported on the reference
count.
@@ -35,18 +24,14 @@
- Find out why no line number or variable name information is printed for
races detected in parallel sections of OpenMP programs. An example:
./vg-in-place --tool=exp-drd exp-drd/tests/omp_prime 4 -t 2
-- Find a way for suppressing races reported on _IO_2_1_stdout. This race is
- triggered by calling printf() from more than one thread. Examples (AMD64):
- ./vg-in-place --tool=exp-drd exp-drd/tests/tc21_pthonce
- Find out why 'matinv 400' runs faster in 32-bit mode than in 64-bit mode
on the same CPU.
- testing on PPC and AIX (current implementation is only tested on X86 and
AMD64).
- Convert the array in drd_thread.c with thread information into an OSet.
-- Performance testing and tuning.
-- Optimize run time of the following test case:
- ./vg-in-place --tool=exp-drd exp-drd/tests/matinv 100
+- Performance testing and tuning, a.o. for kate / knode / open office / matinv.
+
Testing
~~~~~~~
- testing with more complex multithreaded test programs.
@@ -68,13 +53,3 @@
~~~~~~~~~~~
- Does not work with a glibc library compiled with linuxthreads -- NPTL is
required for proper operation.
-
-
-Known bugs
-~~~~~~~~~~
-- Gets killed by the OOM handler for realistically sized applications,
- e.g. knode and OpenOffice.
-- [x86_64] Reports "Allocation context: unknown" for BSS symbols on AMD64
- (works fine on i386). This is a bug in Valgrind's debug info reader
- -- VG_(find_seginfo)() returns NULL for BSS symbols on x86_64. Not yet in
- the KDE bug tracking system.
Modified: branches/DRDDEV/exp-drd/docs/README.txt
===================================================================
--- branches/DRDDEV/exp-drd/docs/README.txt 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/docs/README.txt 2008-03-24 08:48:14 UTC (rev 7771)
@@ -301,10 +301,7 @@
Future DRD Versions
-------------------
The following may be expected in future versions of DRD:
-* Drastically reduced memory consumption, such that realistic applications can
- be analyzed with DRD.
* A lock dependency analyzer, as a help in deadlock prevention.
-* Faster operation.
* More extensive documentation.
* Support for PowerPC CPU's.
Modified: branches/DRDDEV/exp-drd/drd_clientreq.c
===================================================================
--- branches/DRDDEV/exp-drd/drd_clientreq.c 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/drd_clientreq.c 2008-03-24 08:48:14 UTC (rev 7771)
@@ -147,7 +147,7 @@
case VG_USERREQ__PRE_MUTEX_LOCK:
if (thread_enter_synchr(drd_tid) == 0)
- drd_pre_mutex_lock(arg[1], arg[2]);
+ drd_pre_mutex_lock(arg[1], arg[2], arg[3]);
break;
case VG_USERREQ__POST_MUTEX_LOCK:
Modified: branches/DRDDEV/exp-drd/drd_clientreq.h
===================================================================
--- branches/DRDDEV/exp-drd/drd_clientreq.h 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/drd_clientreq.h 2008-03-24 08:48:14 UTC (rev 7771)
@@ -57,7 +57,7 @@
/* args: Addr, MutexT */
/* to notify the drd tool of pthread_mutex_lock calls */
VG_USERREQ__PRE_MUTEX_LOCK,
- /* args: Addr, MutexT */
+ /* args: Addr, MutexT, Bool */
/* to notify the drd tool of pthread_mutex_lock calls */
VG_USERREQ__POST_MUTEX_LOCK,
/* args: Addr, Bool */
Modified: branches/DRDDEV/exp-drd/drd_main.c
===================================================================
--- branches/DRDDEV/exp-drd/drd_main.c 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/drd_main.c 2008-03-24 08:48:14 UTC (rev 7771)
@@ -628,9 +628,10 @@
mutex_post_destroy(mutex);
}
-void drd_pre_mutex_lock(const Addr mutex, const MutexT mutex_type)
+void drd_pre_mutex_lock(const Addr mutex, const MutexT mutex_type,
+ const Bool trylock)
{
- mutex_pre_lock(mutex, mutex_type);
+ mutex_pre_lock(mutex, mutex_type, trylock);
}
void drd_post_mutex_lock(const Addr mutex, const Bool took_lock)
Modified: branches/DRDDEV/exp-drd/drd_mutex.c
===================================================================
--- branches/DRDDEV/exp-drd/drd_mutex.c 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/drd_mutex.c 2008-03-24 08:48:14 UTC (rev 7771)
@@ -201,14 +201,12 @@
* an attempt is made to lock recursively a synchronization object that must
* not be locked recursively.
*/
-void mutex_pre_lock(const Addr mutex, MutexT mutex_type)
+void mutex_pre_lock(const Addr mutex, const MutexT mutex_type,
+ const Bool trylock)
{
struct mutex_info* p;
p = mutex_get_or_allocate(mutex, mutex_type);
-
- tl_assert(p);
-
if (s_trace_mutex)
{
VG_(message)(Vg_UserMsg,
@@ -217,10 +215,23 @@
thread_get_running_tid(),
mutex_get_typename(p),
mutex,
- p->recursion_count,
- p->owner);
+ p ? p->recursion_count : -1,
+ p ? p->owner : DRD_INVALID_THREADID);
}
+ if (p == 0)
+ {
+ GenericErrInfo GEI;
+ VG_(maybe_record_error)(VG_(get_running_tid)(),
+ GenericErr,
+ VG_(get_IP)(VG_(get_running_tid)()),
+ "Not a mutex",
+ &GEI);
+ return;
+ }
+
+ tl_assert(p);
+
if (mutex_type == mutex_type_invalid_mutex)
{
GenericErrInfo GEI;
@@ -232,7 +243,8 @@
return;
}
- if (p->owner == thread_get_running_tid()
+ if (! trylock
+ && p->owner == thread_get_running_tid()
&& p->recursion_count >= 1
&& mutex_type != mutex_type_recursive_mutex)
{
Modified: branches/DRDDEV/exp-drd/drd_mutex.h
===================================================================
--- branches/DRDDEV/exp-drd/drd_mutex.h 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/drd_mutex.h 2008-03-24 08:48:14 UTC (rev 7771)
@@ -44,8 +44,8 @@
const MutexT mutex_type);
void mutex_post_destroy(const Addr mutex);
struct mutex_info* mutex_get(const Addr mutex);
-void mutex_pre_lock(const Addr mutex,
- const MutexT mutex_type);
+void mutex_pre_lock(const Addr mutex, const MutexT mutex_type,
+ const Bool trylock);
void mutex_post_lock(const Addr mutex, const Bool took_lock);
void mutex_unlock(const Addr mutex, const MutexT mutex_type);
const char* mutex_get_typename(struct mutex_info* const p);
Modified: branches/DRDDEV/exp-drd/drd_pthread_intercepts.c
===================================================================
--- branches/DRDDEV/exp-drd/drd_pthread_intercepts.c 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/drd_pthread_intercepts.c 2008-03-24 08:48:14 UTC (rev 7771)
@@ -375,7 +375,7 @@
OrigFn fn;
VALGRIND_GET_ORIG_FN(fn);
VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__PRE_MUTEX_LOCK,
- mutex, mutex_type(mutex), 0, 0, 0);
+ mutex, mutex_type(mutex), 1, 0, 0);
CALL_FN_W_W(ret, fn, mutex);
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_MUTEX_LOCK,
mutex, ret == 0, 0, 0, 0);
Modified: branches/DRDDEV/exp-drd/drd_track.h
===================================================================
--- branches/DRDDEV/exp-drd/drd_track.h 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/exp-drd/drd_track.h 2008-03-24 08:48:14 UTC (rev 7771)
@@ -29,7 +29,8 @@
void drd_pre_mutex_init(Addr mutex, const MutexT mutex_type);
void drd_post_mutex_destroy(Addr mutex, const MutexT mutex_type);
-void drd_pre_mutex_lock(const Addr mutex, const MutexT mutex_type);
+void drd_pre_mutex_lock(const Addr mutex, const MutexT mutex_type,
+ const Bool trylock);
void drd_post_mutex_lock(Addr mutex, const Bool took_lock);
void drd_pre_mutex_unlock(const Addr mutex, const MutexT mutex_type);
Modified: branches/DRDDEV/glibc-2.X-drd.supp
===================================================================
--- branches/DRDDEV/glibc-2.X-drd.supp 2008-03-24 08:35:03 UTC (rev 7770)
+++ branches/DRDDEV/glibc-2.X-drd.supp 2008-03-24 08:48:14 UTC (rev 7771)
@@ -38,6 +38,13 @@
obj:/lib*/ld-*.so
}
{
+ dl-dlsym
+ exp-drd:ConflictingAccess
+ obj:/lib*/ld-*.so
+ obj:/lib*/libc-*.so
+ obj:/lib*/libdl-*.so
+}
+{
libc
exp-drd:ConflictingAccess
fun:__libc_enable_asynccancel
|