[PATCH] D54889: Fiber support for thread sanitizer

Yuri Per via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 27 05:51:32 PST 2018


yuri added a comment.

In D54889#1309475 <https://reviews.llvm.org/D54889#1309475>, @dvyukov wrote:

> > I'd like to make sure that the work can be re-used to implement proper understanding of Darwin GCD queues.
>
> What kind of API is required for GCD queues?
>  A while ago I sketched something for tasking support:
>  https://codereview.appspot.com/6904068/diff/6001/rtl/tsan_interface_task.h
>  It would be nice to have tasking support too (nobody programs in threads today), but I don't yet know how close this fibers support to tasking support.


Proposed fiber API is well suitable for GCD tasks:

1. When task in concurrent queue is created, call __tsan_create_fiber() and wrap task with custom task callback
2. When callback gets called:
  - Call __tsan_get_current_fiber() and save the result
  - Call __tsan_switch_to_fiber() for fiber created on first step
  - Execute actual task
  - Call __tsan_switch_to_fiber() with saved fiber
  - Call __tsan_destroy_fiber()

I will add test that covers such scenario


Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54889/new/

https://reviews.llvm.org/D54889





More information about the llvm-commits mailing list