Commit Graph

53 Commits

Author SHA1 Message Date
Florian Krohm
87dc0e335c Make sure the variable is completely initialised. That's good
practice and also silences a complaint from the Coverity checker.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13258
2013-01-22 00:25:05 +00:00
Florian Krohm
e0685bc47a Remove pointless test. vts->ts is an array and cannot be NULL.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13256
2013-01-21 20:38:54 +00:00
Florian Krohm
af66466ce4 Changes to allow compilation with -Wwrite-strings. That compiler option
is not used for testcases, just for valgrind proper.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13137
2012-11-23 16:17:43 +00:00
Florian Krohm
1f7fdd4b26 Fix Char/HChar mixups in helgrind and then some.
Also fix all usages of the wordFM data structure. Once upon a time
wordFM used Words but now it uses UWords.
Likewise for WordBag.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13070
2012-10-21 03:23:36 +00:00
Julian Seward
4a3633e266 Update copyright dates to include 2012.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12843
2012-08-05 15:46:46 +00:00
Philippe Waroquiers
be97cddd7a Fixes 282230 group allocator for small fixed size, use it for MC_Chunk/SEc vbit
* new files include/pub_tool_groupalloc.h and coregrind/m_groupalloc.c
  implementing a group allocator (based on helgrind group alloc).
* include/Makefile.am coregrind/Makefile.am : added pub_tool_groupalloc.h
  and m_groupalloc.c
* helgrind/libhb_core.c : use pub_tool_groupalloc.h/m_groupalloc.c
  instead  of the local implementation.
* include/pub_tool_oset.h coregrind/m_oset.c : new function
  allowing to create an oset that will use a pool allocator.
  new function allowing to clone an oset (so as to share the pool alloc)
* memcheck/tests/unit_oset.c drd/tests/unit_bitmap.c : modified
  so that it compiles with the new m_oset.c
* memcheck/mc_main.c : use group alloc for MC_Chunk
  memcheck/mc_include.h : declare the MC_Chunk group alloc
* memcheck/mc_main.c : use group alloc for the nodes of the secVBitTable OSet
* include/pub_tool_hashtable.h coregrind/m_hashtable.c : pass the free node
  function in the VG_(HT_destruct).
  (needed as the hashtable user can allocate a node with its own alloc,
  the hash table destroy must be able to free the nodes with the user
  own free).
* coregrind/m_gdbserver/m_gdbserver.c : pass free function to VG_(HT_destruct)
* memcheck/mc_replace_strmem.c memcheck/mc_machine.c
  memcheck/mc_malloc_wrappers.c memcheck/mc_leakcheck.c
  memcheck/mc_errors.c memcheck/mc_translate.c : new include needed
  due to group alloc.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12341
2012-01-17 21:16:30 +00:00
Julian Seward
c96096ab24 Update all copyright dates, from 20xy-2010 to 20xy-2011.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12206
2011-10-23 07:32:08 +00:00
Julian Seward
3e9f7836c5 Merge the contents of the HGDEV2 branch into trunk:
* performance and scalability improvements
* show locks held by both threads in a race
* show all 4 locks involved in a lock order violation
* better delimited error messages



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11824
2011-06-24 10:09:41 +00:00
Julian Seward
21dc1d9d42 scalarts_limitations_fail_NORETURN: fix a format string error
spotted by IBM's BEAM checker.  (Why didn't gcc or clang see this?)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11725
2011-05-04 09:08:34 +00:00
Julian Seward
aca925fd10 When handling client munmaps and mprotects with r=0 & w=0, actually
paint the relevant address range as NoAccess rather than ignoring the
event.  This is important for avoiding VTS leaks in libhb_core.
More details in comments in the code.

Also rename the _noaccess_ painters that do nothing to make it clearer
that they do nothing :-)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11654
2011-03-17 19:39:55 +00:00
Julian Seward
f701e93f04 Followup to r11619: more tidying up w.r.t. the renaming of
'struct _Thr :: opaque' to 'struct _Thr :: hgthread'.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11623
2011-03-10 21:34:21 +00:00
Julian Seward
f4b08e78ed Minor cleanup (no functional change): rename 'struct _Thr :: opaque'
to 'hgthread', since that's what it is really.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11619
2011-03-10 15:14:37 +00:00
Julian Seward
1cb409edef Simplify the implementation of VTS__tick. The previous version was
hard to understand, and had no comments re loop invariants etc.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11572
2011-02-27 23:39:53 +00:00
Julian Seward
a3b68857f7 Change the representation of VTSs. Instead of using an XArray of
ScalarTSs, have the ScalarTS array as a trailing array directly on the
VTS structure.  This reduces the number of malloc'd blocks per VTS
from 3 to 1, since an XArray always requires 2 malloc'd blocks.  At
least for tc19_shadowmem this reduces the total amount of heap
turnover in Arena 'tool' by a factor of 3, and modestly improves
performance whilst modestly reducing overall memory use.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11571
2011-02-27 23:04:12 +00:00
Julian Seward
1f5db4cb20 Scalability fix for Helgrind: reduce the size of ScalarTS (scalar
timestamps) from 16 to 8 bytes.  This halves the size of vector
timestamps and reduces the amount of memory needed to run programs
that have many threads and/or many synchronisation events.

The tradeoff is that Helgrind must abort the run if the program
creates more than 2^20 (1.0e+6) threads or performs more than 2^44
(1.76e+13) synchronisation events.  Neither of these seem like a
significant limitation in practice.  It's easy to argue that a limit
of 2^44 synch events would take at a minimum, several CPU months on a
very fast machine.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11570
2011-02-24 15:25:24 +00:00
Julian Seward
a18fd89fb7 A scalability fix for Helgrind for running large workloads. When
creating new vector timestamps (VTSs) via tick and join operations,
preallocate the underlying XArray of ScalarTSs (scalar timestamps) at
the likely final size, using new function VG_(newSizedXA) introduced
in r11558.  This reduces overall heap turnover (in VG_AR_TOOL) by a
factor of several.  Together with revs 11567 and 11568, it mitigates
the worst-case performance falloff in long runs that involve lots of
threads and lots of synchronisation events (a.k.a Vector timestamps).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11569
2011-02-23 13:30:53 +00:00
Julian Seward
415232cfec libhb_so_recv(): don't pass a NULL filter to Filter__clear. Not sure
why thr->filter can be NULL here, though.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11136
2010-05-28 20:09:59 +00:00
Julian Seward
3b14257eb1 Rollup changes for Helgrind:
* Add new client request VALGRIND_HG_CLEAN_MEMORY_HEAPBLOCK.  This is
  like VALGRIND_HG_CLEAN_MEMORY but doesn't take an address range.
  Instead it takes a single argument which is supposed to be a pointer
  to the start of, or anywhere within, a heap allocated block.
  Helgrind then finds the block and paints it as belonging to the
  calling thread.  This is needed for correctly describing the
  behaviour of threadsafe reference counting when applied to classes
  involving inheritance of release methods or involving multiple
  inheritance.

* Add statistics counters for all basic VTS operations (tick, join,
  cmpLEQ, cmp_structural).

* Rewrite VTS__cmp_structural to be much faster.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11123
2010-05-05 09:34:42 +00:00
Julian Seward
9b0574dff8 Update copyright dates to 2010.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11121
2010-05-03 21:37:12 +00:00
Julian Seward
e5633740b6 Comment-only change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11103
2010-04-12 20:05:24 +00:00
Julian Seward
6f885d9f81 Rollup fixes for Helgrind:
* tracking of barriers: add support for resizable barriers

* resync TSan-compatible client requests with latest changes

* add direct access to the client requests used in hg_intercepts.c

* add a client request pair to disable and re-enable tracking
  of arbitrary address ranges



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11062
2010-03-03 23:03:40 +00:00
Julian Seward
45b8f5e4bf Increase the maximum size of the conflict cache even more, to 30
million.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10831
2009-08-16 22:52:29 +00:00
Julian Seward
adbc233c4d Double the maximum size of the conflict cache.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10817
2009-08-14 21:33:34 +00:00
Julian Seward
abf37ff2dc Move printing of EvM-gc and VTS-gc stats from -v to --stats=yes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10776
2009-08-11 10:39:25 +00:00
Julian Seward
5204eb3398 Attend to space leaks, to the extent that I can.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10687
2009-08-02 10:15:07 +00:00
Julian Seward
896110462a Small improvements, including some commenting, for the H1 history
mechanism.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10686
2009-08-02 09:34:35 +00:00
Julian Seward
2e19ec8ac9 Back out a small part of r10589 (the tick-after-recv thing). On
contemplation it seems like a bad idea.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10650
2009-07-28 20:22:18 +00:00
Julian Seward
aa884bb888 Only collect stacktraces at scalar Kr boundaries at history level 1.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10621
2009-07-26 19:50:06 +00:00
Julian Seward
6334c4c3f9 Various improvements:
* rename many functions to do with shadow memory handling, to
  more clearly differentiate reads and writes directly of the
  shadow state from client reads and writes, each of which
  generate both a read and a write of the client state.  It was
  getting confusing (== hard to verify) in there.

* use idempotency of memory state machine transition rules to
  speed up long sequential sections, speedups in range 0% to 28%

* remove 4-way Pord (EQ, LT, GT, UN) and associated machinery,
  and replace it with something that merely computes LEQ in the
  partial ordering, since that's all that is necessary, and
  this simplifies some fast-case paths.

* add optional approx history mechanism a la DRD (start/end stack
  of conflicting segment), much faster if you don't need exact
  conflicting-access details

* libhb_so_recv: tick the VTS in the receiving thread; don't just
  join with the VC in the SO.  It's probably correct without this
  modification, but that correctness is fragile and depends on
  complex properties of how SOs are used/created.  Much better to
  be completely safe.  (Needs cache-isation).

* get rid of unnecessary shadow memory state "SVal_NOACCESS"
  and simplify associated fast-case paths in msmc{read,write}



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10589
2009-07-24 08:45:08 +00:00
Julian Seward
d6407ffc63 Merge helgrind/ changes from branches/MESSAGING_TIDYUP r10464.
See trunk r10465 commit message for details.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10468
2009-07-15 14:50:02 +00:00
Julian Seward
3109865279 Merge in branches/DCAS.
This branch adds proper support for atomic instructions, proper in the
sense that the atomicity is preserved through the compilation
pipeline, and thus in the instrumented code.

These changes track the IR changes added by vex r1901.  They primarily
update the instrumentation functions in all tools to handle the
changes, with the exception of exp-ptrcheck, which needs some further
work in order to be able to run threaded code.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10392
2009-07-01 08:10:49 +00:00
Julian Seward
97e2bdc064 When updating the constraint for a location following a race, make
sure the read-constraint <= the write-constraint.  Failure to do this
leads to assertion failures later on.  Fixes #181394.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10074
2009-05-21 14:54:05 +00:00
Nicholas Nethercote
98386a7102 Fix up some stack trace inconsistencies:
- When printing suppressions, never print more entries than there are in the
  stack.  This avoids bogus suppressions in some cases!  (I haven't seen
  them on Linux, but I have seen them on Darwin.)

- When getting a stack trace, stop if we get an IP of zero or one;  that
  means we've hit the end of the stack.  And don't include that entry in the
  stack trace, because it's a guaranteed "???" if it's ever printed which is
  useless.

- In VG_(apply_StackTrace), we can now rely entirely on the n_ip parameter
  rather than looking for 0 or -1, because that check is done when the stack
  trace is first obtained.  In other words, stack traces all use an n_ip
  parameter to record their size, whereas previously they used an odd
  mixture of n_ip and null-termination.

- Rename 'n_ips' variables as 'max_n_ips' where appropriate;  those left as
  'n_ips' truly describe how many IPs there are in the stack trace.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9793
2009-05-07 23:08:10 +00:00
Nicholas Nethercote
7c51693e2b Don't store the frames hash in .frames[0] and the actual frames in
.frames[1..N_FRAMES].  Instead store the hash in a separate .frames_hash
field, and the actual frames in .frames[0..N_FRAMES-1].



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9778
2009-05-05 23:46:24 +00:00
Nicholas Nethercote
b15e3d9a45 Fix all the non-VEX problems identified with the Clang Static Analyzer.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9416
2009-03-15 23:25:38 +00:00
Nicholas Nethercote
2001629c3f Updated copyright years.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9344
2009-03-10 22:02:09 +00:00
Julian Seward
f3523a4a0e Some minor format string fixes for gcc-3.3.3 (SuSE 9.1). Not sure why
later gccs don't complain about these.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9019
2009-01-22 12:24:26 +00:00
Julian Seward
28f3b05d68 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.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8845
2008-12-21 10:43:10 +00:00
Julian Seward
7992575441 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).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8820
2008-12-13 01:20:21 +00:00
Julian Seward
061e035f79 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.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8811
2008-12-08 00:12:28 +00:00
Julian Seward
24b526c62b Tidy up and comment sanity-checking code/configuration.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8810
2008-12-07 11:40:17 +00:00
Julian Seward
5da3926707 * 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.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8809
2008-12-07 01:41:46 +00:00
Julian Seward
44da343f9c 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.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8807
2008-12-06 22:10:54 +00:00
Julian Seward
a6613bcb2b 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.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8803
2008-12-03 11:39:37 +00:00
Julian Seward
468ca56d5d event_map_maybe_GC: use a flat array when computing the distribution
(counts) of generation numbers in the oldrefTree, instead of using a
WordFM as an associative array.  This significantly accelerates the
event map garbage collector.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8794
2008-11-20 23:17:01 +00:00
Julian Seward
36ca6df95a Re-set constraints in 'consistent' style after a race is detected,
instead of the more aggressive setting, which appeared to cause a
large number of extra race reports.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8793
2008-11-20 11:20:50 +00:00
Julian Seward
9398b50c4a Don't put raced-on locations in an (E)rror state; instead leave them
in a (C)onstraint state.  The former approach can cause races to be
missed.  Also, update state machine slightly following re-analysis
thereof.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8788
2008-11-19 16:35:15 +00:00
Julian Seward
c9b2f74417 event_map_maybe_GC: handle corner case that was previously simply
asserted on: if all the entries in the event map are in the same
generation, then we have no LRU information at all with which to
decide which entries to discard.  So in this case throw away half of
them randomly -- there's nothing better we can do.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8783
2008-11-18 23:40:00 +00:00
Julian Seward
2a7aedcf12 Handle EvM GC messaging properly.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8760
2008-11-10 16:19:21 +00:00
Julian Seward
4757ac5356 Update baseline expected outputs, now that Helgrind uses a different
algorithm than in 3.3.x.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8750
2008-11-09 20:47:57 +00:00