Julian Seward [Fri, 2 Jan 2009 23:17:02 +0000 (23:17 +0000)]
Suppress all races whose top frame is in libc.so. This is a not very
clever interim solution to the problem of Helgrind reporting lots of
false races in glibc's stdio functions, due to it not seeing the
relevant (inlined, alas) locking that glibc uses.
Tom Hughes [Fri, 2 Jan 2009 11:07:18 +0000 (11:07 +0000)]
Add some more Intel cache configuration values needed for Atom
processors. These come from sandpile.org as the current version
of Intel's Application Note 485 doesn't have them yet.
Julian Seward [Tue, 23 Dec 2008 20:00:23 +0000 (20:00 +0000)]
ML_(addDiCfSI)(): truncate DiCfSI's that fall partially but not
entirely inside the r-x mapped area, so that they fall entirely
within the mapped area. This is necessary in order to avoid
assertion failures later in check_CFSI_related_invariants().
Julian Seward [Sun, 21 Dec 2008 10:44:28 +0000 (10:44 +0000)]
Following r8845, explicitly enable Dwarf3 variable/type info reading
on tests whose output depends on it.
--This line, and those below, will be ignored--
M helgrind/tests/tc20_verifywrap.vgtest
M helgrind/tests/tc16_byterace.vgtest
M helgrind/tests/tc01_simple_race.vgtest
M helgrind/tests/rwlock_race.vgtest
M helgrind/tests/tc06_two_races.vgtest
M helgrind/tests/hg03_inherit.vgtest
M helgrind/tests/tc21_pthonce.vgtest
M helgrind/tests/tc05_simple_race.vgtest
M helgrind/tests/hg04_race.vgtest
M helgrind/tests/hg05_race2.vgtest
Julian Seward [Sun, 21 Dec 2008 10:43:10 +0000 (10:43 +0000)]
Various changes:
* remove flags --trace-addr= and --trace-level=. These no longer
have any effect, so there's no point in having the associated flags.
* add flag --show-conflicts=no|yes [yes], which makes it possible to
disable the conflicting-access collection machinery. This makes
Helgrind run much faster. Perhaps useful in regression testing,
when it is desired only to find out if a race exists, but not to
collect enough information to easily diagnose it.
* add flag --conflict-cache-size= [1000000], which makes it possible
to control how much memory is used for storage of information about
historical (potentially-conflicting) accesses.
* Update comments on the conflicting-access machinery to more closely
reflect the code. Includes comments on the important aspects of
the value N_OLDREF_ACCS. Increase said constant from 3 to 5.
* Fix bug in event_map_bind: when searching for an OldRef.accs[]
entry that matches the current access, don't forget to also
compare the access sizes. The old code only compared the thread
identity and the read/writeness.
* hg_main.c: disable Dwarf3 variable/type info reading by default.
Mostly this provides little benefit and can cause Helgrind to use
a lot more time and memory at startup.
Callgrind: add code pattern for runtime_resolve on OpenSuse11.0/x86
OpenSuse 11.0 has glibc 2.8, which changed the assembly code for
runtime_resolve. This patch rearranges the code search such that
multiple variants can be scanned.
Julian Seward [Sat, 13 Dec 2008 01:20:21 +0000 (01:20 +0000)]
Avoid causing an assertion failure in VG_(make_ExeContext_from_StackTrace)
in the case where VG_(clo_backtrace_size) < N_FRAMES (that is, with
--num-callers=N where N < N_FRAMES).
Julian Seward [Fri, 12 Dec 2008 13:23:03 +0000 (13:23 +0000)]
This commit subtly changes the meaning of the values obtained via the
stack unwind mechanism (the function VG_(record_ExeContext) et al),
clears up some associated kludges, and makes suppression matching work
more reliably.
Prior to this commit, a stack snapshot contained, at [0], the IP of
the relevant thread, and at all positions [1] and above, the return
addresses for the open calls.
When showing a snapshot to the user (in VG_(apply_StackTrace)), and
searching the stack for stack blocks (in VG_(get_data_description)), 1
is subtracted from positions [1] and above, so as to move these return
addresses back to the last byte of the calling instruction. This
subtraction is also done even in VG_(get_StackTrace_wrk) itself, in
order to make the stack unwinding work at all.
It turns out that suppression-vs-function-name matching requires the
same hack, and sometimes failed to match suppressions that should
match, because of this self-same problem.
So the commit changes the stack unwinder itself, so that entries [1]
and above point to the last byte of the call instruction, rather than
the return address. The associated kludges in VG_(apply_StackTrace)
and VG_(get_StackTrace_wrk) are removed, and suppression matching is
observed to work in a case where it failed before.
Julian Seward [Fri, 12 Dec 2008 08:07:49 +0000 (08:07 +0000)]
Add a new module, m_seqmatch, which does very simple sequence (regexp)
matching, in the function VG_(generic_match). Patterns to be matched
against may contain only '*'-style wildcards (matches any number of
elements, we don't care what they are), '?' wildcards (matches exactly
one element, we don't care what it is) and literal elements.
It is totally abstractified, in the sense that the pattern and input
arrays may be arrays of anything. The caller provides enough
information so that VG_(generic_match) can step along both arrays, and
can ask the questions "is this pattern element a '*' ?", "is this
pattern element a '?' ?", and "does this pattern element match an
input element ?".
The existing function VG_(string_match) is reimplemented using
VG_(generic_match), although the ability to escape metacharacters in
the pattern string is removed -- I don't think it was ever used.
In m_errormgr, matching of suppression stacks (including wildcard
"..." lines) against error stacks is re-implemented using
VG_(generic_match).
Further detailed comments are in m_seqmatch.h and pub_tool_seqmatch.h.
A negative side effect is that VG_(string_match) will be much slower
than before, due to the abstractification. It may be necessary to
reimplement a specialised version later.
Julian Seward [Mon, 8 Dec 2008 00:12:28 +0000 (00:12 +0000)]
event_map_lookup: when looking for a previous access to an address,
find conflicting accesses that overlap the current access in any way,
rather than just match at the addresses. This allows reporting of
conflicts between accesses which overlap but are not the same
size/alignment.
Doesn't seem to always work reliably, for reasons I don't understand,
but I so far failed to make a small test case.
Julian Seward [Sun, 7 Dec 2008 01:41:46 +0000 (01:41 +0000)]
* In the conflicting-event mechanism, also record the size and
read-or-writeness of each access, so that these can be displayed in
error messages.
* Use recorded read-or-writeness info to avoid producing error
messages that claim claim two reads race against each other -- this
is clearly silly. For each pair of racing accesses now reported, at
least one of them will (should!) always now be a write, and (as
previously ensured) they will be from different threads.
* Lookups in the conflicting-access map is expensive, so don't do that
as soon as a race is detected. Instead wait until the update_extra
method is called.
Julian Seward [Sat, 6 Dec 2008 22:10:54 +0000 (22:10 +0000)]
Use the new SparseWA data type, rather than WordFM, to implement the
(primary) mapping of the conflicting-access mechanism. This speeds
up Helgrind by 0% to 30% depending on the workload.
Julian Seward [Sat, 6 Dec 2008 22:07:35 +0000 (22:07 +0000)]
Add a new container data type, a Sparse Word Array: an array of UWord
which is also indexed by UWord. This can be used as a replacement for
WordFM with unboxed keys, when the key ranges are dense. It is
implemented as a 256-way radix tree (4-deep on 32-bit platforms,
8-deep on 64-bit platforms).
Julian Seward [Wed, 3 Dec 2008 11:39:37 +0000 (11:39 +0000)]
Change the memory allocation strategy used by the conflicting-access
machinery, so as to allocate fewer chunks of memory. This increases
the speed of Helgrind by about 10% on some apps, which probably means
the conflicting-access machinery itself is about 20% faster.