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
2 files changed
tree: 7b807d0c20d97484e0a2d550659c8273b3b3e811
  1. build_overrides/
  2. buildtools/
  3. debian/
  4. docs/
  5. gn/
  6. include/
  7. infra/
  8. protos/
  9. src/
  10. test/
  11. tools/
  12. ui/
  13. .clang-format
  14. .gitignore
  15. .gn
  16. .travis.yml
  17. Android.bp
  18. Android.bp.extras
  19. BUILD
  20. BUILD.extras
  21. BUILD.gn
  22. codereview.settings
  23. heapprofd.rc
  24. MODULE_LICENSE_APACHE2
  25. NOTICE
  26. OWNERS
  27. perfetto.rc
  28. PRESUBMIT.py
  29. README.chromium
  30. README.md
  31. TEST_MAPPING
README.md

Perfetto - Performance instrumentation and tracing

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.

Bugs

  • For bugs affecting Android or the tracing internals use the internal bug tracker (go/perfetto-bugs).
  • For bugs affecting Chrome use http://crbug.com, Component:Speed>Tracing label:Perfetto.