[Git][ghc/ghc][wip/tsan-ghc-8.10] 100 commits: [macOS] improved runpath handling

Ben Gamari gitlab at gitlab.haskell.org
Tue Nov 24 17:06:50 UTC 2020



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


Commits:
43f97049 by Moritz Angermann at 2020-10-14T13:51:31-04:00
[macOS] improved runpath handling

In b592bd98ff25730bbe3c13d6f62a427df8c78e28 we started using
-dead_strip_dylib on macOS when lining dynamic libraries and binaries.
The underlying reason being the Load Command Size Limit in macOS
Sierra (10.14) and later.

GHC will produce @rpath/libHS... dependency entries together with a
corresponding RPATH entry pointing to the location of the libHS...
library. Thus for every library we produce two Load Commands.  One to
specify the dependent library, and one with the path where to find it.
This makes relocating libraries and binaries easier, as we just need to
update the RPATH entry with the install_name_tool. The dynamic linker
will then subsitute each @rpath with the RPATH entries it finds in the
libraries load commands or the environement, when looking up @rpath
relative libraries.

-dead_strip_dylibs intructs the linker to drop unused libraries. This in
turn help us reduce the number of referenced libraries, and subsequently
the size of the load commands.  This however does not remove the RPATH
entries.  Subsequently we can end up (in extreme cases) with only a
single @rpath/libHS... entry, but 100s or more RPATH entries in the Load
Commands.

This patch rectifies this (slighly unorthodox) by passing *no* -rpath
arguments to the linker at link time, but -headerpad 8000.  The
headerpad argument is in hexadecimal and the maxium 32k of the load
command size.  This tells the linker to pad the load command section
enough for us to inject the RPATHs later.  We then proceed to link the
library or binary with -dead_strip_dylibs, and *after* the linking
inspect the library to find the left over (non-dead-stripped)
dependencies (using otool).  We find the corresponding RPATHs for each
@rpath relative dependency, and inject them into the library or binary
using the install_name_tool.  Thus achieving a deadstripped dylib (and
rpaths) build product.

We can not do this in GHC, without starting to reimplement a dynamic
linker as we do not know which symbols and subsequently libraries are
necessary.

Commissioned-by: Mercury Technologies, Inc. (mercury.com)
(cherry picked from commit 4ff93292243888545da452ea4d4c1987f2343591)
Signed-off-by: Moritz Angermann <moritz.angermann at iohk.io>

- - - - -
da1b5345 by Ben Gamari at 2020-10-16T01:10:54+02:00
typecheck: Drop SPECIALISE pragmas when there is no unfolding

Previously the desugarer would instead fall over when it realized that
there was no unfolding for an imported function with a SPECIALISE
pragma. We now rather drop the SPECIALISE pragma and throw a warning.

Fixes #18118.

(cherry picked from commit 708e374a8bf108999c11b6cf59c7d27677ed24a8)

- - - - -
f3bc882d by Ben Gamari at 2020-10-16T01:13:02+02:00
testsuite: Add test for #18118

(cherry picked from commit 2cdb72a569f6049a390626bca0dd6e362045ed65)

Conflicts:
	testsuite/tests/typecheck/should_compile/all.T

- - - - -
7e6c6340 by Moritz Angermann at 2020-10-16T01:14:57+02:00
[fixup 3433] move debugBelch into IF_DEBUG(linker)

The commit in dff1cb3d9c111808fec60190747272b973547c52 incorrectly left
the `debugBelch` function without a comment or IF_DEBUG(linker,)
decoration. This rectifies it.

Needs at least a 8.10 backport, as it was backported in 6471cc6aff80d5deebbdb1bf7b677b31ed2af3d5

(cherry picked from commit 6189cc04ca6c3d79126744e988b487f75ccef9e2)

- - - - -
1ac0a2aa by Ben Gamari at 2020-10-16T01:16:06+02:00
rts: Add stg_copyArray_barrier to RtsSymbols list

It's incredible that this wasn't noticed until now.

(cherry picked from commit ea1cbb8f2ac9e077ed19530911c3a35c5f46ee8a)

- - - - -
1fdadd41 by Ben Gamari at 2020-10-16T01:16:38+02:00
rts: Fix erroneous usage of vsnprintf

As pointed out in #18685, this should be snprintf not vsnprintf. This
appears to be due to a cut-and-paste error.

Fixes #18658.

(cherry picked from commit ce42e187ebfc81174ed477f247f023ae094c9b24)

- - - - -
ec6b31f0 by Ben Gamari at 2020-10-16T01:17:08+02:00
rts/nonmoving: Add missing STM write barrier

When updating a TRec for a TVar already part of a transaction we
previously neglected to add the old value to the update remembered set.
I suspect this was the cause of #18587.

(cherry picked from commit 0799b3de3e3462224bddc0e4b6a3156d04a06361)

- - - - -
7367ae91 by Ben Gamari at 2020-10-16T01:17:33+02:00
rts: Drop field initializer on thread_basic_info_data_t

This struct has a number of fields and we only care that the value is
initialized with zeros. This eliminates the warnings noted in #17905.

(cherry picked from commit 057db94ce038970b14df1599fe83097c284b9c1f)

- - - - -
5b5dde18 by Benjamin Maurer at 2020-10-16T01:19:50+02:00
Workaround for #18623: GHC crashes bc. under rlimit for vmem it will reserve
_all_ of it, leaving nothing for, e.g., thread stacks.
Fix will only allocate 2/3rds and check whether remainder is at least large
enough for minimum amount of thread stacks.

(cherry picked from commit 74c797f6b72c4d01f5e0092dfac1461f3f3dd7a2)

- - - - -
8cb4fe24 by Krzysztof Gogolewski at 2020-10-16T01:20:55+02:00
Add a flag to indicate that gcc supports -no-pie

Fixes #17919.

(cherry picked from commit 587c3c514f05f97082952d613695f1186ff3174e)

- - - - -
5a4d0c3d by Krzysztof Gogolewski at 2020-10-16T01:21:41+02:00
Add -pgmlm and -optlm flags

!3798 added documentation and semantics for the flags,
but not parsing.

(cherry picked from commit fd302e938ebf48c73d9f715d67ce8cd990f972ff)

- - - - -
658362c6 by Tamar Christina at 2020-10-19T23:16:22-04:00
rts: fix race condition in StgCRun

On windows the stack has to be allocated 4k at a time, otherwise we get
a segfault. This is done by using a helper ___chkstk_ms that is provided
by libgcc. The Haskell side already knows how to handle this but we need
to do the same from STG. Previously we would drop the stack in StgRun
but would only make it valid whenever the scheduler loop ran.

This approach was fundamentally broken in that it falls apart when you
take a signal from the OS. We see it less often because you initially
get allocated a 1MB stack block which you have to blow past first.

Concretely this means we must always keep the stack valid.

Fixes #18601.

(cherry picked from commit fd984d68e5ec4b04bc79395c099434e653eb1060)

- - - - -
f60607cf by Ben Gamari at 2020-10-21T22:01:58-04:00
rts: Add __mingw_vsnwprintf to RtsSymbols

- - - - -
929e09ed by toonn at 2020-10-22T22:12:43-04:00
Fix typos in 8.10.2 changelog

Replace an "as well" missing "as" with "and" in 4.1 Highlights.

Add missing apostrophe in "user's guide", insert space in "work around"
and dash in "cost-center" in 4.2.2 Runtime system.

- - - - -
cc085aef by Ben Gamari at 2020-10-31T22:31:33-04:00
Bump Cabal submodule to 3.2.1.0

- - - - -
f96d6cd7 by Ben Gamari at 2020-11-14T06:47:14-05:00
testsuite: Add test for #18346

This was fixed by 4291bddaea3148908c55f235ee8978e1d9aa6f20.

(cherry picked from commit ee5dcdf95a7c408e9c339aacebf89a007a735f8f)

- - - - -
36c1027d by Ben Gamari at 2020-11-14T06:47:14-05:00
rts/linker: Fix relocation overflow in PE linker

Previously the overflow check for the IMAGE_REL_AMD64_ADDR32NB
relocation failed to account for the signed nature of the value.
Specifically, the overflow check was:

    uint64_t v;
    v = S + A;
    if (v >> 32) { ... }

However, `v` ultimately needs to fit into 32-bits as a signed value.
Consequently, values `v > 2^31` in fact overflow yet this is not caught
by the existing overflow check.

Here we rewrite the overflow check to rather ensure that
`INT32_MIN <= v <= INT32_MAX`. There is now quite a bit of repetition
between the `IMAGE_REL_AMD64_REL32` and `IMAGE_REL_AMD64_ADDR32` cases
but I am leaving fixing this for future work.

This bug was first noticed by @awson.

Fixes #15808.

(cherry picked from commit 6d21ecee535782f01dba9947a49e282afee25724)

- - - - -
410b43a2 by Andreas Klebinger at 2020-11-18T16:22:35-05:00
NCG: Fix 64bit int comparisons on 32bit x86

We no compare these by doing 64bit subtraction and
checking the resulting flags.

We used to do this differently but the old approach was
broken when the high bits compared equal and the comparison
was one of >= or <=.

The new approach should be both correct and faster.

(cherry picked from commit bb100805337adc666867da300ee5b0b11c18fe00)
(cherry picked from commit fda3e50b559f6f25347f9ad7239e5003e27937b0)

- - - - -
ed57c3a9 by Ben Gamari at 2020-11-18T21:39:41-05:00
rts: Refactor foreign export tracking

This avoids calling `libc` in the initializers which are responsible for
registering foreign exports. We believe this should avoid the corruption
observed in #18548.

See Note [Tracking foreign exports] in rts/ForeignExports.c for an
overview of the new scheme.

(cherry picked from commit c492134912e5270180881b7345ee86dc32756bdd)

- - - - -
65be3832 by Ben Gamari at 2020-11-18T21:39:53-05:00
rts: Refactor unloading of foreign export StablePtrs

Previously we would allocate a linked list cell for each foreign export.
Now we can avoid this by taking advantage of the fact that they are
already broken into groups.

(cherry picked from commit 40dc91069d15bfc1d81f1722b39e06cac8fdddd1)

- - - - -
3571cc41 by Matthias Andreas Benkard at 2020-11-19T15:36:22-05:00
macOS: Load frameworks without stating them first.

macOS Big Sur makes the following change to how frameworks are shipped
with the OS:

> New in macOS Big Sur 11 beta, the system ships with a built-in
> dynamic linker cache of all system-provided libraries. As part of
> this change, copies of dynamic libraries are no longer present on
> the filesystem. Code that attempts to check for dynamic library
> presence by looking for a file at a path or enumerating a directory
> will fail. Instead, check for library presence by attempting to
> dlopen() the path, which will correctly check for the library in the
> cache. (62986286)

https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11-beta-release-notes/

Therefore, the previous method of checking whether a library exists
before attempting to load it makes GHC.Runtime.Linker.loadFramework
fail to find frameworks installed at /System/Library/Frameworks.

GHC.Runtime.Linker.loadFramework now opportunistically loads the
framework libraries without checking for their existence first,
failing only if all attempts to load a given framework from any of the
various possible locations fail.

- - - - -
57b5f130 by Matthias Andreas Benkard at 2020-11-19T15:36:22-05:00
loadFramework: Output the errors collected in all loading attempts.

With the recent change away from first finding and then loading a
framework, loadFramework had no way of communicating the real reason
why loadDLL failed if it was any reason other than the framework
missing from the file system.  It now collects all loading attempt
errors into a list and concatenates them into a string to return to
the caller.

- - - - -
07c5acae by Matthias Andreas Benkard at 2020-11-19T15:36:22-05:00
Document loadFramework changes. (#18446)

Adds commentary on the rationale for the changes made in merge request
!3689.

- - - - -
d84ae4d7 by Ben Gamari at 2020-11-24T12:05:59-05:00
SMP.h: Add C11-style atomic operations

- - - - -
d3c57867 by Ben Gamari at 2020-11-24T12:05:59-05:00
rts: Infrastructure for testing with ThreadSanitizer

- - - - -
623090ff by Ben Gamari at 2020-11-24T12:05:59-05:00
rts/CNF: Initialize all bdescrs in group

It seems wise and cheap to ensure that the whole bdescr of all blocks of
a compact group is valid, even if most cases only look at the flags
field.

- - - - -
e2b937de by Ben Gamari at 2020-11-24T12:06:00-05:00
rts/Capability: Intialize interrupt field

Previously this was left uninitialized.

Also clarify some comments.

- - - - -
9b5e63e8 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts/Task: Make comments proper Notes

- - - - -
b151680d by Ben Gamari at 2020-11-24T12:06:00-05:00
rts/SpinLock: Move to proper atomics

This is fairly straightforward; we just needed to use relaxed operations
for the PROF_SPIN counters and a release store instead of a write
barrier.

- - - - -
1be2beab by Ben Gamari at 2020-11-24T12:06:00-05:00
rts/OSThreads: Fix data race

Previously we would race on the cached processor count. Avoiding this is
straightforward; just use relaxed operations.

- - - - -
9cef76a2 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts/ClosureMaros: Use relaxed atomics

- - - - -
62df95f5 by Ben Gamari at 2020-11-24T12:06:00-05:00
testsuite: Fix thread leak in hs_try_putmvar00[13]

- - - - -
8b544487 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts: Introduce SET_HDR_RELEASE

Also ensure that we also store the info table pointer last to ensure
that the synchronization covers all stores.

- - - - -
17b82ff6 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts: Factor out logic to identify a good capability for running a task

Not only does this make the control flow a bit clearer but it also
allows us to add a TSAN suppression on this logic, which requires
(harmless) data races.

- - - - -
f30971d6 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts: Annotate benign race in waitForCapability

- - - - -
2a70c253 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts: Clarify locking behavior of releaseCapability_

- - - - -
9047b483 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts: Add assertions for task ownership of capabilities

- - - - -
ca946de2 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts: Use relaxed atomics on n_returning_tasks

This mitigates the warning of a benign race on n_returning_tasks in
shouldYieldCapability.

See #17261.

- - - - -
3336b9ad by Ben Gamari at 2020-11-24T12:06:00-05:00
rts: Mitigate races in capability interruption logic

- - - - -
5e7cf74f by Ben Gamari at 2020-11-24T12:06:00-05:00
rts/Capability: Use relaxed operations for last_free_capability

- - - - -
b6baf633 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts: Use relaxed operations for cap->running_task (TODO)

This shouldn't be necessary since only the owning thread of the capability
should be touching this.

- - - - -
ad72d7a7 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts/Schedule: Use relaxed operations for sched_state

- - - - -
ac23a4b1 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts: Accept data race in work-stealing implementation

This race is okay since the task is owned by the capability pushing it.
By Note [Ownership of Task] this means that the capability is free to
write to `task->cap` without taking `task->lock`.

Fixes #17276.

- - - - -
0f992176 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts: Eliminate data races on pending_sync

- - - - -
968e57e8 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts/Schedule: Eliminate data races on recent_activity

We cannot safely use relaxed atomics here.

- - - - -
f57d054c by Ben Gamari at 2020-11-24T12:06:00-05:00
rts: Avoid data races in message handling

- - - - -
c087685e by Ben Gamari at 2020-11-24T12:06:00-05:00
rts/Messages: Drop incredibly fishy write barrier

executeMessage previously had a write barrier at the beginning of its
loop apparently in an attempt to synchronize with another thread's
writes to the Message. I would guess that the author had intended to use
a load barrier here given that there are no globally-visible writes done
in executeMessage.

I've removed the redundant barrier since the necessary load barrier is
now provided by the ACQUIRE_LOAD.

- - - - -
406fb545 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts/ThreadPaused: Avoid data races

- - - - -
2f24325d by Ben Gamari at 2020-11-24T12:06:00-05:00
rts/Schedule: Eliminate data races in run queue management

- - - - -
d2dad2eb by Ben Gamari at 2020-11-24T12:06:00-05:00
rts: Eliminate shutdown data race on task counters

- - - - -
bee14332 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts/Threads: Avoid data races (TODO)

Replace barriers with appropriate ordering. Drop redundant barrier in
tryWakeupThread (the RELEASE barrier will be provided by sendMessage's
mutex release).

We use relaxed operations on why_blocked and the stack although it's not
clear to me why this is necessary.

- - - - -
df937d52 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts/Messages: Annotate benign race

- - - - -
d91a6199 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts/RaiseAsync: Synchronize what_next read

- - - - -
39b37c11 by Ben Gamari at 2020-11-24T12:06:00-05:00
rts/Task: Move debugTrace to avoid data race

Specifically, we need to hold all_tasks_mutex to read taskCount.

- - - - -
22876a69 by Ben Gamari at 2020-11-24T12:06:00-05:00
Disable flawed assertion

- - - - -
d83f867e by Ben Gamari at 2020-11-24T12:06:00-05:00
Document schedulePushWork race

- - - - -
c02ed4be by Ben Gamari at 2020-11-24T12:06:01-05:00
Capabiliity: Properly fix data race on n_returning_tasks

There is a real data race but can be made safe by using proper atomic
(but relaxed) accesses.

- - - - -
cdb3e4d1 by Ben Gamari at 2020-11-24T12:06:01-05:00
rts: Make write of to_cap->inbox atomic

This is necessary since emptyInbox may read from to_cap->inbox without
taking cap->lock.

- - - - -
54ec6dd6 by Ben Gamari at 2020-11-24T12:06:01-05:00
gitlab-ci: Add nightly-x86_64-linux-deb9-tsan job

- - - - -
16574964 by GHC GitLab CI at 2020-11-24T12:06:01-05:00
testsuite: Mark setnumcapabilities001 as broken with TSAN

Due to #18808.

- - - - -
08f636bc by GHC GitLab CI at 2020-11-24T12:06:01-05:00
testsuite: Skip divbyzero and derefnull under TSAN

ThreadSanitizer changes the output of these tests.

- - - - -
c6195ca1 by Ben Gamari at 2020-11-24T12:06:01-05:00
testsuite: Skip high memory usage tests with TSAN

ThreadSanitizer significantly increases the memory footprint of tests,
so much so that it can send machines into OOM.

- - - - -
6f8204c9 by Ben Gamari at 2020-11-24T12:06:01-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.

- - - - -
3f64dc6d by Ben Gamari at 2020-11-24T12:06:01-05:00
testsuite: Mark T9872[abc] as high_memory_usage

These all have a maximum residency of over 2 GB.

- - - - -
75cf9779 by Ben Gamari at 2020-11-24T12:06:01-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.

- - - - -
0616ef30 by Ben Gamari at 2020-11-24T12:06:01-05:00
TSANUtils: Ensure that C11 atomics are supported

- - - - -
1a72b5b7 by Ben Gamari at 2020-11-24T12:06:01-05:00
testsuite: Mark T3807 as broken with TSAN

Due to #18883.

- - - - -
b78d9e19 by Ben Gamari at 2020-11-24T12:06:33-05:00
testsuite: Mark T13702 as broken with TSAN due to #18884

- - - - -
454fc268 by Ben Gamari at 2020-11-24T12:06:39-05:00
rts/BlockAlloc: Use relaxed operations

- - - - -
5b5f95cd by Ben Gamari at 2020-11-24T12:06:39-05:00
rts: Rework handling of mutlist scavenging statistics

- - - - -
a491b2bd by Ben Gamari at 2020-11-24T12:06:39-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.

- - - - -
9385616f by Ben Gamari at 2020-11-24T12:06:39-05:00
rts/Storage: Use atomics

- - - - -
bea6352f by Ben Gamari at 2020-11-24T12:06:39-05:00
rts/Updates: Use proper atomic operations

- - - - -
b61d42f1 by Ben Gamari at 2020-11-24T12:06:39-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.

- - - - -
e6fb1a23 by Ben Gamari at 2020-11-24T12:06:39-05:00
rts/GC: Use atomics

- - - - -
a9612385 by Ben Gamari at 2020-11-24T12:06:39-05:00
rts: Use RELEASE ordering in unlockClosure

- - - - -
3dd8d329 by Ben Gamari at 2020-11-24T12:06:39-05:00
rts/Storage: Accept races on heap size counters

- - - - -
78c415cb by Ben Gamari at 2020-11-24T12:06:39-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.

- - - - -
bf7f5836 by GHC GitLab CI at 2020-11-24T12:06:39-05:00
rts: Fix race in GC CPU time accounting

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

- - - - -
fe2f4f8e by Ben Gamari at 2020-11-24T12:06:39-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`).

- - - - -
b3094027 by Ben Gamari at 2020-11-24T12:06:39-05:00
rts: Use relaxed ordering on spinlock counters

- - - - -
8ed2b04b by Ben Gamari at 2020-11-24T12:06:39-05:00
rts: Annotate hopefully "benign" races in freeGroup

- - - - -
03c0358e by Ben Gamari at 2020-11-24T12:06:39-05:00
Strengthen ordering in releaseGCThreads

- - - - -
859ae214 by Ben Gamari at 2020-11-24T12:06:39-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.

- - - - -
d9b2e381 by Ben Gamari at 2020-11-24T12:06:39-05:00
rts: Use relaxed atomics for whitehole spin stats

- - - - -
43e44655 by Ben Gamari at 2020-11-24T12:06:39-05:00
rts: Avoid lock order inversion during fork

Fixes #17275.

- - - - -
90ed4082 by GHC GitLab CI at 2020-11-24T12:06:40-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.

- - - - -
e355d4ab by Ben Gamari at 2020-11-24T12:06:40-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.

- - - - -
190fc07d by Ben Gamari at 2020-11-24T12:06:40-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.

- - - - -
ca323a84 by Ben Gamari at 2020-11-24T12:06:40-05:00
Mitigate data races in event manager startup/shutdown

- - - - -
111a1dc0 by Ben Gamari at 2020-11-24T12:06:40-05:00
Suppress data race due to close

This suppresses the other side of a race during shutdown.

- - - - -
d2067aed by Ben Gamari at 2020-11-24T12:06:40-05:00
rts: Accept benign races in Proftimer

- - - - -
8082c3e8 by Ben Gamari at 2020-11-24T12:06:40-05:00
rts: Pause timer while changing capability count

This avoids #17289.

- - - - -
533ac721 by Ben Gamari at 2020-11-24T12:06:40-05:00
Fix #17289

- - - - -
0c90b600 by Ben Gamari at 2020-11-24T12:06:40-05:00
suppress #17289 (ticker) race

- - - - -
952b9069 by Ben Gamari at 2020-11-24T12:06:40-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.

- - - - -
c7979d7e by Ben Gamari at 2020-11-24T12:06:40-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.

- - - - -
220bb050 by Ben Gamari at 2020-11-24T12:06:40-05:00
rts/Stats: Hide a few unused unnecessarily global functions

- - - - -
7b7d68bb by Ben Gamari at 2020-11-24T12:06:40-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.

- - - - -
0b4a532a by Ben Gamari at 2020-11-24T12:06:40-05:00
rts: Tear down stats_mutex after exitHeapProfiling

Since the latter wants to call getRTSStats.

- - - - -


30 changed files:

- .gitlab-ci.yml
- aclocal.m4
- compiler/deSugar/DsForeign.hs
- compiler/ghci/Linker.hs
- compiler/main/DriverPipeline.hs
- compiler/main/DynFlags.hs
- compiler/main/Settings.hs
- compiler/main/SysTools.hs
- compiler/main/SysTools/Settings.hs
- compiler/main/SysTools/Tasks.hs
- compiler/main/ToolSettings.hs
- compiler/nativeGen/X86/CodeGen.hs
- compiler/nativeGen/X86/Cond.hs
- compiler/nativeGen/X86/Instr.hs
- compiler/typecheck/TcSigs.hs
- configure.ac
- docs/users_guide/8.10.2-notes.rst
- docs/users_guide/phases.rst
- hadrian/cfg/system.config.in
- hadrian/hadrian.cabal
- hadrian/src/Flavour.hs
- hadrian/src/Oracles/Setting.hs
- hadrian/src/Rules/Generate.hs
- hadrian/src/Settings.hs
- + hadrian/src/Settings/Flavours/ThreadSanitizer.hs
- includes/Rts.h
- includes/ghc.mk
- + includes/rts/ForeignExports.h
- includes/rts/OSThreads.h
- includes/rts/SpinLock.h


The diff was not included because it is too large.


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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f619ea8faae670bd2afb5545ad8b4a004eced3c7...0b4a532a1ce8a02afa5f9eb3672ca86f0ea36c6f
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/6972f3aa/attachment-0001.html>


More information about the ghc-commits mailing list