[Git][ghc/ghc][wip/tsan-ghc-8.10] 38 commits: testsuite: Mark hie002 as high_memory_usage

Ben Gamari gitlab at gitlab.haskell.org
Tue Nov 24 18:43:09 UTC 2020



Ben Gamari pushed to branch wip/tsan-ghc-8.10 at Glasgow Haskell Compiler / GHC


Commits:
5300e0e6 by Ben Gamari at 2020-11-24T13:40:34-05:00
testsuite: Mark hie002 as high_memory_usage

This test has a peak residency of 1GByte; this is large enough to
classify as "high" in my book.

- - - - -
3e97158a by Ben Gamari at 2020-11-24T13:40:34-05:00
testsuite: Mark T9872[abc] as high_memory_usage

These all have a maximum residency of over 2 GB.

- - - - -
6df201b5 by Ben Gamari at 2020-11-24T13:40:34-05:00
gitlab-ci: Disable documentation in TSAN build

Haddock chews through enough memory to cause the CI builders to OOM and
there's frankly no reason to build documentation in this job anyways.

- - - - -
878bc8c8 by Ben Gamari at 2020-11-24T13:40:34-05:00
TSANUtils: Ensure that C11 atomics are supported

- - - - -
26d535e5 by Ben Gamari at 2020-11-24T13:40:34-05:00
testsuite: Mark T3807 as broken with TSAN

Due to #18883.

- - - - -
1377402f by Ben Gamari at 2020-11-24T13:40:34-05:00
testsuite: Mark T13702 as broken with TSAN due to #18884

- - - - -
6f10802e by Ben Gamari at 2020-11-24T13:40:34-05:00
rts/BlockAlloc: Use relaxed operations

- - - - -
48fd966b by Ben Gamari at 2020-11-24T13:40:34-05:00
rts: Rework handling of mutlist scavenging statistics

- - - - -
aa2215f9 by Ben Gamari at 2020-11-24T13:40:34-05:00
rts: Avoid data races in StablePtr implementation

This fixes two potentially problematic data races in the StablePtr
implementation:

 * We would fail to RELEASE the stable pointer table when enlarging it,
   causing other cores to potentially see uninitialized memory.

 * We would fail to ACQUIRE when dereferencing a stable pointer.

- - - - -
f2ea40ca by Ben Gamari at 2020-11-24T13:40:34-05:00
rts/Storage: Use atomics

- - - - -
e371a149 by Ben Gamari at 2020-11-24T13:40:34-05:00
rts/Updates: Use proper atomic operations

- - - - -
05975e84 by Ben Gamari at 2020-11-24T13:40:34-05:00
rts/Weak: Eliminate data races

By taking all_tasks_mutex in stat_exit. Also better-document the fact
that the task statistics are protected by all_tasks_mutex.

- - - - -
01d8d105 by Ben Gamari at 2020-11-24T13:40:34-05:00
rts/GC: Use atomics

- - - - -
c30bbd92 by Ben Gamari at 2020-11-24T13:40:34-05:00
rts: Use RELEASE ordering in unlockClosure

- - - - -
65daad33 by Ben Gamari at 2020-11-24T13:40:34-05:00
rts/Storage: Accept races on heap size counters

- - - - -
0fd2a3b4 by Ben Gamari at 2020-11-24T13:40:34-05:00
rts: Join to concurrent mark thread during shutdown

Previously we would take all capabilities but fail to join on the thread
itself, potentially resulting in a leaked thread.

- - - - -
69877da4 by GHC GitLab CI at 2020-11-24T13:40:34-05:00
rts: Fix race in GC CPU time accounting

Ensure that the GC leader synchronizes with workers before calling
stat_endGC.

- - - - -
e5217165 by Ben Gamari at 2020-11-24T13:40:35-05:00
rts/SpinLock: Separate out slow path

Not only is this in general a good idea, but it turns out that GCC
unrolls the retry loop, resulting is massive code bloat in critical
parts of the RTS (e.g. `evacuate`).

- - - - -
b313c317 by Ben Gamari at 2020-11-24T13:40:35-05:00
rts: Use relaxed ordering on spinlock counters

- - - - -
f23aa99e by Ben Gamari at 2020-11-24T13:40:35-05:00
rts: Annotate hopefully "benign" races in freeGroup

- - - - -
2790c396 by Ben Gamari at 2020-11-24T13:40:35-05:00
Strengthen ordering in releaseGCThreads

- - - - -
f711be8a by Ben Gamari at 2020-11-24T13:40:35-05:00
rts/WSDeque: Rewrite with proper atomics

After a few attempts at shoring up the previous implementation, I ended
up turning to the literature and now use the proven implementation,

> N.M. LĂȘ, A. Pop, A.Cohen, and F.Z. Nardelli. "Correct and Efficient
> Work-Stealing for Weak Memory Models". PPoPP'13, February 2013,
> ACM 978-1-4503-1922/13/02.

Note only is this approach formally proven correct under C11 semantics
but it is also proved to be a bit faster in practice.

- - - - -
928dc06d by Ben Gamari at 2020-11-24T13:40:35-05:00
rts: Use relaxed atomics for whitehole spin stats

- - - - -
95760050 by Ben Gamari at 2020-11-24T13:40:35-05:00
rts: Avoid lock order inversion during fork

Fixes #17275.

- - - - -
290ce1a3 by GHC GitLab CI at 2020-11-24T13:40:35-05:00
rts: Use proper relaxe operations in getCurrentThreadCPUTime

Here we are doing lazy initialization; it's okay if we do the check more
than once, hence relaxed operation is fine.

- - - - -
d5241ddf by Ben Gamari at 2020-11-24T13:40:35-05:00
rts/STM: Use atomics

This fixes a potentially harmful race where we failed to synchronize
before looking at a TVar's current_value.

Also did a bit of refactoring to avoid abstract over management of
max_commits.

- - - - -
d511cbb2 by Ben Gamari at 2020-11-24T13:40:35-05:00
rts/stm: Strengthen orderings to SEQ_CST instead of volatile

Previously the `current_value`, `first_watch_queue_entry`, and
`num_updates` fields of `StgTVar` were marked as `volatile` in an
attempt to provide strong ordering. Of course, this isn't sufficient.

We now use proper atomic operations. In most of these cases I strengthen
the ordering all the way to SEQ_CST although it's possible that some
could be weakened with some thought.

- - - - -
9230100f by Ben Gamari at 2020-11-24T13:40:35-05:00
Mitigate data races in event manager startup/shutdown

- - - - -
5db98cfe by Ben Gamari at 2020-11-24T13:40:35-05:00
Suppress data race due to close

This suppresses the other side of a race during shutdown.

- - - - -
65b4ddf4 by Ben Gamari at 2020-11-24T13:40:35-05:00
rts: Accept benign races in Proftimer

- - - - -
4b5216f3 by Ben Gamari at 2020-11-24T13:40:35-05:00
rts: Pause timer while changing capability count

This avoids #17289.

- - - - -
6ca8df01 by Ben Gamari at 2020-11-24T13:40:35-05:00
Fix #17289

- - - - -
5b89c84b by Ben Gamari at 2020-11-24T13:40:35-05:00
suppress #17289 (ticker) race

- - - - -
0122610e by Ben Gamari at 2020-11-24T13:40:35-05:00
rts: Fix timer initialization

Previously `initScheduler` would attempt to pause the ticker and in so
doing acquire the ticker mutex. However, initTicker, which is
responsible for initializing said mutex, hadn't been called
yet.

- - - - -
3bfcaf4b by Ben Gamari at 2020-11-24T13:40:35-05:00
rts: Fix races in Pthread timer backend shudown

We can generally be pretty relaxed in the barriers here since the timer
thread is a loop.

- - - - -
0a75b950 by Ben Gamari at 2020-11-24T13:40:35-05:00
rts/Stats: Hide a few unused unnecessarily global functions

- - - - -
c1b7767f by Ben Gamari at 2020-11-24T13:40:35-05:00
rts/Stats: Protect with mutex

While on face value this seems a bit heavy, I think it's far better than
enforcing ordering on every access.

- - - - -
01325b12 by Ben Gamari at 2020-11-24T13:40:35-05:00
rts: Tear down stats_mutex after exitHeapProfiling

Since the latter wants to call getRTSStats.

- - - - -


30 changed files:

- .gitlab-ci.yml
- includes/rts/OSThreads.h
- includes/rts/SpinLock.h
- includes/rts/StablePtr.h
- includes/rts/TSANUtils.h
- includes/rts/storage/Closures.h
- includes/rts/storage/GC.h
- includes/stg/SMP.h
- libraries/base/GHC/Event/Control.hs
- rts/.tsan-suppressions
- rts/Capability.c
- rts/Capability.h
- rts/Proftimer.c
- rts/RtsStartup.c
- rts/SMPClosureOps.h
- rts/STM.c
- rts/Schedule.c
- rts/Sparks.c
- + rts/SpinLock.c
- rts/StablePtr.c
- rts/Stats.c
- rts/Stats.h
- rts/ThreadPaused.c
- rts/Timer.c
- rts/Updates.h
- rts/WSDeque.c
- rts/WSDeque.h
- rts/Weak.c
- rts/posix/GetTime.c
- rts/posix/OSThreads.c


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0b4a532a1ce8a02afa5f9eb3672ca86f0ea36c6f...01325b12799cc3ccd997aa20006572b132e5b799

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0b4a532a1ce8a02afa5f9eb3672ca86f0ea36c6f...01325b12799cc3ccd997aa20006572b132e5b799
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201124/1d0afdc9/attachment-0001.html>


More information about the ghc-commits mailing list