commit | 4167d1bb4b7965b13b3453ec7c45fc5117428d9c | [log] [tgz] |
---|---|---|
author | Ryan Savitski <rsavitski@google.com> | Thu Apr 18 13:25:26 2019 +0100 |
committer | Ryan Savitski <rsavitski@google.com> | Thu Apr 18 13:25:26 2019 +0100 |
tree | 7b807d0c20d97484e0a2d550659c8273b3b3e811 | |
parent | f950764a4c1cdb1452615dcdd45d74d122895218 [diff] |
heapprofd_client: SIGABRT on timed out spinlock instead of indefinite spin As discussed, we want to interfere with the host process where possible, but this is a "should never happen" situation where it's better to get a clear indication of an issue. I'm not changing the interface of ScopedSpinlock in this cl, but acknowledging that it: * doesn't have a way to configure the timeout (atm ~10ms in the absence of spurious wakeups from usleep). * makes it easy to forget the failed-to-acquire case. The host process can still try to handle SIGABRT (for example toybox/top does this to restore terminal state), and if that results in a "normal" exit, we won't get a tombstone. But that isn't a scenario worth handling specially. Code structure notes: * headers reordered by clang-format, imo let's just submit this version and stop manually fixing up the formatter. * abort() over PERFETTO_FATAL as it tries harder to actually exit the process (while our macro simply sends a one-off SIGTRAP). * could restructure the code to return the lock from a function that handles the timeout inline, but the explicit mention of the possibility of aborting at the call site seemed reasonable. Change-Id: I86d18c3e625601a48236a2a43916afe0933605a6
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.