Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,242
    • Issues 5,242
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 568
    • Merge requests 568
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Merge requests
  • !9372

Various memory ordering fixes

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Ben Gamari requested to merge wip/tsan/fixes into master Nov 20, 2022
  • Overview 10
  • Commits 34
  • Pipelines 11
  • Changes 77

This is a follow-up to !6232 (closed), fixing the issues identified by TSAN:

  • Drop (nearly) all memory barriers from hand-written Cmm in favour of ordered loads and stored (or, in a few places, explicitly-ordered fences)
  • Elaborate on Note [Heap memory barriers], which now contains a much more convincing soundness story
  • Fix a few issues in ghc itself where IORefs are incorrectly used with an expectation of thread-safety
  • Encapsulate various bits of RTS mutable global state (n_capabilities, sched_state, recent_activity) and access them only through accessors which use the necessary atomic operations
  • Fix a data race in readTVarIO#
  • Fix a data race in makeStableName#
  • Move to a statically-allocated Capabilities array to avoid a rather tricky data race between the timer (which may be implemented by way of a signal) and setNumCapabilities (which previously reallocated the global capabilities array)

This is based on !6232 (closed).

Edited Nov 22, 2022 by Ben Gamari
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: wip/tsan/fixes