This is an archive of the discontinued LLVM Phabricator instance.

tsan: implement suppressions for top frame only
ClosedPublic

Authored by dvyukov on Jun 24 2015, 5:34 AM.

Details

Summary

The new suppression type is called "race_top" and is matched only against top frame in report stacks.
This is required for situations when we want to suppress a race in a "thread pool" or "event loop" implementation.
If we simply use "race:ThreadPool::Execute" suppression, that can suppress everything in the program.

Diff Detail

Event Timeline

dvyukov updated this revision to Diff 28334.Jun 24 2015, 5:34 AM
dvyukov retitled this revision from to tsan: implement suppressions for top frame only.
dvyukov updated this object.
dvyukov edited the test plan for this revision. (Show Details)
dvyukov added a reviewer: glider.
dvyukov added subscribers: Unknown Object (MLST), kcc, samsonov, eugenis.
glider edited edge metadata.Jun 24 2015, 5:46 AM

General question: you're creating a TSan-specific suppression type that matches the topmost frame.
Don't you think other tools may require such functionality as well?

I don't know. Everything is possible.

glider accepted this revision.Jun 24 2015, 7:17 AM
glider edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jun 24 2015, 7:17 AM

Adding other folks for the case they have ideas about the _top suffix.

samsonov added inline comments.Jun 24 2015, 11:29 AM
lib/tsan/rtl/tsan_suppressions.cc
118–119

you can totally factor this out to

bool IsSuppressed(const AddressInfo &info, const char *suppression_type, Suppression **sp);
124
stack->frames != nullptr
test/tsan/race_top_suppression.cc.supp
1 ↗(On Diff #28334)

I'd prefer to get rid of extra file, and create it with "echo" command in the RUN-line.

test/tsan/race_top_suppression1.cc.supp
1 ↗(On Diff #28334)

Ditto

Alexey, wdyt about this functionality in general? Shall we limit it to TSan?

sent from phone

samsonov edited edge metadata.Jun 24 2015, 2:34 PM

I see no reasonable way to make this non-limited to TSan, given how generic our suppression machinery is.

dvyukov updated this revision to Diff 28450.Jun 25 2015, 4:59 AM
dvyukov edited edge metadata.

addressed comments

ptal

lib/tsan/rtl/tsan_suppressions.cc
118–119

done

124

done

test/tsan/race_top_suppression.cc.supp
1 ↗(On Diff #28334)

done

samsonov accepted this revision.Jun 25 2015, 12:05 PM
samsonov edited edge metadata.

LGTM

lib/tsan/rtl/tsan_suppressions.cc
98

make this function static?

dvyukov added inline comments.Jun 29 2015, 7:20 AM
lib/tsan/rtl/tsan_suppressions.cc
98

done

dvyukov closed this revision.Jun 29 2015, 7:38 AM

Submitted in 240949