You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
1
(21) |
|
2
(19) |
3
(33) |
4
(24) |
5
(18) |
6
(13) |
7
(22) |
8
(21) |
|
9
(38) |
10
(25) |
11
(20) |
12
(27) |
13
(43) |
14
(9) |
15
(19) |
|
16
(37) |
17
(19) |
18
(13) |
19
(11) |
20
(8) |
21
(11) |
22
(25) |
|
23
(21) |
24
(30) |
25
(18) |
26
(11) |
27
(10) |
28
(14) |
29
(40) |
|
30
(24) |
31
(14) |
|
|
|
|
|
|
From: <sv...@va...> - 2008-03-13 20:33:26
|
Author: sewardj
Date: 2008-03-13 20:33:29 +0000 (Thu, 13 Mar 2008)
New Revision: 7677
Log:
Whack another performance problem on the head (is there no end to the
damn things?) When setting the state of shadow memory to "New", do
not force into the SVal cache, lines which are not already in there
(at least, those lines which are going to be completely set to New).
Instead operate directly on the compressed representation.
Modified:
branches/HGDEV/helgrind/hg_main.c
Modified: branches/HGDEV/helgrind/hg_main.c
===================================================================
--- branches/HGDEV/helgrind/hg_main.c 2008-03-13 20:11:33 UTC (rev 7676)
+++ branches/HGDEV/helgrind/hg_main.c 2008-03-13 20:33:29 UTC (rev 7677)
@@ -2412,7 +2412,10 @@
tl_assert(SEG_id_is_sane(segid2));
tl_assert(segid1 != segid2);
stats__hbefore_queries++;
- hash = (ROL32(segid1,19) ^ ROL32(segid2,13)) % HBEFORE__N_HTABLE;
+ hash = ROL32(segid1,19) ^ ROL32(segid2,13);
+ /* make sure % is done at 32 bits, since % on a 64-bit
+ value on a 32-bit machine is very expensive. */
+ hash %= HBEFORE__N_HTABLE;
{ // try hash table
// Hmm, % on ULong is OK on 64-bit machine (32ish cycles on Core2)
// but really bad on 32-bit (there is a call to umoddi3 and that
@@ -2549,6 +2552,8 @@
static UWord stats__cache_flushes = 0; // # cache flushes
static UWord stats__cache_totrefs = 0; // # total accesses
static UWord stats__cache_totmisses = 0; // # misses
+static ULong stats__cache_make_New_arange = 0; // total arange made New
+static ULong stats__cache_make_New_inZrep = 0; // arange New'd on Z reps
static UWord stats__cline_normalises = 0; // # calls to cacheline_normalise
static UWord stats__cline_read64s = 0; // # calls to s_m_read64
static UWord stats__cline_read32s = 0; // # calls to s_m_read32
@@ -3728,9 +3733,10 @@
*fp = lineF;
}
-static void find_Z_for_writing ( /*OUT*/SecMap** smp,
- /*OUT*/Word* zixp,
- Addr tag ) {
+static __attribute__((noinline))
+void find_Z_for_writing ( /*OUT*/SecMap** smp,
+ /*OUT*/Word* zixp,
+ Addr tag ) {
CacheLineZ* lineZ;
CacheLineF* lineF;
UWord zix;
@@ -3757,7 +3763,7 @@
*zixp = zix;
}
-static
+static __attribute__((noinline))
void alloc_F_for_writing ( /*MOD*/SecMap* sm, /*OUT*/Word* fixp ) {
UInt i, new_size;
CacheLineF* nyu;
@@ -4420,6 +4426,12 @@
static inline UWord get_cacheline_offset ( Addr a ) {
return (UWord)(a & (N_LINE_ARANGE - 1));
}
+static inline Addr cacheline_ROUNDUP ( Addr a ) {
+ return VG_ROUNDUP(a, N_LINE_ARANGE);
+}
+static inline Addr cacheline_ROUNDDN ( Addr a ) {
+ return VG_ROUNDDN(a, N_LINE_ARANGE);
+}
static inline UWord get_treeno ( Addr a ) {
return get_cacheline_offset(a) >> 3;
}
@@ -5202,6 +5214,11 @@
static void shadow_mem_make_New ( Thread* thr, Addr a, SizeT len )
{
+ stats__cache_make_New_arange += (ULong)len;
+
+ if (0 && len > 500)
+ VG_(printf)("make New ( %p, %ld )\n", a, len );
+
if (UNLIKELY(clo_trace_level > 0)) {
if (len > 0 && a <= clo_trace_addr && clo_trace_addr < a+len) {
SVal sv_old = shadow_mem_get8( clo_trace_addr );
@@ -5226,12 +5243,83 @@
n_New_in_cache, n_New_not_in_cache );
}
- shadow_mem_modify_range( thr, a, len,
- shadow_mem_set8,
- shadow_mem_set16,
- shadow_mem_set32,
- shadow_mem_set64,
- SHVAL_New/*opaque*/ );
+ if (LIKELY(len < 2 * N_LINE_ARANGE)) {
+ shadow_mem_modify_range( thr, a, len,
+ shadow_mem_set8,
+ shadow_mem_set16,
+ shadow_mem_set32,
+ shadow_mem_set64,
+ SHVAL_New/*opaque*/ );
+ } else {
+ Addr before_start = a;
+ Addr aligned_start = cacheline_ROUNDUP(a);
+ Addr after_start = cacheline_ROUNDDN(a + len);
+ UWord before_len = aligned_start - before_start;
+ UWord aligned_len = after_start - aligned_start;
+ UWord after_len = a + len - after_start;
+ tl_assert(before_start <= aligned_start);
+ tl_assert(aligned_start <= after_start);
+ tl_assert(before_len < N_LINE_ARANGE);
+ tl_assert(after_len < N_LINE_ARANGE);
+ tl_assert(get_cacheline_offset(aligned_start) == 0);
+ if (get_cacheline_offset(a) == 0) {
+ tl_assert(before_len == 0);
+ tl_assert(a == aligned_start);
+ }
+ if (get_cacheline_offset(a+len) == 0) {
+ tl_assert(after_len == 0);
+ tl_assert(after_start == a+len);
+ }
+ if (before_len > 0) {
+ shadow_mem_modify_range( thr, before_start, before_len,
+ shadow_mem_set8,
+ shadow_mem_set16,
+ shadow_mem_set32,
+ shadow_mem_set64,
+ SHVAL_New/*opaque*/ );
+ }
+ if (after_len > 0) {
+ shadow_mem_modify_range( thr, after_start, after_len,
+ shadow_mem_set8,
+ shadow_mem_set16,
+ shadow_mem_set32,
+ shadow_mem_set64,
+ SHVAL_New/*opaque*/ );
+ }
+ stats__cache_make_New_inZrep += (ULong)aligned_len;
+
+ while (1) {
+ if (aligned_start >= after_start)
+ break;
+ tl_assert(get_cacheline_offset(aligned_start) == 0);
+ Addr tag = aligned_start & ~(N_LINE_ARANGE - 1);
+ UWord wix = (aligned_start >> N_LINE_BITS) & (N_WAY_NENT - 1);
+ if (tag == cache_shmem.tags0[wix]) {
+ UWord i;
+ for (i = 0; i < N_LINE_ARANGE / 8; i++)
+ shadow_mem_set64( thr, aligned_start + i * 8, SHVAL_New );
+ } else {
+ UWord i;
+ Word zix;
+ SecMap* sm;
+ CacheLineZ* lineZ;
+ /* This line is not in the cache. Do not force it in; instead
+ modify it in-place. */
+ find_Z_for_writing( &sm, &zix, tag );
+ tl_assert(sm);
+ tl_assert(zix >= 0 && zix < N_SECMAP_ZLINES);
+ lineZ = &sm->linesZ[zix];
+ lineZ->dict[0] = SHVAL_New;
+ lineZ->dict[1] = lineZ->dict[2] = lineZ->dict[3] = 0;
+ for (i = 0; i < N_LINE_ARANGE/4; i++)
+ lineZ->ix2s[i] = 0; /* all refer to dict[0] */
+ }
+ aligned_start += N_LINE_ARANGE;
+ aligned_len -= N_LINE_ARANGE;
+ }
+ tl_assert(aligned_start == after_start);
+ tl_assert(aligned_len == 0);
+ }
}
@@ -9304,12 +9392,15 @@
VG_(printf)("\n");
VG_(printf)(" cache: %,lu totrefs (%,lu misses)\n",
stats__cache_totrefs, stats__cache_totmisses );
- VG_(printf)(" cache: %,12lu Z-fetch, %,12lu F-fetch\n",
+ VG_(printf)(" cache: %,12lu Z-fetch, %,12lu F-fetch\n",
stats__cache_Z_fetches, stats__cache_F_fetches );
- VG_(printf)(" cache: %,12lu Z-wback, %,12lu F-wback\n",
+ VG_(printf)(" cache: %,12lu Z-wback, %,12lu F-wback\n",
stats__cache_Z_wbacks, stats__cache_F_wbacks );
- VG_(printf)(" cache: %,12lu invals, %,12lu flushes\n",
+ VG_(printf)(" cache: %,12lu invals, %,12lu flushes\n",
stats__cache_invals, stats__cache_flushes );
+ VG_(printf)(" cache: %,12llu arange New, %,12llu direct-to-Zreps\n",
+ stats__cache_make_New_arange,
+ stats__cache_make_New_inZrep);
VG_(printf)("\n");
VG_(printf)(" cline: %,10lu normalises\n",
|
|
From: <sv...@va...> - 2008-03-13 20:11:38
|
Author: bart
Date: 2008-03-13 20:11:33 +0000 (Thu, 13 Mar 2008)
New Revision: 7676
Log:
Small additional optimization.
Modified:
trunk/exp-drd/drd_bitmap.c
trunk/exp-drd/drd_main.c
Modified: trunk/exp-drd/drd_bitmap.c
===================================================================
--- trunk/exp-drd/drd_bitmap.c 2008-03-13 19:24:30 UTC (rev 7675)
+++ trunk/exp-drd/drd_bitmap.c 2008-03-13 20:11:33 UTC (rev 7676)
@@ -218,14 +218,6 @@
b_end = (bm2->addr << ADDR0_BITS) + ADDR0_COUNT;
else
b_end = a2;
-#if 0
- VG_(message)(Vg_DebugMsg,
- "in 0x%lx 0x%lx / cur 0x%lx 0x%lx / out 0x%lx 0x%lx",
- a1, a2,
- (bm2->addr << ADDR0_BITS),
- (bm2->addr << ADDR0_BITS) + ADDR0_COUNT,
- b_start, b_end);
-#endif
tl_assert(a1 <= b_end && b_end <= a2);
tl_assert(b_start < b_end);
tl_assert((b_start & ADDR0_MASK) <= ((b_end - 1) & ADDR0_MASK));
Modified: trunk/exp-drd/drd_main.c
===================================================================
--- trunk/exp-drd/drd_main.c 2008-03-13 19:24:30 UTC (rev 7675)
+++ trunk/exp-drd/drd_main.c 2008-03-13 20:11:33 UTC (rev 7676)
@@ -181,7 +181,7 @@
#endif
sg = thread_get_segment(thread_get_running_tid());
bm_access_range_load(sg->bm, addr, addr + size);
- if (bm_has_conflict_with(thread_get_danger_set(), addr, addr + size, eLoad)
+ if (bm_load_has_conflict_with(thread_get_danger_set(), addr, addr + size)
&& ! drd_is_suppressed(addr, addr + size))
{
DataRaceErrInfo drei;
@@ -231,7 +231,7 @@
#endif
sg = thread_get_segment(thread_get_running_tid());
bm_access_range_store(sg->bm, addr, addr + size);
- if (bm_has_conflict_with(thread_get_danger_set(), addr, addr + size, eStore)
+ if (bm_store_has_conflict_with(thread_get_danger_set(), addr, addr + size)
&& ! drd_is_suppressed(addr, addr + size))
{
DataRaceErrInfo drei;
|
|
From: Bart V. A. <bar...@gm...> - 2008-03-13 19:46:46
|
On Thu, Mar 13, 2008 at 12:46 PM, Julian Seward <js...@ac...> wrote: > > > When I run Valgrind with option -v on an Ubuntu 7.10 (i386) system, > > Valgrind complains about CRC mismatches in the debug info. Is this an > > Ubuntu bug ? > > > > $ ./vg-in-place -v --tool=none none/tests/pth_empty > > ... > > --13503-- Reading syms from /lib/ld-2.6.1.so (0x4000000) > > --13503-- Reading debug info from /lib/ld-2.6.1.so .. > > --13503-- .. CRC mismatch (computed b27da0e3 wanted c257421f) > > --13503-- object doesn't have a symbol table > > Hmm, it's strange that it believes /lib/ld-2.6.1.so to be both > the base object and the debuginfo file. Can you send me your > /lib/ld-2.6.1.so for investigation? I just sent this file to you by e-mail. Bart. |
|
From: Bart V. A. <bar...@gm...> - 2008-03-13 19:42:02
|
On Thu, Mar 13, 2008 at 12:49 PM, Julian Seward <js...@ac...> wrote: > > > Did you notice that neither Helgrind nor DRD print any line number > > information for races detected in parallel sections in OpenMP programs > > ? An example: > > > > $ ./vg-in-place --tool=helgrind exp-drd/tests/omp_prime 4 -t 2 > > ... > > ==11416== Possible data race during write of size 4 at 0x7FEFFFBF0 > > ==11416== at 0x40120F: main.omp_fn.0 (in > > /home/bart/software/valgrind/exp-drd/tests/omp_prime) > > Perhaps something went wrong during debuginfo reading. Were there > any complaints earlier in the log? The above data race report was the first complaint. Is there any way for me to find out whether anything went wrong during debug info reading ? Adding -v to Valgrind's option did not reveal anything unusual. Can you reproduce the above behavior ? Bart. |
|
From: <sv...@va...> - 2008-03-13 19:24:29
|
Author: bart
Date: 2008-03-13 19:24:30 +0000 (Thu, 13 Mar 2008)
New Revision: 7675
Log:
Inlining and specialization of some bitmap manipulation functions.
Modified:
trunk/exp-drd/drd_bitmap.c
trunk/exp-drd/drd_main.c
trunk/exp-drd/drd_suppression.c
trunk/exp-drd/pub_drd_bitmap.h
Modified: trunk/exp-drd/drd_bitmap.c
===================================================================
--- trunk/exp-drd/drd_bitmap.c 2008-03-13 19:10:06 UTC (rev 7674)
+++ trunk/exp-drd/drd_bitmap.c 2008-03-13 19:24:30 UTC (rev 7675)
@@ -74,106 +74,79 @@
}
/**
- * Record an access of type access_type at addresses a in bitmap bm.
+ * Record an access of type access_type at addresses a .. a + size - 1 in
+ * bitmap bm.
*/
-static
-__inline__
-void bm_access_1(struct bitmap* const bm,
- const Addr a,
- const BmAccessTypeT access_type)
+static inline
+void bm_access_range(struct bitmap* const bm,
+ const Addr a1, const Addr a2,
+ const BmAccessTypeT access_type)
{
- struct bitmap2* p2;
- struct bitmap1* p1;
- UWord* p0;
- SPLIT_ADDRESS(a);
+ Addr b, b_next;
tl_assert(bm);
+ tl_assert(a1 < a2);
- p2 = bm2_lookup_or_insert(bm, a1);
- p1 = &p2->bm1;
- p0 = (access_type == eLoad) ? p1->bm0_r : p1->bm0_w;
- bm0_set(p0, a0);
-}
+ for (b = a1; b < a2; b = b_next)
+ {
+ Addr b_start;
+ Addr b_end;
+ struct bitmap2* bm2;
+ SPLIT_ADDRESS(b);
-static
-void bm_access_4_nonaligned(struct bitmap* const bm,
- const Addr a,
- const BmAccessTypeT access_type)
-{
- bm_access_1(bm, a + 0, access_type);
- bm_access_1(bm, a + 1, access_type);
- bm_access_1(bm, a + 2, access_type);
- bm_access_1(bm, a + 3, access_type);
-}
+ b_next = (b & ~ADDR0_MASK) + ADDR0_COUNT;
+ if (b_next > a2)
+ {
+ b_next = a2;
+ }
-static
-__inline__
-void bm_access_4_aligned(struct bitmap* const bm,
- const Addr a,
- const BmAccessTypeT access_type)
-{
- struct bitmap2* p2;
- struct bitmap1* p1;
- UWord* p0;
- SPLIT_ADDRESS(a);
+ bm2 = bm2_lookup_or_insert(bm, b1);
+ tl_assert(bm2);
- tl_assert(bm);
+ if ((bm2->addr << ADDR0_BITS) < a1)
+ b_start = a1;
+ else
+ if ((bm2->addr << ADDR0_BITS) < a2)
+ b_start = (bm2->addr << ADDR0_BITS);
+ else
+ break;
+ tl_assert(a1 <= b_start && b_start <= a2);
- p2 = bm2_lookup_or_insert(bm, a1);
- p1 = &p2->bm1;
- p0 = (access_type == eLoad) ? p1->bm0_r : p1->bm0_w;
- bm0_set(p0, a0+0);
- bm0_set(p0, a0+1);
- bm0_set(p0, a0+2);
- bm0_set(p0, a0+3);
+ if ((bm2->addr << ADDR0_BITS) + ADDR0_COUNT < a2)
+ b_end = (bm2->addr << ADDR0_BITS) + ADDR0_COUNT;
+ else
+ b_end = a2;
+ tl_assert(a1 <= b_end && b_end <= a2);
+ tl_assert(b_start < b_end);
+ tl_assert((b_start & ADDR0_MASK) <= ((b_end - 1) & ADDR0_MASK));
+
+ for (b0 = b_start & ADDR0_MASK; b0 <= ((b_end - 1) & ADDR0_MASK); b0++)
+ {
+ if (access_type == eLoad)
+ {
+ bm0_set(bm2->bm1.bm0_r, b0);
+ }
+ else
+ {
+ bm0_set(bm2->bm1.bm0_w, b0);
+ }
+ }
+ }
}
-/**
- * Record an access of type access_type at addresses a .. a + 3 in bitmap bm.
- */
-void bm_access_4(struct bitmap* const bm,
- const Addr a,
- const BmAccessTypeT access_type)
+void bm_access_range_load(struct bitmap* const bm,
+ const Addr a1, const Addr a2)
{
- tl_assert(bm);
- if ((a & 3) != 0)
- {
- bm_access_4_nonaligned(bm, a, access_type);
- }
- else
- {
- bm_access_4_aligned(bm, a, access_type);
- }
+ bm_access_range(bm, a1, a2, eLoad);
}
-/**
- * Record an access of type access_type at addresses a1 .. a2 - 1 in
- * bitmap bm.
- */
-void bm_access_range(struct bitmap* const bm,
- const Addr a1, const Addr a2,
- const BmAccessTypeT access_type)
+void bm_access_range_store(struct bitmap* const bm,
+ const Addr a1, const Addr a2)
{
- tl_assert(bm);
- tl_assert(a1 < a2);
-
- if (a2 - a1 == 4)
- bm_access_4(bm, a1, access_type);
- else if (a2 - a1 == 1)
- bm_access_1(bm, a1, access_type);
- else
- {
- Addr b;
- for (b = a1; b != a2; b++)
- {
- bm_access_1(bm, b, access_type);
- }
- }
+ bm_access_range(bm, a1, a2, eStore);
}
-Bool bm_has(const struct bitmap* const bm,
- const Addr a1,
- const Addr a2,
+Bool bm_has(const struct bitmap* const bm, const Addr a1, const Addr a2,
const BmAccessTypeT access_type)
{
Addr b;
@@ -188,8 +161,7 @@
}
Bool bm_has_any(const struct bitmap* const bm,
- const Addr a1,
- const Addr a2,
+ const Addr a1, const Addr a2,
const BmAccessTypeT access_type)
{
Addr b;
@@ -231,6 +203,7 @@
Addr b_start;
Addr b_end;
UWord b0;
+ const struct bitmap1* const p1 = &bm2->bm1;
if ((bm2->addr << ADDR0_BITS) < a1)
b_start = a1;
@@ -257,9 +230,8 @@
tl_assert(b_start < b_end);
tl_assert((b_start & ADDR0_MASK) <= ((b_end - 1) & ADDR0_MASK));
- for (b0 = b_start & ADDR0_MASK; b0 <= ((b_end - 1) & ADDR0_MASK); b0++)
+ for (b0 = b_start & ADDR0_MASK; b0 <= ((b_end-1) & ADDR0_MASK); b0++)
{
- const struct bitmap1* const p1 = &bm2->bm1;
const UWord mask
= bm0_is_set(p1->bm0_r, b0) | bm0_is_set(p1->bm0_w, b0);
if (mask)
@@ -335,7 +307,6 @@
}
}
-// New and fast implementation.
void bm_clear(const struct bitmap* const bm,
const Addr a1,
const Addr a2)
@@ -390,54 +361,85 @@
}
}
-static
-__inline__
-UWord bm_has_conflict_with_1(const struct bitmap* const bm,
- const Addr a,
- const BmAccessTypeT access_type)
+inline
+Bool bm_has_conflict_with(const struct bitmap* const bm,
+ const Addr a1, const Addr a2,
+ const BmAccessTypeT access_type)
{
- struct bitmap2* p2;
- const UWord a0 = a & ADDR0_MASK;
+ Addr b, b_next;
tl_assert(bm);
- p2 = bm_lookup(bm, a);
- if (p2)
+ for (b = a1; b < a2; b = b_next)
{
- if (access_type == eLoad)
+ struct bitmap2* bm2 = bm_lookup(bm, b);
+
+ b_next = (b & ~ADDR0_MASK) + ADDR0_COUNT;
+ if (b_next > a2)
{
- return bm0_is_set(p2->bm1.bm0_w, a0);
+ b_next = a2;
}
- else
+
+ if (bm2)
{
- tl_assert(access_type == eStore);
- return (bm0_is_set(p2->bm1.bm0_r, a0)
- | bm0_is_set(p2->bm1.bm0_w, a0));
+ Addr b_start;
+ Addr b_end;
+ UWord b0;
+ const struct bitmap1* const p1 = &bm2->bm1;
+
+ if ((bm2->addr << ADDR0_BITS) < a1)
+ b_start = a1;
+ else
+ if ((bm2->addr << ADDR0_BITS) < a2)
+ b_start = (bm2->addr << ADDR0_BITS);
+ else
+ break;
+ tl_assert(a1 <= b_start && b_start <= a2);
+
+ if ((bm2->addr << ADDR0_BITS) + ADDR0_COUNT < a2)
+ b_end = (bm2->addr << ADDR0_BITS) + ADDR0_COUNT;
+ else
+ b_end = a2;
+ tl_assert(a1 <= b_end && b_end <= a2);
+ tl_assert(b_start < b_end);
+ tl_assert((b_start & ADDR0_MASK) <= ((b_end - 1) & ADDR0_MASK));
+
+ for (b0 = b_start & ADDR0_MASK; b0 <= ((b_end-1) & ADDR0_MASK); b0++)
+ {
+ if (access_type == eLoad)
+ {
+ if (bm0_is_set(p1->bm0_w, b0))
+ {
+ return True;
+ }
+ }
+ else
+ {
+ tl_assert(access_type == eStore);
+ if (bm0_is_set(p1->bm0_r, b0)
+ | bm0_is_set(p1->bm0_w, b0))
+ {
+ return True;
+ }
+ }
+ }
}
}
return False;
}
-/**
- * Return true if the access to [a,a+size[ of type access_type conflicts with
- * any access stored in bitmap bm.
- */
-Bool bm_has_conflict_with(const struct bitmap* const bm,
- const Addr a1,
- const Addr a2,
- const BmAccessTypeT access_type)
+Bool bm_load_has_conflict_with(const struct bitmap* const bm,
+ const Addr a1, const Addr a2)
{
- Addr b;
- for (b = a1; b != a2; b++)
- {
- if (bm_has_conflict_with_1(bm, b, access_type))
- {
- return True;
- }
- }
- return False;
+ return bm_has_conflict_with(bm, a1, a2, eLoad);
}
+Bool bm_store_has_conflict_with(const struct bitmap* const bm,
+ const Addr a1, const Addr a2)
+{
+ return bm_has_conflict_with(bm, a1, a2, eStore);
+}
+
void bm_swap(struct bitmap* const bm1, struct bitmap* const bm2)
{
OSet* const tmp = bm1->oset;
@@ -466,7 +468,6 @@
do
{
bm2l = VG_(OSetGen_Next)(lhs->oset);
- //VG_(message)(Vg_DebugMsg, "0x%x 0x%x", bm2l->addr, bm2r->addr);
} while (bm2l->addr < bm2r->addr);
tl_assert(bm2l->addr == bm2r->addr);
Modified: trunk/exp-drd/drd_main.c
===================================================================
--- trunk/exp-drd/drd_main.c 2008-03-13 19:10:06 UTC (rev 7674)
+++ trunk/exp-drd/drd_main.c 2008-03-13 19:24:30 UTC (rev 7675)
@@ -180,7 +180,7 @@
}
#endif
sg = thread_get_segment(thread_get_running_tid());
- bm_access_range(sg->bm, addr, addr + size, eLoad);
+ bm_access_range_load(sg->bm, addr, addr + size);
if (bm_has_conflict_with(thread_get_danger_set(), addr, addr + size, eLoad)
&& ! drd_is_suppressed(addr, addr + size))
{
@@ -230,7 +230,7 @@
}
#endif
sg = thread_get_segment(thread_get_running_tid());
- bm_access_range(sg->bm, addr, addr + size, eStore);
+ bm_access_range_store(sg->bm, addr, addr + size);
if (bm_has_conflict_with(thread_get_danger_set(), addr, addr + size, eStore)
&& ! drd_is_suppressed(addr, addr + size))
{
Modified: trunk/exp-drd/drd_suppression.c
===================================================================
--- trunk/exp-drd/drd_suppression.c 2008-03-13 19:10:06 UTC (rev 7674)
+++ trunk/exp-drd/drd_suppression.c 2008-03-13 19:24:30 UTC (rev 7675)
@@ -62,7 +62,7 @@
tl_assert(a1 < a2);
tl_assert(! drd_is_any_suppressed(a1, a2));
- bm_access_range(s_suppressed, a1, a2, eStore);
+ bm_access_range_store(s_suppressed, a1, a2);
}
void drd_finish_suppression(const Addr a1, const Addr a2)
Modified: trunk/exp-drd/pub_drd_bitmap.h
===================================================================
--- trunk/exp-drd/pub_drd_bitmap.h 2008-03-13 19:10:06 UTC (rev 7674)
+++ trunk/exp-drd/pub_drd_bitmap.h 2008-03-13 19:24:30 UTC (rev 7675)
@@ -56,34 +56,30 @@
// Function declarations.
struct bitmap* bm_new(void);
void bm_delete(struct bitmap* const bm);
-void bm_access_range(struct bitmap* const bm,
- const Addr a1, const Addr a2,
- const BmAccessTypeT access_type);
-void bm_access_4(struct bitmap* const bm,
- const Addr address,
- const BmAccessTypeT access_type);
+void bm_access_range_load(struct bitmap* const bm,
+ const Addr a1, const Addr a2);
+void bm_access_range_store(struct bitmap* const bm,
+ const Addr a1, const Addr a2);
Bool bm_has(const struct bitmap* const bm,
- const Addr a1,
- const Addr a2,
+ const Addr a1, const Addr a2,
const BmAccessTypeT access_type);
Bool bm_has_any(const struct bitmap* const bm,
- const Addr a1,
- const Addr a2,
+ const Addr a1, const Addr a2,
const BmAccessTypeT access_type);
UWord bm_has_any_access(const struct bitmap* const bm,
- const Addr a1,
- const Addr a2);
+ const Addr a1, const Addr a2);
UWord bm_has_1(const struct bitmap* const bm,
- const Addr address,
- const BmAccessTypeT access_type);
+ const Addr address, const BmAccessTypeT access_type);
void bm_clear_all(const struct bitmap* const bm);
void bm_clear(const struct bitmap* const bm,
- const Addr a1,
- const Addr a2);
+ const Addr a1, const Addr a2);
Bool bm_has_conflict_with(const struct bitmap* const bm,
- const Addr a1,
- const Addr a2,
+ const Addr a1, const Addr a2,
const BmAccessTypeT access_type);
+Bool bm_load_has_conflict_with(const struct bitmap* const bm,
+ const Addr a1, const Addr a2);
+Bool bm_store_has_conflict_with(const struct bitmap* const bm,
+ const Addr a1, const Addr a2);
void bm_swap(struct bitmap* const bm1, struct bitmap* const bm2);
void bm_merge2(struct bitmap* const lhs,
const struct bitmap* const rhs);
|
|
From: Josef W. <Jos...@gm...> - 2008-03-13 19:13:49
|
On Thursday 13 March 2008, Bart Van Assche wrote: > On Thu, Mar 13, 2008 at 5:26 PM, Josef Weidendorfer > <Jos...@gm...> wrote: > > On Thursday 13 March 2008, Bart Van Assche wrote: > > > $ ../valgrind-outer/vg-in-place --sim-hints=enable-outer > > > --trace-children=yes --pop-on-jump --tool=callgrind > > > ../valgrind-inner/vg-in-place --tool=none date > > > A question: is self-hosting Valgrind without installing Valgrind > > > supported ? It resulted in an assertion failure when I tried it. > > > > Does this work when installed? > > > > I recently had a similar bug report (which I was not able to reproduce), > > so this could be a real bug in callgrind. I'll check if I can reproduce > > it... > > Hello Josef, > > By this time I found out that self-hosting works fine if I leave out > the command-line option --pop-on-jump. Do you still need the results > of the test after installation of inner and outer Valgrind ? Not really. I can not imagine that this makes a difference. I need to check if I can reproduce this problem on my own. It is good for you that skipping "--pop-on-jump" hides this issue, but there seems to be a bug somewhere. Josef > > Bart. > |
|
From: <sv...@va...> - 2008-03-13 19:10:13
|
Author: bart
Date: 2008-03-13 19:10:06 +0000 (Thu, 13 Mar 2008)
New Revision: 7674
Log:
Made arguments of bitmap manipulating functions more uniform.
Modified:
trunk/exp-drd/drd_bitmap.c
trunk/exp-drd/drd_main.c
trunk/exp-drd/drd_suppression.c
trunk/exp-drd/pub_drd_bitmap.h
Modified: trunk/exp-drd/drd_bitmap.c
===================================================================
--- trunk/exp-drd/drd_bitmap.c 2008-03-13 19:03:38 UTC (rev 7673)
+++ trunk/exp-drd/drd_bitmap.c 2008-03-13 19:10:06 UTC (rev 7674)
@@ -147,25 +147,24 @@
}
/**
- * Record an access of type access_type at addresses a .. a + size - 1 in
+ * Record an access of type access_type at addresses a1 .. a2 - 1 in
* bitmap bm.
*/
void bm_access_range(struct bitmap* const bm,
- const Addr a,
- const SizeT size,
+ const Addr a1, const Addr a2,
const BmAccessTypeT access_type)
{
tl_assert(bm);
- tl_assert(size > 0);
+ tl_assert(a1 < a2);
- if (size == 4)
- bm_access_4(bm, a, access_type);
- else if (size == 1)
- bm_access_1(bm, a, access_type);
+ if (a2 - a1 == 4)
+ bm_access_4(bm, a1, access_type);
+ else if (a2 - a1 == 1)
+ bm_access_1(bm, a1, access_type);
else
{
Addr b;
- for (b = a; b != a + size; b++)
+ for (b = a1; b != a2; b++)
{
bm_access_1(bm, b, access_type);
}
@@ -614,8 +613,10 @@
for (i = 0; i < sizeof(s_args)/sizeof(s_args[0]); i++)
{
- bm_access_range(bm, s_args[i].address,
- s_args[i].size, s_args[i].access_type);
+ bm_access_range(bm,
+ s_args[i].address,
+ s_args[i].address + s_args[i].size,
+ s_args[i].access_type);
}
VG_(printf)("Map contents -- should contain 10 addresses:\n");
Modified: trunk/exp-drd/drd_main.c
===================================================================
--- trunk/exp-drd/drd_main.c 2008-03-13 19:03:38 UTC (rev 7673)
+++ trunk/exp-drd/drd_main.c 2008-03-13 19:10:06 UTC (rev 7674)
@@ -180,7 +180,7 @@
}
#endif
sg = thread_get_segment(thread_get_running_tid());
- bm_access_range(sg->bm, addr, size, eLoad);
+ bm_access_range(sg->bm, addr, addr + size, eLoad);
if (bm_has_conflict_with(thread_get_danger_set(), addr, addr + size, eLoad)
&& ! drd_is_suppressed(addr, addr + size))
{
@@ -230,7 +230,7 @@
}
#endif
sg = thread_get_segment(thread_get_running_tid());
- bm_access_range(sg->bm, addr, size, eStore);
+ bm_access_range(sg->bm, addr, addr + size, eStore);
if (bm_has_conflict_with(thread_get_danger_set(), addr, addr + size, eStore)
&& ! drd_is_suppressed(addr, addr + size))
{
Modified: trunk/exp-drd/drd_suppression.c
===================================================================
--- trunk/exp-drd/drd_suppression.c 2008-03-13 19:03:38 UTC (rev 7673)
+++ trunk/exp-drd/drd_suppression.c 2008-03-13 19:10:06 UTC (rev 7674)
@@ -62,7 +62,7 @@
tl_assert(a1 < a2);
tl_assert(! drd_is_any_suppressed(a1, a2));
- bm_access_range(s_suppressed, a1, a2 - a1, eStore);
+ bm_access_range(s_suppressed, a1, a2, eStore);
}
void drd_finish_suppression(const Addr a1, const Addr a2)
Modified: trunk/exp-drd/pub_drd_bitmap.h
===================================================================
--- trunk/exp-drd/pub_drd_bitmap.h 2008-03-13 19:03:38 UTC (rev 7673)
+++ trunk/exp-drd/pub_drd_bitmap.h 2008-03-13 19:10:06 UTC (rev 7674)
@@ -57,8 +57,7 @@
struct bitmap* bm_new(void);
void bm_delete(struct bitmap* const bm);
void bm_access_range(struct bitmap* const bm,
- const Addr address,
- const SizeT size,
+ const Addr a1, const Addr a2,
const BmAccessTypeT access_type);
void bm_access_4(struct bitmap* const bm,
const Addr address,
@@ -96,8 +95,6 @@
void bm_print(const struct bitmap* bm);
ULong bm_get_bitmap_creation_count(void);
ULong bm_get_bitmap2_creation_count(void);
-void bm_test(void);
-
#endif /* __DRD_BITMAP_H */
|
|
From: <sv...@va...> - 2008-03-13 19:03:34
|
Author: bart
Date: 2008-03-13 19:03:38 +0000 (Thu, 13 Mar 2008)
New Revision: 7673
Log:
Inlined thread_conflicting_access(). Changed thread_get_danger_set() and thread_get_segment() from extern to inline.
Modified:
trunk/exp-drd/drd_main.c
trunk/exp-drd/drd_thread.c
trunk/exp-drd/drd_thread.h
Modified: trunk/exp-drd/drd_main.c
===================================================================
--- trunk/exp-drd/drd_main.c 2008-03-13 18:49:23 UTC (rev 7672)
+++ trunk/exp-drd/drd_main.c 2008-03-13 19:03:38 UTC (rev 7673)
@@ -181,7 +181,8 @@
#endif
sg = thread_get_segment(thread_get_running_tid());
bm_access_range(sg->bm, addr, size, eLoad);
- if (thread_conflicting_access(addr, size, eLoad))
+ if (bm_has_conflict_with(thread_get_danger_set(), addr, addr + size, eLoad)
+ && ! drd_is_suppressed(addr, addr + size))
{
DataRaceErrInfo drei;
drei.tid = VG_(get_running_tid)();
@@ -230,7 +231,8 @@
#endif
sg = thread_get_segment(thread_get_running_tid());
bm_access_range(sg->bm, addr, size, eStore);
- if (thread_conflicting_access(addr, size, eStore))
+ if (bm_has_conflict_with(thread_get_danger_set(), addr, addr + size, eStore)
+ && ! drd_is_suppressed(addr, addr + size))
{
DataRaceErrInfo drei;
drei.tid = VG_(get_running_tid)();
Modified: trunk/exp-drd/drd_thread.c
===================================================================
--- trunk/exp-drd/drd_thread.c 2008-03-13 18:49:23 UTC (rev 7672)
+++ trunk/exp-drd/drd_thread.c 2008-03-13 19:03:38 UTC (rev 7673)
@@ -55,7 +55,7 @@
static ThreadId s_vg_running_tid = VG_INVALID_THREADID;
DrdThreadId s_drd_running_tid = DRD_INVALID_THREADID;
ThreadInfo s_threadinfo[DRD_N_THREADS];
-static struct bitmap* s_danger_set;
+struct bitmap* s_danger_set;
static Bool s_trace_context_switches = False;
static Bool s_trace_danger_set = False;
@@ -465,24 +465,7 @@
return s_threadinfo[tid].synchr_nesting;
}
-/**
- * Return a pointer to the latest segment for the specified thread.
- */
-Segment* thread_get_segment(const DrdThreadId tid)
-{
- tl_assert(0 <= tid && tid < DRD_N_THREADS
- && tid != DRD_INVALID_THREADID);
- if (s_threadinfo[tid].last == 0)
- {
- VG_(message)(Vg_DebugMsg, "threadid = %d", tid);
- thread_print_all();
- }
- tl_assert(s_threadinfo[tid].last);
- return s_threadinfo[tid].last;
-}
-
-/** Append a new segment at the end of the segment list.
- */
+/** Append a new segment at the end of the segment list. */
static void thread_append_segment(const DrdThreadId tid, Segment* const sg)
{
tl_assert(0 <= tid && tid < DRD_N_THREADS
@@ -968,15 +951,6 @@
}
}
-Bool thread_conflicting_access(const Addr a,
- const SizeT size,
- const BmAccessTypeT access_type)
-{
- tl_assert(s_danger_set);
- return (bm_has_conflict_with(s_danger_set, a, a + size, access_type)
- && ! drd_is_suppressed(a, a + size));
-}
-
ULong thread_get_context_switch_count(void)
{
return s_context_switch_count;
Modified: trunk/exp-drd/drd_thread.h
===================================================================
--- trunk/exp-drd/drd_thread.h 2008-03-13 18:49:23 UTC (rev 7672)
+++ trunk/exp-drd/drd_thread.h 2008-03-13 19:03:38 UTC (rev 7673)
@@ -56,26 +56,26 @@
typedef struct
{
- Segment* first;
- Segment* last;
- ThreadId vg_threadid;
- PThreadId pt_threadid;
- Addr stack_min_min;
- Addr stack_min;
- Addr stack_startup;
- Addr stack_max;
- char name[32];
- /// Indicates whether the Valgrind core knows about this thread.
- Bool vg_thread_exists;
- /// Indicates whether there is an associated POSIX thread ID.
- Bool posix_thread_exists;
- /// If true, indicates that there is a corresponding POSIX thread ID and
- /// a corresponding OS thread that is detached.
- Bool detached_posix_thread;
- /// Wether recording of memory accesses is active.
- Bool is_recording;
- /// Nesting level of synchronization functions called by the client.
- Int synchr_nesting;
+ Segment* first;
+ Segment* last;
+ ThreadId vg_threadid;
+ PThreadId pt_threadid;
+ Addr stack_min_min;
+ Addr stack_min;
+ Addr stack_startup;
+ Addr stack_max;
+ char name[32];
+ /// Indicates whether the Valgrind core knows about this thread.
+ Bool vg_thread_exists;
+ /// Indicates whether there is an associated POSIX thread ID.
+ Bool posix_thread_exists;
+ /// If true, indicates that there is a corresponding POSIX thread ID and
+ /// a corresponding OS thread that is detached.
+ Bool detached_posix_thread;
+ /// Wether recording of memory accesses is active.
+ Bool is_recording;
+ /// Nesting level of synchronization functions called by the client.
+ Int synchr_nesting;
} ThreadInfo;
@@ -84,6 +84,7 @@
extern DrdThreadId s_drd_running_tid;
extern ThreadInfo s_threadinfo[DRD_N_THREADS];
+extern struct bitmap* s_danger_set;
// Function declarations.
@@ -121,7 +122,6 @@
int thread_enter_synchr(const DrdThreadId tid);
int thread_leave_synchr(const DrdThreadId tid);
int thread_get_synchr_nesting_count(const DrdThreadId tid);
-Segment* thread_get_segment(const DrdThreadId tid);
void thread_new_segment(const DrdThreadId tid);
VectorClock* thread_get_vc(const DrdThreadId tid);
void thread_combine_vc(const DrdThreadId joiner, const DrdThreadId joinee);
@@ -134,9 +134,6 @@
void thread_report_races_segment(const DrdThreadId tid,
const Segment* const p);
void thread_report_all_races(void);
-Bool thread_conflicting_access(Addr const a,
- SizeT const size,
- BmAccessTypeT access_type);
void thread_report_conflicting_segments(const DrdThreadId tid,
const Addr addr,
const SizeT size,
@@ -149,14 +146,30 @@
ULong thread_get_danger_set_bitmap2_creation_count(void);
+static
+inline struct bitmap* thread_get_danger_set(void)
+{
+ return s_danger_set;
+}
+
static inline
Bool running_thread_is_recording(void)
{
- tl_assert(0 <= s_drd_running_tid && s_drd_running_tid < DRD_N_THREADS
- && s_drd_running_tid != DRD_INVALID_THREADID);
- return (s_threadinfo[s_drd_running_tid].synchr_nesting == 0
- && s_threadinfo[s_drd_running_tid].is_recording);
+ tl_assert(0 <= s_drd_running_tid && s_drd_running_tid < DRD_N_THREADS
+ && s_drd_running_tid != DRD_INVALID_THREADID);
+ return (s_threadinfo[s_drd_running_tid].synchr_nesting == 0
+ && s_threadinfo[s_drd_running_tid].is_recording);
}
+/** Return a pointer to the latest segment for the specified thread. */
+static inline
+Segment* thread_get_segment(const DrdThreadId tid)
+{
+ tl_assert(0 <= tid && tid < DRD_N_THREADS
+ && tid != DRD_INVALID_THREADID);
+ tl_assert(s_threadinfo[tid].last);
+ return s_threadinfo[tid].last;
+}
+
#endif // __THREAD_H
|
|
From: <sv...@va...> - 2008-03-13 18:49:19
|
Author: bart
Date: 2008-03-13 18:49:23 +0000 (Thu, 13 Mar 2008)
New Revision: 7672
Log:
Added inline function running_thread_is_recording(). Removed function thread_is_recording().
Modified:
trunk/exp-drd/drd_main.c
trunk/exp-drd/drd_thread.c
trunk/exp-drd/drd_thread.h
Modified: trunk/exp-drd/drd_main.c
===================================================================
--- trunk/exp-drd/drd_main.c 2008-03-13 18:06:08 UTC (rev 7671)
+++ trunk/exp-drd/drd_main.c 2008-03-13 18:49:23 UTC (rev 7672)
@@ -153,10 +153,12 @@
{
Segment* sg;
+#if 0
tl_assert(thread_get_running_tid()
== VgThreadIdToDrdThreadId(VG_(get_running_tid())));
+#endif
- if (! thread_is_recording(thread_get_running_tid()))
+ if (! running_thread_is_recording())
return;
#if 1
@@ -199,10 +201,12 @@
{
Segment* sg;
+#if 0
tl_assert(thread_get_running_tid()
== VgThreadIdToDrdThreadId(VG_(get_running_tid())));
+#endif
- if (! thread_is_recording(thread_get_running_tid()))
+ if (! running_thread_is_recording())
return;
#if 1
Modified: trunk/exp-drd/drd_thread.c
===================================================================
--- trunk/exp-drd/drd_thread.c 2008-03-13 18:06:08 UTC (rev 7671)
+++ trunk/exp-drd/drd_thread.c 2008-03-13 18:49:23 UTC (rev 7672)
@@ -38,38 +38,6 @@
#include "pub_tool_threadstate.h" // VG_(get_pthread_id)()
-// Defines.
-
-#define DRD_N_THREADS VG_N_THREADS
-
-
-// Type definitions.
-
-typedef struct
-{
- Segment* first;
- Segment* last;
- ThreadId vg_threadid;
- PThreadId pt_threadid;
- Addr stack_min_min;
- Addr stack_min;
- Addr stack_startup;
- Addr stack_max;
- char name[32];
- /// Indicates whether the Valgrind core knows about this thread.
- Bool vg_thread_exists;
- /// Indicates whether there is an associated POSIX thread ID.
- Bool posix_thread_exists;
- /// If true, indicates that there is a corresponding POSIX thread ID and
- /// a corresponding OS thread that is detached.
- Bool detached_posix_thread;
- /// Wether recording of memory accesses is active.
- Bool is_recording;
- /// Nesting level of synchronization functions called by the client.
- Int synchr_nesting;
-} ThreadInfo;
-
-
// Local functions.
static void thread_append_segment(const DrdThreadId tid,
@@ -85,8 +53,8 @@
static ULong s_danger_set_bitmap_creation_count;
static ULong s_danger_set_bitmap2_creation_count;
static ThreadId s_vg_running_tid = VG_INVALID_THREADID;
-static DrdThreadId s_drd_running_tid = DRD_INVALID_THREADID;
-static ThreadInfo s_threadinfo[DRD_N_THREADS];
+DrdThreadId s_drd_running_tid = DRD_INVALID_THREADID;
+ThreadInfo s_threadinfo[DRD_N_THREADS];
static struct bitmap* s_danger_set;
static Bool s_trace_context_switches = False;
static Bool s_trace_danger_set = False;
@@ -760,13 +728,6 @@
s_threadinfo[tid].is_recording = False;
}
-Bool thread_is_recording(const DrdThreadId tid)
-{
- tl_assert(0 <= tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID);
- return (s_threadinfo[tid].synchr_nesting == 0
- && s_threadinfo[tid].is_recording);
-}
-
void thread_print_all(void)
{
unsigned i;
Modified: trunk/exp-drd/drd_thread.h
===================================================================
--- trunk/exp-drd/drd_thread.h 2008-03-13 18:06:08 UTC (rev 7671)
+++ trunk/exp-drd/drd_thread.h 2008-03-13 18:49:23 UTC (rev 7672)
@@ -27,10 +27,18 @@
#define __THREAD_H
+// Includes.
+
#include "drd_segment.h"
-#include "pub_tool_stacktrace.h" // StackTrace
+#include "pub_tool_libcassert.h" // tl_assert()
+#include "pub_tool_stacktrace.h" // StackTrace
+#include "pub_tool_threadstate.h" // VG_N_THREADS
+// Defines.
+
+#define DRD_N_THREADS VG_N_THREADS
+
#define DRD_INVALID_THREADID 0
/* Note: the PThreadId typedef and the INVALID_POSIX_THREADID depend on the */
@@ -41,10 +49,45 @@
#define INVALID_POSIX_THREADID ((PThreadId)0)
+// Type definitions.
+
typedef UInt DrdThreadId;
typedef UWord PThreadId;
+typedef struct
+{
+ Segment* first;
+ Segment* last;
+ ThreadId vg_threadid;
+ PThreadId pt_threadid;
+ Addr stack_min_min;
+ Addr stack_min;
+ Addr stack_startup;
+ Addr stack_max;
+ char name[32];
+ /// Indicates whether the Valgrind core knows about this thread.
+ Bool vg_thread_exists;
+ /// Indicates whether there is an associated POSIX thread ID.
+ Bool posix_thread_exists;
+ /// If true, indicates that there is a corresponding POSIX thread ID and
+ /// a corresponding OS thread that is detached.
+ Bool detached_posix_thread;
+ /// Wether recording of memory accesses is active.
+ Bool is_recording;
+ /// Nesting level of synchronization functions called by the client.
+ Int synchr_nesting;
+} ThreadInfo;
+
+// Local variables of drd_thread.c that are declared here such that these
+// can be accessed by inline functions.
+
+extern DrdThreadId s_drd_running_tid;
+extern ThreadInfo s_threadinfo[DRD_N_THREADS];
+
+
+// Function declarations.
+
void thread_trace_context_switches(const Bool t);
void thread_trace_danger_set(const Bool t);
Bool IsValidDrdThreadId(const DrdThreadId tid);
@@ -86,7 +129,6 @@
void thread_stop_using_mem(const Addr a1, const Addr a2);
void thread_start_recording(const DrdThreadId tid);
void thread_stop_recording(const DrdThreadId tid);
-Bool thread_is_recording(const DrdThreadId tid);
void thread_print_all(void);
void thread_report_races(const DrdThreadId tid);
void thread_report_races_segment(const DrdThreadId tid,
@@ -107,4 +149,14 @@
ULong thread_get_danger_set_bitmap2_creation_count(void);
+static inline
+Bool running_thread_is_recording(void)
+{
+ tl_assert(0 <= s_drd_running_tid && s_drd_running_tid < DRD_N_THREADS
+ && s_drd_running_tid != DRD_INVALID_THREADID);
+ return (s_threadinfo[s_drd_running_tid].synchr_nesting == 0
+ && s_threadinfo[s_drd_running_tid].is_recording);
+}
+
+
#endif // __THREAD_H
|
|
From: Bart V. A. <bar...@gm...> - 2008-03-13 18:26:30
|
On Thu, Mar 13, 2008 at 5:26 PM, Josef Weidendorfer <Jos...@gm...> wrote: > On Thursday 13 March 2008, Bart Van Assche wrote: > > $ ../valgrind-outer/vg-in-place --sim-hints=enable-outer > > --trace-children=yes --pop-on-jump --tool=callgrind > > ../valgrind-inner/vg-in-place --tool=none date > > A question: is self-hosting Valgrind without installing Valgrind > > supported ? It resulted in an assertion failure when I tried it. > > Does this work when installed? > > I recently had a similar bug report (which I was not able to reproduce), > so this could be a real bug in callgrind. I'll check if I can reproduce > it... Hello Josef, By this time I found out that self-hosting works fine if I leave out the command-line option --pop-on-jump. Do you still need the results of the test after installation of inner and outer Valgrind ? Bart. |
|
From: Julian S. <js...@ac...> - 2008-03-13 18:10:14
|
On Thursday 13 March 2008 17:26, Josef Weidendorfer wrote: > On Thursday 13 March 2008, Bart Van Assche wrote: > > A question: is self-hosting Valgrind without installing Valgrind > > supported ? It resulted in an assertion failure when I tried it. > > Does this work when installed? > > I recently had a similar bug report (which I was not able to reproduce), > so this could be a real bug in callgrind. I'll check if I can reproduce > it... FWIW, I used Callgrind (trunk) to profile Callgrind (trunk) just a few days ago and it worked fine. But I was running something very boring (ls -l) with no signals. It could be that there is some problem with signals and self hosting; I have not tried that. J |
|
From: <sv...@va...> - 2008-03-13 18:06:16
|
Author: bart Date: 2008-03-13 18:06:08 +0000 (Thu, 13 Mar 2008) New Revision: 7671 Log: Removed -I$(top_srcdir)/coregrind. Added -O2. Modified: trunk/exp-drd/Makefile.am Modified: trunk/exp-drd/Makefile.am =================================================================== --- trunk/exp-drd/Makefile.am 2008-03-13 17:47:01 UTC (rev 7670) +++ trunk/exp-drd/Makefile.am 2008-03-13 18:06:08 UTC (rev 7671) @@ -26,6 +26,13 @@ VGPRELOAD_DRD_SOURCES_COMMON = drd_pthread_intercepts.c endif +AM_CFLAGS_X86_LINUX += -Wsign-compare -O2 +AM_CFLAGS_AMD64_LINUX += -Wsign-compare -O2 +AM_CFLAGS_PPC32_LINUX += -Wsign-compare -O2 +AM_CFLAGS_PPC64_LINUX += -Wsign-compare -O2 +AM_CFLAGS_PPC32_AIX5 += -Wsign-compare -O2 +AM_CFLAGS_PPC64_AIX5 += -Wsign-compare -O2 + vgpreload_exp_drd_x86_linux_so_SOURCES = $(VGPRELOAD_DRD_SOURCES_COMMON) vgpreload_exp_drd_x86_linux_so_CPPFLAGS = $(AM_CPPFLAGS_X86_LINUX) vgpreload_exp_drd_x86_linux_so_CFLAGS = $(AM_CFLAGS_X86_LINUX) $(AM_CFLAGS_PIC) @@ -111,13 +118,6 @@ priv_drd_clientreq.h \ pub_drd_bitmap.h -AM_CFLAGS_X86_LINUX += -I$(top_srcdir)/coregrind -Wsign-compare -AM_CFLAGS_AMD64_LINUX += -I$(top_srcdir)/coregrind -Wsign-compare -AM_CFLAGS_PPC32_LINUX += -I$(top_srcdir)/coregrind -Wsign-compare -AM_CFLAGS_PPC64_LINUX += -I$(top_srcdir)/coregrind -Wsign-compare -AM_CFLAGS_PPC32_AIX5 += -I$(top_srcdir)/coregrind -Wsign-compare -AM_CFLAGS_PPC64_AIX5 += -I$(top_srcdir)/coregrind -Wsign-compare - exp_drd_x86_linux_SOURCES = $(DRD_SOURCES_COMMON) exp_drd_x86_linux_CPPFLAGS = $(AM_CPPFLAGS_X86_LINUX) exp_drd_x86_linux_CFLAGS = $(AM_CFLAGS_X86_LINUX) |
|
From: <sv...@va...> - 2008-03-13 17:46:56
|
Author: bart
Date: 2008-03-13 17:47:01 +0000 (Thu, 13 Mar 2008)
New Revision: 7670
Log:
Disabled the warning on sending a signal without having locked the associated mutex, since this is not always an error.
Modified:
trunk/exp-drd/drd_cond.c
trunk/exp-drd/tests/pth_cond_race.stderr.exp
trunk/exp-drd/tests/tc23_bogus_condwait.stderr.exp
Modified: trunk/exp-drd/drd_cond.c
===================================================================
--- trunk/exp-drd/drd_cond.c 2008-03-13 17:34:43 UTC (rev 7669)
+++ trunk/exp-drd/drd_cond.c 2008-03-13 17:47:01 UTC (rev 7670)
@@ -245,6 +245,9 @@
{
if (! mutex_is_locked_by(cond_p->mutex, drd_tid))
{
+ /* A signal is sent while the associated mutex has not been locked. */
+ /* This can indicate but is not necessarily a race condition. */
+#if 0
CondRaceErrInfo cei;
cei.cond = cond;
cei.mutex = cond_p->mutex;
@@ -253,6 +256,7 @@
VG_(get_IP)(vg_tid),
"CondErr",
&cei);
+#endif
}
}
else
Modified: trunk/exp-drd/tests/pth_cond_race.stderr.exp
===================================================================
--- trunk/exp-drd/tests/pth_cond_race.stderr.exp 2008-03-13 17:34:43 UTC (rev 7669)
+++ trunk/exp-drd/tests/pth_cond_race.stderr.exp 2008-03-13 17:47:01 UTC (rev 7670)
@@ -1,10 +1,3 @@
-Thread 2:
-Race condition: condition variable 0x........ has been signalled but the associated mutex 0x........ is not locked by the signalling thread
- at 0x........: pthread_cond_signal* (drd_pthread_intercepts.c:?)
- by 0x........: thread_func (pth_cond_race.c:?)
- by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?)
- by 0x........: (within libpthread-?.?.so)
- by 0x........: clone (in /...libc...)
-ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Modified: trunk/exp-drd/tests/tc23_bogus_condwait.stderr.exp
===================================================================
--- trunk/exp-drd/tests/tc23_bogus_condwait.stderr.exp 2008-03-13 17:34:43 UTC (rev 7669)
+++ trunk/exp-drd/tests/tc23_bogus_condwait.stderr.exp 2008-03-13 17:47:01 UTC (rev 7670)
@@ -3,52 +3,17 @@
at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:69)
-Thread 3:
-Race condition: condition variable 0x........ has been signalled but the associated mutex 0x........ is not locked by the signalling thread
- at 0x........: pthread_cond_signal* (drd_pthread_intercepts.c:?)
- by 0x........: rescue_me (tc23_bogus_condwait.c:20)
- by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?)
- by 0x........: (within libpthread-?.?.so)
- by 0x........: clone (in /...libc...)
-
-Thread 1:
Mutex not locked: mutex 0x........, recursion count 0, owner 0.
at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:72)
-Thread 3:
-Race condition: condition variable 0x........ has been signalled but the associated mutex 0x........ is not locked by the signalling thread
- at 0x........: pthread_cond_signal* (drd_pthread_intercepts.c:?)
- by 0x........: rescue_me (tc23_bogus_condwait.c:24)
- by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?)
- by 0x........: (within libpthread-?.?.so)
- by 0x........: clone (in /...libc...)
-
-Thread 1:
Not a mutex
at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:75)
-Thread 3:
-Race condition: condition variable 0x........ has been signalled but the associated mutex 0x........ is not locked by the signalling thread
- at 0x........: pthread_cond_signal* (drd_pthread_intercepts.c:?)
- by 0x........: rescue_me (tc23_bogus_condwait.c:28)
- by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?)
- by 0x........: (within libpthread-?.?.so)
- by 0x........: clone (in /...libc...)
-
-Thread 1:
Mutex not locked by calling thread: mutex 0x........, recursion count 1, owner 2.
at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:78)
-
-Thread 3:
-Race condition: condition variable 0x........ has been signalled but the associated mutex 0x........ is not locked by the signalling thread
- at 0x........: pthread_cond_signal* (drd_pthread_intercepts.c:?)
- by 0x........: rescue_me (tc23_bogus_condwait.c:32)
- by 0x........: vg_thread_wrapper (drd_pthread_intercepts.c:?)
- by 0x........: (within libpthread-?.?.so)
- by 0x........: clone (in /...libc...)
The impossible happened: mutex 0x........ is locked simultaneously by two threads (recursion count 1, owners 2 and 1) !
Thread 2:
@@ -59,4 +24,4 @@
by 0x........: (within libpthread-?.?.so)
by 0x........: clone (in /...libc...)
-ERROR SUMMARY: 9 errors from 9 contexts (suppressed: 0 from 0)
+ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 0 from 0)
|
|
From: <sv...@va...> - 2008-03-13 17:36:46
|
Author: bart
Date: 2008-03-13 17:34:43 +0000 (Thu, 13 Mar 2008)
New Revision: 7669
Log:
The dots (one per detached thread) are again all printed on one line instead of one per line. Changed termination test from a counter protected by a mutex to a counting semaphore.
Modified:
trunk/exp-drd/tests/pth_detached.c
trunk/exp-drd/tests/pth_detached.stdout.exp
trunk/exp-drd/tests/pth_detached2.stdout.exp
Modified: trunk/exp-drd/tests/pth_detached.c
===================================================================
--- trunk/exp-drd/tests/pth_detached.c 2008-03-13 17:32:41 UTC (rev 7668)
+++ trunk/exp-drd/tests/pth_detached.c 2008-03-13 17:34:43 UTC (rev 7669)
@@ -5,15 +5,15 @@
#include <assert.h>
#include <pthread.h>
+#include <semaphore.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "../drd_clientreq.h"
-static int s_finished_count;
-static int s_set_thread_name;
-static pthread_mutex_t s_mutex;
+static int s_set_thread_name;
+static sem_t s_sem;
static void set_thread_name(const char* const fmt, const int arg)
@@ -29,26 +29,15 @@
}
}
-void increment_finished_count()
+static void increment_finished_count()
{
- pthread_mutex_lock(&s_mutex);
- s_finished_count++;
- pthread_mutex_unlock(&s_mutex);
+ sem_post(&s_sem);
}
-int get_finished_count()
-{
- int result;
- pthread_mutex_lock(&s_mutex);
- result = s_finished_count;
- pthread_mutex_unlock(&s_mutex);
- return result;
-}
-
static void* thread_func1(void* arg)
{
set_thread_name("thread_func1[%d]", *(int*)arg);
- write(STDOUT_FILENO, ".\n", 2);
+ write(STDOUT_FILENO, ".", 1);
increment_finished_count();
return 0;
}
@@ -57,7 +46,7 @@
{
set_thread_name("thread_func2[%d]", *(int*)arg);
pthread_detach(pthread_self());
- write(STDOUT_FILENO, ".\n", 2);
+ write(STDOUT_FILENO, ".", 1);
increment_finished_count();
return 0;
}
@@ -79,7 +68,7 @@
for (i = 0; i < count1 || i < count2; i++)
thread_arg[i] = i;
- pthread_mutex_init(&s_mutex, 0);
+ sem_init(&s_sem, 0, 0);
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
@@ -105,15 +94,14 @@
pthread_attr_destroy(&attr);
// Wait until all detached threads have written their output to stdout.
- while (get_finished_count() < count1 + count2)
+ for (i = 0; i < count1 + count2; i++)
{
- struct timespec delay = { 0, 1 * 1000 * 1000 };
- nanosleep(&delay, 0);
+ sem_wait(&s_sem);
}
- printf("\n");
+ write(STDOUT_FILENO, "\n", 1);
- pthread_mutex_destroy(&s_mutex);
+ sem_destroy(&s_sem);
return 0;
}
Modified: trunk/exp-drd/tests/pth_detached.stdout.exp
===================================================================
--- trunk/exp-drd/tests/pth_detached.stdout.exp 2008-03-13 17:32:41 UTC (rev 7668)
+++ trunk/exp-drd/tests/pth_detached.stdout.exp 2008-03-13 17:34:43 UTC (rev 7669)
@@ -1,3 +1 @@
-.
-.
-
+..
Modified: trunk/exp-drd/tests/pth_detached2.stdout.exp
===================================================================
--- trunk/exp-drd/tests/pth_detached2.stdout.exp 2008-03-13 17:32:41 UTC (rev 7668)
+++ trunk/exp-drd/tests/pth_detached2.stdout.exp 2008-03-13 17:34:43 UTC (rev 7669)
@@ -1,21 +1 @@
-.
-.
-.
-.
-.
-.
-.
-.
-.
-.
-.
-.
-.
-.
-.
-.
-.
-.
-.
-.
-
+....................
|
|
From: <sv...@va...> - 2008-03-13 17:36:17
|
Author: bart Date: 2008-03-13 17:32:41 +0000 (Thu, 13 Mar 2008) New Revision: 7668 Log: Changed default number of threads from zero into one. Modified: trunk/exp-drd/tests/matinv.c Modified: trunk/exp-drd/tests/matinv.c =================================================================== --- trunk/exp-drd/tests/matinv.c 2008-03-13 17:24:54 UTC (rev 7667) +++ trunk/exp-drd/tests/matinv.c 2008-03-13 17:32:41 UTC (rev 7668) @@ -42,7 +42,7 @@ /* Local variables. */ /********************/ -static int s_nthread; +static int s_nthread = 1; /*************************/ |
|
From: Konstantin S. <kon...@gm...> - 2008-03-13 17:25:37
|
> > FYI: That stuff doens't seem to be merged into the HGDEV branch yet; it > only seems to exist on http://code.google.com/p/data-race-test/. > right. dynamic_annotations.* and hg_annottions.c are not in HGDEV. But you can use helgrind client requests without those. --kcc |
|
From: <sv...@va...> - 2008-03-13 17:24:59
|
Author: bart
Date: 2008-03-13 17:24:54 +0000 (Thu, 13 Mar 2008)
New Revision: 7667
Log:
Removed casts from function pointer to regular pointer.
Modified:
trunk/memcheck/tests/oset_test.c
Modified: trunk/memcheck/tests/oset_test.c
===================================================================
--- trunk/memcheck/tests/oset_test.c 2008-03-13 12:05:35 UTC (rev 7666)
+++ trunk/memcheck/tests/oset_test.c 2008-03-13 17:24:54 UTC (rev 7667)
@@ -79,7 +79,7 @@
// comparisons.
OSet* oset = VG_(OSetGen_Create)(0,
NULL,
- (void*)malloc, free);
+ malloc, free);
// Try some operations on an empty OSet to ensure they don't screw up.
vg_assert( ! VG_(OSetGen_Contains)(oset, &v) );
@@ -212,7 +212,7 @@
// Create a static OSet of Ints. This one uses fast (built-in)
// comparisons.
- OSet* oset = VG_(OSetWord_Create)( (void*)malloc, free);
+ OSet* oset = VG_(OSetWord_Create)(malloc, free);
// Try some operations on an empty OSet to ensure they don't screw up.
vg_assert( ! VG_(OSetWord_Contains)(oset, v) );
@@ -370,7 +370,7 @@
// comparisons.
OSet* oset = VG_(OSetGen_Create)(offsetof(Block, first),
blockCmp,
- (void*)malloc, free);
+ malloc, free);
// Try some operations on an empty OSet to ensure they don't screw up.
vg_assert( ! VG_(OSetGen_Contains)(oset, &v) );
|
|
From: Erik S. <san...@vi...> - 2008-03-13 16:31:08
|
Konstantin Serebryany wrote: > I have various situations similar to this one (at least, similar to > the minimized test). > I fix it by annotating the source code by Helgrind's client requests. > CONDVAR_SIGNAL and CONVAR_WAIT. > These client request are available only in HGDEV branch so far. > FYI: That stuff doens't seem to be merged into the HGDEV branch yet; it only seems to exist on http://code.google.com/p/data-race-test/. Erik |
|
From: Josef W. <Jos...@gm...> - 2008-03-13 16:29:45
|
On Thursday 13 March 2008, Bart Van Assche wrote: > A question: is self-hosting Valgrind without installing Valgrind > supported ? It resulted in an assertion failure when I tried it. Does this work when installed? I recently had a similar bug report (which I was not able to reproduce), so this could be a real bug in callgrind. I'll check if I can reproduce it... Josef > > Outer Valgrind was configured and built as follows: > $ ./autogen.sh && ./configure && make -s && make -s check > Inner Valgrind was configured and built as follows: > $ ./autogen.sh && ./configure --enable-inner && make -s && make -s check > > $ ../valgrind-outer/vg-in-place --sim-hints=enable-outer > --trace-children=yes --pop-on-jump --tool=callgrind > ../valgrind-inner/vg-in-place --tool=none date > ==4827== Callgrind, a call-graph generating cache profiler. > ==4827== Copyright (C) 2002-2008, and GNU GPL'd, by Josef Weidendorfer et al. > ==4827== Using LibVEX rev 1812, a library for dynamic binary translation. > ==4827== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP. > ==4827== Using valgrind-3.4.0.SVN, a dynamic binary instrumentation framework. > ==4827== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al. > ==4827== For more details, rerun with: -v > ==4827== > ==4827== For interactive control, run 'callgrind_control -h'. > ==4828== Callgrind, a call-graph generating cache profiler. > ==4828== Copyright (C) 2002-2008, and GNU GPL'd, by Josef Weidendorfer et al. > ==4828== Using LibVEX rev 1812, a library for dynamic binary translation. > ==4828== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP. > ==4828== Using valgrind-3.4.0.SVN, a dynamic binary instrumentation framework. > ==4828== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al. > ==4828== For more details, rerun with: -v > ==4828== > ==4828== For interactive control, run 'callgrind_control -h'. > ==4828== > ==4828== Events : Ir > ==4828== Collected : 2324926 > ==4828== > ==4828== I refs: 2,324,926 > 0x0002A918 > BB# 1034156 > > Callgrind: threads.c:247 (vgCallgrind_post_signal): Assertion 'sigNum > == vgCallgrind_current_state.sig' failed. > ==4827== at 0x3801B4BD: report_and_quit (m_libcassert.c:140) > ==4827== by 0x3801B7D1: vgPlain_assert_fail (m_libcassert.c:205) > ==4827== by 0x38018E80: vgCallgrind_post_signal (threads.c:247) > ==4827== by 0x3807F2A7: vgPlain_sigframe_destroy (sigframe-x86-linux.c:710) > ==4827== by 0x38082473: vgSysWrap_x86_linux_sys_sigreturn_before > (syswrap-x86-linux.c:973) > ==4827== by 0x3803CC00: vgPlain_client_syscall (syswrap-main.c:850) > ==4827== by 0x3803A717: vgPlain_scheduler (scheduler.c:798) > ==4827== by 0x3804E6D8: run_a_thread_NORETURN (syswrap-linux.c:89) > > sched status: > running_tid=1 > > Thread 1: status = VgTs_Runnable > ==4827== at 0x40007F2: (within /lib/ld-2.6.1.so) > ==4827== by 0x80802C1: wait_for (in /bin/bash) > ==4827== by 0x80847C3: command_substitute (in /bin/bash) > ==4827== by 0x808BBB6: (within /bin/bash) > ==4827== by 0x808D08C: (within /bin/bash) > ==4827== by 0x808D5BB: expand_string_assignment (in /bin/bash) > ==4827== by 0x8085C22: (within /bin/bash) > ==4827== by 0x80860E8: (within /bin/bash) > ==4827== by 0x808C7A4: (within /bin/bash) > ==4827== by 0x8072E2B: (within /bin/bash) > ==4827== by 0x80717FB: execute_command_internal (in /bin/bash) > ==4827== by 0x806FE92: execute_command (in /bin/bash) > ==4827== by 0x8061F87: reader_loop (in /bin/bash) > ==4827== by 0x8061A4D: main (in /bin/bash) > > > Note: see also the FAQ.txt in the source distribution. > It contains workarounds to several common problems. > > If that doesn't help, please report this bug to: www.valgrind.org > > In the bug report, send all the above text, the valgrind > version, and what Linux distro you are using. Thanks. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers > |
|
From: Konstantin S. <kon...@gm...> - 2008-03-13 15:46:47
|
On Thu, Mar 13, 2008 at 6:30 PM, Bart Van Assche <bar...@gm...> wrote: > On Thu, Mar 13, 2008 at 2:35 PM, Erik Sandberg <san...@vi...> wrote: > > > I'm working with a large project, where Helgrind gives a couple of false > > positives. I've been communicating with Julian for a while, but thought > > it's better to talk to this list. > > Please try exp-drd. No false positives, no need for annotations. Right, exp-drd is pure happens-before detector. Helgrind also has such mode, but this mode could be applied to a single mutex, rather than to all mutexes. If you mark some particular mutex with VG_USERREQ__HG_MUTEX_IS_USED_AS_CONDVAR, helgrind will create a happens-before arc between Unlock and Lock. This will also help in this case. I think test61 (http://code.google.com/p/data-race-test/source/browse/trunk/unittest/racecheck_unittest.cc?r=256#2795) is very close to Erik's original bug.c But please note, that MUTEX_IS_USED_AS_CONDVAR is a big hummer and if used too often will kill helgrind's performance (if not exhaust available RAM before that). --kcc |
|
From: Bart V. A. <bar...@gm...> - 2008-03-13 15:30:05
|
On Thu, Mar 13, 2008 at 2:35 PM, Erik Sandberg <san...@vi...> wrote: > I'm working with a large project, where Helgrind gives a couple of false > positives. I've been communicating with Julian for a while, but thought > it's better to talk to this list. Please try exp-drd. No false positives, no need for annotations. Bart. |
|
From: Konstantin S. <kon...@gm...> - 2008-03-13 15:23:53
|
On Thu, Mar 13, 2008 at 6:11 PM, Julian Seward <js...@ac...> wrote: > On Thursday 13 March 2008 15:30, Konstantin Serebryany wrote: > > I have various situations similar to this one (at least, similar to > > the minimized test). > > I fix it by annotating the source code by Helgrind's client requests. > > CONDVAR_SIGNAL and CONVAR_WAIT. > > These client request are available only in HGDEV branch so far. > > But what is the underlying reason? I suspect it is that there is > a dependency on the numerical value of a_stopped; and that dependency > between the two threads is not visible to H, since it only sees > dependencies created by mutex locks/unlocks and pthread cond/signal > events (etc). > > Is that right? > > Also, do ANNOTATE_CONDVAR_WAIT/SIGNAL artifically notify H of this > dependency? Yes, I think this is the correct explanation. In fact ANNOTATE_CONDVAR_WAIT/SIGNAL client request are just those that are used in interceptors for pthread_cond_wait/signal ` --kcc |
|
From: Julian S. <js...@ac...> - 2008-03-13 15:15:39
|
On Thursday 13 March 2008 15:30, Konstantin Serebryany wrote: > I have various situations similar to this one (at least, similar to > the minimized test). > I fix it by annotating the source code by Helgrind's client requests. > CONDVAR_SIGNAL and CONVAR_WAIT. > These client request are available only in HGDEV branch so far. But what is the underlying reason? I suspect it is that there is a dependency on the numerical value of a_stopped; and that dependency between the two threads is not visible to H, since it only sees dependencies created by mutex locks/unlocks and pthread cond/signal events (etc). Is that right? Also, do ANNOTATE_CONDVAR_WAIT/SIGNAL artifically notify H of this dependency? J |
|
From: Konstantin S. <kon...@gm...> - 2008-03-13 14:42:39
|
I have various situations similar to this one (at least, similar to
the minimized test).
I fix it by annotating the source code by Helgrind's client requests.
CONDVAR_SIGNAL and CONVAR_WAIT.
These client request are available only in HGDEV branch so far.
I've verified that it helps your test:
***************
*** 4,7 ****
--- 4,8 ----
#include <unistd.h>
#include <stdlib.h>
+ #include "dynamic_annotations.h"
static pthread_t threads[2];
***************
*** 24,27 ****
--- 25,29 ----
pthread_mutex_unlock(&lock);
} while (!stop);
+ ANNOTATE_CONDVAR_WAIT(&a_stopped);
// A has stopped, and waits for B to broadcast. Hence, it's safe
// to touch data. Helgrind reports this as a data race.
***************
*** 39,42 ****
--- 41,45 ----
pthread_mutex_lock(&lock);
a_stopped = 1;
+ ANNOTATE_CONDVAR_SIGNAL(&a_stopped);
pthread_cond_wait(&cond, &lock);
// Cleanup.
***************
*** 59,62 ****
return 0;
}
% g++ -g -lpthread bug.c
% /home/kcc/valgrind/hgdev/Inst/bin/valgrind --tool=helgrind ./a.out
...
==17530== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 10 from 3)
% g++ -g -lpthread -DDYNAMIC_ANNOTATIONS=1 bug.c dynamic_annotations.cc
...
==17643== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 10 from 3)
dynamic_annotations.h is a wrapper around helgrind client requests.
YOu may use client requests directly.
The real program *may* require slightly different client request.
--kcc
On Thu, Mar 13, 2008 at 4:35 PM, Erik Sandberg <san...@vi...> wrote:
> Hi,
>
> I'm working with a large project, where Helgrind gives a couple of false
> positives. I've been communicating with Julian for a while, but thought
> it's better to talk to this list.
>
> In my program, each thread owns some data which it manipulates. When an
> asynchronous event (such as user input) happens, all threads halt as
> soon as they can, and when all threads have halted, one of them handles
> the event. The event is executed by a single thread, so it may safely
> manipulate data owned by any thread.
>
> Helgrind complains about a data race, since it doesn't understand that
> some threads are sleeping.
>
> The attached file is a minimized version of my problem. Helgrind gives
> the following output:
>
> ==2518== Helgrind, a thread error detector.
> ==2518== Copyright (C) 2007-2008, and GNU GPL'd, by OpenWorks LLP et al.
> ==2518== Using LibVEX rev exported, a library for dynamic binary
> translation.
> ==2518== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
> ==2518== Using valgrind-3.4.0.SVN, a dynamic binary instrumentation
> framework.
> ==2518== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
> ==2518== For more details, rerun with: -v
> ==2518==
> ==2518== Thread #2 was created
> ==2518== at 0x511C91E: clone (in /lib/libc-2.7.so)
> ==2518== by 0x4E2FA11: pthread_create@@GLIBC_2.2.5 (in
> /lib/libpthread-2.7.so)
> ==2518== by 0x4C26928: pthread_create@* (hg_intercepts.c:213)
> ==2518== by 0x4007AD: main (bug.c:52)
> ==2518==
> ==2518== Thread #3 was created
> ==2518== at 0x511C91E: clone (in /lib/libc-2.7.so)
> ==2518== by 0x4E2FA11: pthread_create@@GLIBC_2.2.5 (in
> /lib/libpthread-2.7.so)
> ==2518== by 0x4C26928: pthread_create@* (hg_intercepts.c:213)
> ==2518== by 0x4007C6: main (bug.c:53)
> ==2518==
> ==2518== T3: Possible data race during write of size 4 at 0x600D20
> ==2518== at 0x40071E: threadB (bug.c:28)
> ==2518== by 0x4C26A43: mythread_wrapper (hg_intercepts.c:193)
> ==2518== by 0x4E2F3F6: start_thread (in /lib/libpthread-2.7.so)
> ==2518== by 0x511C95C: clone (in /lib/libc-2.7.so)
> ==2518== old state: e000002000000000 W #SS=1 #LS=0 S2/T2
> ==2518== new state: c000001000000000 W #SS=2 #LS=0 S2/T2 S4/T3
> ==2518== Location 0x600d20 is 0 bytes inside local var "data"
> ==2518== declared at bug.c:9, in frame #0 of thread 3
> ==2518==
> ==2518== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 9 from 3)
>
>
> Greetings,
> Erik
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Valgrind-developers mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-developers
>
>
|
|
From: Erik S. <san...@vi...> - 2008-03-13 13:37:43
|
Hi, I'm working with a large project, where Helgrind gives a couple of false positives. I've been communicating with Julian for a while, but thought it's better to talk to this list. In my program, each thread owns some data which it manipulates. When an asynchronous event (such as user input) happens, all threads halt as soon as they can, and when all threads have halted, one of them handles the event. The event is executed by a single thread, so it may safely manipulate data owned by any thread. Helgrind complains about a data race, since it doesn't understand that some threads are sleeping. The attached file is a minimized version of my problem. Helgrind gives the following output: ==2518== Helgrind, a thread error detector. ==2518== Copyright (C) 2007-2008, and GNU GPL'd, by OpenWorks LLP et al. ==2518== Using LibVEX rev exported, a library for dynamic binary translation. ==2518== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP. ==2518== Using valgrind-3.4.0.SVN, a dynamic binary instrumentation framework. ==2518== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al. ==2518== For more details, rerun with: -v ==2518== ==2518== Thread #2 was created ==2518== at 0x511C91E: clone (in /lib/libc-2.7.so) ==2518== by 0x4E2FA11: pthread_create@@GLIBC_2.2.5 (in /lib/libpthread-2.7.so) ==2518== by 0x4C26928: pthread_create@* (hg_intercepts.c:213) ==2518== by 0x4007AD: main (bug.c:52) ==2518== ==2518== Thread #3 was created ==2518== at 0x511C91E: clone (in /lib/libc-2.7.so) ==2518== by 0x4E2FA11: pthread_create@@GLIBC_2.2.5 (in /lib/libpthread-2.7.so) ==2518== by 0x4C26928: pthread_create@* (hg_intercepts.c:213) ==2518== by 0x4007C6: main (bug.c:53) ==2518== ==2518== T3: Possible data race during write of size 4 at 0x600D20 ==2518== at 0x40071E: threadB (bug.c:28) ==2518== by 0x4C26A43: mythread_wrapper (hg_intercepts.c:193) ==2518== by 0x4E2F3F6: start_thread (in /lib/libpthread-2.7.so) ==2518== by 0x511C95C: clone (in /lib/libc-2.7.so) ==2518== old state: e000002000000000 W #SS=1 #LS=0 S2/T2 ==2518== new state: c000001000000000 W #SS=2 #LS=0 S2/T2 S4/T3 ==2518== Location 0x600d20 is 0 bytes inside local var "data" ==2518== declared at bug.c:9, in frame #0 of thread 3 ==2518== ==2518== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 9 from 3) Greetings, Erik |