-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor the instruction tracing subsystem. #168
Open
qwattash
wants to merge
74
commits into
dev
Choose a base branch
from
qemu-experimental-tracing
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,969
−796
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qwattash
commented
Sep 29, 2021
arichardson
reviewed
Sep 29, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This generally looks fine to me (only skimmed most of the commits though). Since it's off by default it shouldn't really matter that we pull in boost.
qwattash
force-pushed
the
qemu-experimental-tracing
branch
from
November 3, 2021 16:13
8ef7b2b
to
b06b88a
Compare
qwattash
force-pushed
the
qemu-experimental-tracing
branch
from
December 9, 2021 14:42
00b74e6
to
19e1f98
Compare
qwattash
force-pushed
the
qemu-experimental-tracing
branch
from
December 20, 2021 14:35
e3bd115
to
a35dccb
Compare
qwattash
force-pushed
the
qemu-experimental-tracing
branch
from
February 2, 2022 00:52
d9b1577
to
ed8809f
Compare
qwattash
force-pushed
the
qemu-experimental-tracing
branch
2 times, most recently
from
April 26, 2022 19:43
b0cd6a4
to
9b1e0ee
Compare
qwattash
force-pushed
the
qemu-experimental-tracing
branch
from
July 12, 2022 12:18
9b1e0ee
to
f478ec9
Compare
qwattash
force-pushed
the
qemu-experimental-tracing
branch
2 times, most recently
from
August 18, 2022 14:21
7bd5a53
to
f7417a1
Compare
- Rename cpu_log_instr_info to cpu_log_entry.
The -dfilter qemu option has ad-hoc support within TCG instruction tracing, this generalizes the trace filtering to an arbitrary per-CPU set of functions that can filter the trace entry based on any parameter. Note that for now filters are assumed to be stateless.
Each trace format is moved to a separate file for implementation.
This backend is intended to capture statistics from the instructions instead of dumping the whole instruction stream. Note that this is disabled by default in the configuration as it adds a dependency on libboost.
- Add cheri-perfetto submodule for tracing. - Plumb the perfetto tracing backend in the build system - Add initialization code that registers the tracing categories and starts the tracing service at startup - Add skeleton for the perfetto tracing backend glue code
- Add command line option to select filters to use. - Make sure that the filters from command line are applied to the CPUs at initialization. - Add filter to only emit entries containing events.
For each CPU we create 2 tracks: one for control events (e.g. tracing start/stop) and another for log events on that CPU. Currently we emit instructions and stats events on the CPU track. - Replace the stats backend with a tracing category in the perfetto backend - Add new CLI options to control the perfetto backend behaviour: 1. --cheri-trace-perfetto-categories comma-separated list of categories to enable. 2. --cheri-trace-perfetto-logfile log file to use for the perfetto binary trace. We do not use the common qemu logfile to avoid accidental pollution and passing the qemu file descriptor is painful due to having to lock the logfile via RCU. - Add hook at qemu shutdown to make sure we flush the log buffers, if the tracing backend supports this.
Flush TrackEvent data source when we receive a FLUSH event in the instruction logging subsystem. This helps making sure that we do not have lost events when running multiple tests on qemu.
Remove the event variant that bypasses log enable. This is useless as switching on/off tracing around the event is feasible and the event is rare enough that it is not a performance issue.
Add NOP that guests can use to create and increment/decrement counters. The counters are emitted into the perfetto trace stream as normal perfetto counter tracks.
These are still not hooked to the guest NOPs.
Replace the stats implementation with a new one based on the cheri-perfetto interval tracks. The stats implementation tracks basic block icount and hits, along with branches. Now there are multiple categories for each different statistic instead of a grouped one.
This works around the inability to use bytes fields in perfetto track event messages.
This was essentially unused, and can be replicated during initialization.
Add two counters to measure instruction count when tracing is enabled/disabled.
Only maintain the branch and basic block hit histograms when the corresponding trace categories are enabled.
This should not be needed because we have flags marking TBs whenever they contain instruction tracing instrumentation.
This is broken by recent liburing versions.
qwattash
force-pushed
the
qemu-experimental-tracing
branch
from
March 31, 2023 16:02
f7417a1
to
fb7607b
Compare
Add disas_one_strbuf() to disassemble one instruction to an existing string buffer. Add disas_one_str() to disassemble one instruction to a dynamically allocated string.
- Conditionally compile cvtrace - This is done because some of these backends emit binary data that is logically incompatible with the standard qemu output file. The downside is the we need to handle our own locking if we want to support multiple CPUs.
This should help to inform log backends for management purposes.
This is better than instr_info as it reflects its use.
qwattash
force-pushed
the
qemu-experimental-tracing
branch
from
March 31, 2023 20:02
fb7607b
to
d83469d
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add tracing backend based on the google perfetto tracing framework.
Add the ability to aggregate statistics within qemu and emit them as part of the perfetto backend.
Add support for generic events associated to instructions.
Add better support for trace filters for each log entry.