commit | f5ad4645424deecdb069caac090f712e35a9ef96 | [log] [tgz] |
---|---|---|
author | Sami Kyostila <skyostil@google.com> | Thu May 16 10:46:15 2019 +0100 |
committer | Sami Kyostila <skyostil@google.com> | Thu May 16 10:46:15 2019 +0100 |
tree | 39f8a7b68a33becdaa7bd7c45ef742f0f4271469 | |
parent | a47facdd75f95c30d421beebe7421591e7935bca [diff] |
Annotate a benign data race in TraceBuffer If the producer changes data in the shared memory buffer while we are copying it to the central trace buffer, TSAN will (rightfully) flag this as a data race. However the alternative would be trying to validate the data before copying, but this is much more risky since it can change at any time. Instead, we ignore this benign race and perform validation offline. Disregarding malicious clients, the only case where this issue arises is when we try to scrape chunks from a client which is still actively writing to the SHM buffer. The data race is not an issue here either, because the producer will first atomically increment the number of chunks in the buffer and then write the chunk header and payload. This means that if we observe N chunks in the buffer, we can always safely read N-1 chunks, i.e., everything that was committed before the counter was incremented. This is what the scraping logic already does. Bug: 132595466 Change-Id: Ic572e5fd0a0d1923f65b221fac95760484806c08
Perfetto is an open-source project for performance instrumentation and tracing of Linux/Android/Chrome platforms and user-space apps.
See www.perfetto.dev for docs.