rts: Disable -hb with multiple capabilities
authorBen Gamari <bgamari.foss@gmail.com>
Mon, 12 Sep 2016 12:44:24 +0000 (08:44 -0400)
committerBen Gamari <ben@smart-cactus.org>
Mon, 12 Sep 2016 16:15:28 +0000 (12:15 -0400)
Biographical profiling is not thread-safe as documented in #12019. Throw
an error when it is used in this way.

Test Plan: Validate

Reviewers: simonmar, austin, erikd

Reviewed By: erikd

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2516

GHC Trac Issues: #12019

rts/ProfHeap.c

index 956a250..c94b3e9 100644 (file)
@@ -400,6 +400,13 @@ initHeapProfiling(void)
         errorBelch("cannot mix -hb and -hr");
         stg_exit(EXIT_FAILURE);
     }
+#ifdef THREADED_RTS
+    // See Trac #12019.
+    if (doingLDVProfiling() && RtsFlags.ParFlags.nCapabilities > 1) {
+        errorBelch("-hb cannot be used with multiple capabilities");
+        stg_exit(EXIT_FAILURE);
+    }
+#endif
 #endif
 
     // we only count eras if we're doing LDV profiling.  Otherwise era