[roll] Roll fuchsia [kernel] Template KTrace on BufferMode

This CL effectively adds a compile-time feature-flag, behind which
we can start landing code to support per-CPU buffers in KTrace.
Concretely, this change templates the KTrace class on a new
BufferMode enum, which currently defaults to BufferMode::kSingle,
which corresponds to the single-buffer mode that exists today.

The naive approach of just templating the existing KTrace singleton
on the new enum would unfortunately require propagating the template
parameter (or just <> in the case of a default) to all callsites,
including all macros. To avoid what is effectively a large find and
replace across a bunch of files, this CL instead renames the KTrace
class to KTraceImpl and templates that class instead. KTrace is
then declared as an alias to KTraceImpl<BufferMode::kSingle>, thus
preserving existing behavior.

Making KTraceImpl templated on BufferMode made defining the static
instance in ktrace.cc a bit challenging, so it's been moved into
ktrace.h as a static inline variable. This should have no functional
effect, and removes the need for an out-of-line templated
initialization (which I couldn't get to work).

All existing KTrace methods were then modified to be template
specializations for the BufferMode::kSingle template argument. As
part of this, all method definitions that were previously in the
header (Init, ReadUser, Reserve) have been moved to the cpp file.
I could put the specialization in the header, but it seemed a bit
cleaner to do in the cpp file.

Note: This CL does not implement any of the per-CPU code; those
template specializations will come in a follow-up CL.

Finally, this CL performs a small refactor of the Control and Start
method, and adds helpers for the Stop and Rewind methods. This
refactor will make it simpler to implement their specializations
for the per-CPU case.

All of this templating will be removed and deleted once per-CPU
buffering is enabled by default.

Original-Bug: 404539312
Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1244924
Original-Revision: 073730dc0bd1e463dc83f2e7967a290d41c26263
GitOrigin-RevId: 618ff2796709a7a35b409f7205bc30af1639abd8
Change-Id: I8d87837ef32279f666cce5888de8ec38c0aa051f
1 file changed
tree: a68f52ecef39a15da642e6eaf3a07291adff96c7
  1. ctf/
  2. git-hooks/
  3. infra/
  4. third_party/
  5. cts
  6. firmware
  7. flower
  8. jiri.lock
  9. MILESTONE
  10. minimal
  11. prebuilts
  12. README.md
  13. stem
  14. test_durations
  15. toolchain
README.md

Integration

This repository contains Fuchsia's Global Integration manifest files.

Making changes

All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.

Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance in one of the communication channels documented at get involved.

Obtaining the source

First install Jiri.

Next run:

$ jiri init
$ jiri import minimal https://fuchsia.googlesource.com/integration
$ jiri update

Third party

Third party projects should have their own subdirectory in ./third_party.