This is an archive of the discontinued LLVM Phabricator instance.

[profile] Don't crash when forking in several threads
ClosedPublic

Authored by calixte on Apr 20 2020, 2:02 AM.

Details

Summary

When forking in several threads, the counters were written out in using the same global static variables (see GCDAProfiling.c): that leads to crashes.
So when there is a fork, the counters are resetted in the child process and they will be dumped at exit using the interprocess file locking.
When there is an exec, the counters are written out and in case of failures they're resetted.

Diff Detail

Event Timeline

calixte created this revision.Apr 20 2020, 2:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2020, 2:02 AM
Herald added subscribers: Restricted Project, dexonsmith, hiraditya. · View Herald Transcript
calixte updated this revision to Diff 258686.Apr 20 2020, 2:28 AM

Export symbol for Darwin target

Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2020, 2:28 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
marco-c accepted this revision.Apr 20 2020, 3:28 AM
This revision is now accepted and ready to land.Apr 20 2020, 3:28 AM
dmajor added a subscriber: dmajor.Apr 20 2020, 7:05 AM
serge-sans-paille added inline comments.
llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
697

I'm puzzled by this test. `F is a CallInst, so not a terminator, so how can NextInst` be past the Terminator?

1263

[nit] could be if (RetTy->isVoidTy())

calixte updated this revision to Diff 259854.Apr 24 2020, 3:48 AM

Fix nits.

calixte marked 2 inline comments as done.Apr 24 2020, 3:49 AM
serge-sans-paille accepted this revision.May 7 2020, 4:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 7 2020, 4:47 AM
This revision was automatically updated to reflect the committed changes.
rovka added a subscriber: rovka.Jun 4 2020, 10:48 AM

Hi! I think this commit is causing some instability on the 10.0.1 branch on 32-bit arm: https://bugs.llvm.org/show_bug.cgi?id=46092
Can you have a look?