[kernel] Count number of spinlocks held

Adds a percpu counter for how many spinlocks are held. This counter is
asserted against during a reschedule to ensure that no spinlocks, aside
from the thread_lock, are held across a thread switch.

For x86 the percpu struct is retrieved and then used for retrieving
both the cpu_num and manipulating num_spinlocks. This is faster than
performing all operations indirectly through gs. For arm there was no
benefit measured from locally caching the percpu pointer and so the
generic READ+WRITE wrappers are used.

The in kernel micro benchmarks (k bench) shows the cycles to perform a
spinlock acquire+release changes slightly:
NUC 47 -> 48
VIM2 41 -> 46

To measure whether there is any noticable performance degredation the
two zircon micro benchmark suites (zircon/perftest,
garnet/zircon_benchmarks) were run on the vim2 and nuc. All tests were
run 5 times with reboots in between and compared with the perfcompare
tool, which found no significant differences.

ZX-147 #comment

Change-Id: I40f15bf3dbe4e4e4219e8a461507369a0092fd7c
8 files changed
tree: 96dd24164544017e103fecf41a066341ae4a5918
  1. boards/
  2. build/
  3. buildtools/
  4. bundles/
  5. docs/
  6. examples/
  7. garnet/
  8. infra/
  9. peridot/
  10. products/
  11. scripts/
  12. sdk/
  13. src/
  14. third_party/
  15. tools/
  16. zircon/
  17. .clang-format
  18. .clang-tidy
  19. .dir-locals.el
  20. .gitattributes
  21. .gitignore
  22. .gn
  23. AUTHORS
  24. BUILD.gn
  25. CODE_OF_CONDUCT.md
  26. CONTRIBUTING.md
  27. LICENSE
  28. OWNERS
  29. PATENTS
  30. README.md
  31. rustfmt.toml
README.md

Fuchsia

Pink + Purple == Fuchsia (a new operating system)

What is Fuchsia?

Fuchsia is a modular, capability-based operating system. Fuchsia runs on modern 64-bit Intel and ARM processors.

Fuchsia is an open source project with a code of conduct that we expect everyone who interacts with the project to respect.

How can I build and run Fuchsia?

See Getting Started.

Where can I learn more about Fuchsia?

See the documentation.