On Fri, Oct 27, 2017 at 6:49 PM, Andrea Parri <
parri....@gmail.com> wrote:
> Hi Dmitry,
>
> I've been reading KTSan documentation I could find online, starting from
>
>
https://github.com/google/ktsan/blob/tsan/Documentation/ktsan.txt
>
> I could not find a satisfactory description of the notion of "data race". (?)
>
> What's the (underlying) memory model?
>
> Could you provide me with a list of references?
>
> Looking forward to know more about KTSan,
>
> Andrea
>
> P. S. Speaking of memory models: The reference "Linux-Kernel Memory Model" in
>
>
https://github.com/google/ktsan/wiki/READ_ONCE-and-WRITE_ONCE
>
> has been updated:
>
>
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0124r4.html
>
> The model has now its own repository (with further documentation):
>
>
https://github.com/aparri/memory-model
+Paul, Andrey and ktsan mailing list
Hi Andrea,
We use the definition of data race provided by C/C++ standards.
We did a reasonable mapping of kernel synchronization primitives onto
C/C++ primitives. E.g. smp_load_acquire/smp_store_release are
translated into atomic_load(acquire)/store(release); rmb/wmb are
translated into atomic_thread_fence(acquire/release), etc. We also did
some creative mapping of rcu/seqlocks/percpu primitives, e.g. call_rcu
happens-before invocation of the callback, etc. In some cases the
mapping may be overly strong, but initially we aimed at just being
close enough without false positives.
The definitions can be changing, but I think the main idea is still
there: synchronization primitives establish HB according to some
rules; and race is unordered by HB accesses. And that's what tsan
"engine" does. Exact rules for synchronization primitives can be
easily altered later.
Hope this helps
Thanks