Skip to content
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
wants to merge 74 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
d1a2044
Refactor instruction tracing to support events.
qwattash Jun 7, 2021
aca9967
Refactor instruction logging: rename trace_format to trace_backend.
qwattash Jun 7, 2021
de64762
Implement an event queue for each instruction entry logged.
qwattash Jul 15, 2021
89ece23
Generalize instruction trace filtering.
qwattash Jul 15, 2021
1645382
Refactor TCG log instruction backend into multiple files.
qwattash Jul 15, 2021
a5ab240
Actually emit events.
qwattash Jul 19, 2021
05fb03a
Rename TCG instruction logging backend macros.
qwattash Jul 17, 2021
ce35201
Add magic NOP to log context switch events.
qwattash Jul 19, 2021
d8b6486
Add stats TCG instruction logging backend.
qwattash Jul 17, 2021
edc0a74
Add initialization and setup code for the perfetto tracing backend.
qwattash Feb 27, 2021
c88434e
Fix stats logging backend output.
qwattash Aug 9, 2021
b809581
Improve instruction trace filters support.
qwattash Aug 13, 2021
2ed217d
Refactor trace stats helper into a class.
qwattash Sep 7, 2021
cd44395
Fix broken legacy CVTrace backend.
qwattash Sep 8, 2021
a31419e
Implement a tracing backend based on the perfetto tracing framework.
qwattash Sep 7, 2021
5b961f1
Fix flushing in instruction logging perfetto backend.
qwattash Sep 22, 2021
70952ba
Disable the perfetto tracing backend by default.
qwattash Sep 30, 2021
061f755
Fix tracking of the current basic-block in perfetto trace stats.
qwattash Oct 4, 2021
c532165
Modify meaning of the basic-block hit histogram tracing statistic
qwattash Oct 8, 2021
466347f
Fix use of icount in BB histogram
qwattash Oct 13, 2021
bae544d
Properly propagate the PC for tracing START/STOP events.
qwattash Oct 14, 2021
0ad2c2e
Implement guest-driven context tracking for the perfetto log backend.
qwattash Oct 7, 2021
c3dafaa
Add TODO for better tracing context switches in perfetto backend.
qwattash Oct 20, 2021
7562002
Fix instruction logging backend context tracing.
qwattash Oct 30, 2021
472de43
Fix inline function prototype to silence warnings.
qwattash Nov 2, 2021
9d0bd2c
Update user logging to match the use of QEMU_LOG_INSTR_U.
qwattash Nov 2, 2021
f7616d6
Handle unlikely case for qemu perfetto stats recording.
qwattash Nov 3, 2021
4db5337
Refactor the way instruction logging statistics are handled.
qwattash Nov 8, 2021
ac02845
Fix support for the instruction logging EVENT_CTX_UPDATE.
qwattash Nov 11, 2021
2e9ba94
Fix handling of context update events in text instruction logging bac…
qwattash Nov 18, 2021
505b409
Minor format and comment fix in instruction logging implemenation.
qwattash Nov 19, 2021
92dd428
Fix building of ARM target with refactored instruction trace backends.
qwattash Nov 19, 2021
5634234
Properly handle perfetto logging backend dependency resolution.
qwattash Nov 19, 2021
15df810
Add missing dependency for perfetto tracing backend.
qwattash Nov 20, 2021
6947330
Pass instruction logging code through clang-format.
qwattash Nov 20, 2021
97b7227
Update perfetto instruction logging to match cheri-perfetto histogram…
qwattash Nov 30, 2021
4f38006
Comply with CHERI-architecture reserved RISC-V opcodes for tracing.
qwattash Nov 30, 2021
d11345a
Introduce support for guest-defined trace markers.
qwattash Dec 9, 2021
ae92b69
Add instruction logging backend that emits a protobuf stream.
qwattash Dec 18, 2021
5d94acb
Add experimental instruction logging backend that generates JSON data.
qwattash Dec 22, 2021
3f712cd
Fix build without the cheri-perfetto submodule.
qwattash Dec 23, 2021
2f39215
Update CHERI perfetto interface.
qwattash Jan 19, 2022
81e840d
Use perfetto protobuf definition for the protobuf backend.
qwattash Feb 1, 2022
c012403
Implement log event to dump register contents to trace.
qwattash Feb 1, 2022
03f34ab
Fix allocation of temporary argument to do_cpu_loglevel_switch.
qwattash Feb 2, 2022
21334c1
Remove log event variant that bypasses log enable.
qwattash Feb 18, 2022
47348d2
Implement register dumps for protobuf instruction tracing backend.
qwattash Feb 25, 2022
49abdf2
Retire instruction logging event type for context updates.
qwattash Feb 25, 2022
7dcf684
Implement RISC-V tracing counter NOPs.
qwattash Apr 26, 2022
692ea29
Add per-context counters.
qwattash Jul 12, 2022
ec20ea4
Point cheri-perfetto submodule to the correct repository.
qwattash Jul 12, 2022
1cdf7bc
Introduce interval tracks support in the perfetto tracing backend.
qwattash Jul 12, 2022
719e787
Fix instruction opcode dumping to the perfetto message format.
qwattash Jul 13, 2022
2d86daf
Fix cheri-perfetto new remote URL.
qwattash Jul 13, 2022
5e5a6da
Add option to select output file for the protobuf tracing backend.
qwattash Jul 14, 2022
674fc6e
Unbreak -icount mode for RISC-V.
qwattash Jul 28, 2022
7576074
Add an experimental interceptor in perfetto to trace memory load and …
Jul 18, 2022
7fb7bfa
add gzip compression for interceptor output file
Jul 29, 2022
746fca3
Point dynamrio submodule to CHERI fork
Aug 10, 2022
1ea363c
Drop the instruction tracing backend emit_header hook.
qwattash Jul 28, 2022
8c80e97
Improve perfetto trace session configuration.
qwattash Jul 30, 2022
385939d
Introduce support for logging qemu debugging counters with perfetto.
qwattash Jul 30, 2022
6a44e1d
Disable branch and basic block tracking when unnecessary.
qwattash Jul 30, 2022
9660d3b
Disable tb_flush when switching log level.
qwattash Aug 18, 2022
717464c
Fix io_uring_prep_poll_remove call.
qwattash Feb 1, 2023
82b638f
Always use a fixed number of entries in the trace backends list.
qwattash Mar 31, 2023
6a9bbaa
Update disasm helpers to emit single instructions as strings.
qwattash Mar 31, 2023
e952789
Use disas_one_str in protobuf backend.
qwattash Mar 31, 2023
b1ba45d
Add explicit file parameter to non-text tracing backends.
qwattash Mar 31, 2023
a2ac590
Cleanup signatures in instruction logging infrastructure.
qwattash Mar 31, 2023
659bcc5
Add the current log level transition in the log state transition event.
qwattash Mar 31, 2023
9ae03c6
Rename per-CPU instruction logging buffer to entry_buffer.
qwattash Mar 31, 2023
1d91718
Remove perfetto debug counters.
qwattash Mar 31, 2023
d83469d
Restore entry buffer size var.
qwattash Mar 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,10 @@
[submodule "roms/vbootrom"]
path = roms/vbootrom
url = https://git.qemu.org/git/vbootrom.git
[submodule "trace/cheri-perfetto"]
path = trace_extra/cheri-perfetto
url = https://github.com/CTSRD-CHERI/cheri-perfetto.git
branch = cheri-perfetto
[submodule "trace_extra/dynamorio"]
path = trace_extra/dynamorio
url = https://github.com/CTSRD-CHERI/dynamorio.git
3 changes: 3 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ selectedConfigs.each { config ->
if (isDebug) {
extraQemuArgs = '--qemu/configure-options=--enable-rvfi-dii --qemu/build-type=Debug --qemu/use-asan'
}
if (os == "linux") {
extraQemuArgs += ' --qemu/configure-options=--enable-perfetto-log-instr'
}
def qemuResult = cheribuildProject(target: 'qemu', cpu: 'native', skipArtifacts: true,
nodeLabel: null,
extraArgs: "--without-sdk --install-prefix=/usr $extraQemuArgs",
Expand Down
2 changes: 2 additions & 0 deletions accel/tcg/cpu-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "exec/tb-hash.h"
#include "exec/tb-lookup.h"
#include "exec/log.h"
#include "exec/log_instr.h"
#include "qemu/main-loop.h"
#if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY)
#include "hw/i386/apic.h"
Expand Down Expand Up @@ -703,6 +704,7 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb,
#ifndef CONFIG_USER_ONLY
/* Ensure global icount has gone forward */
icount_update(cpu);

/* Refill decrementer and continue execution. */
insns_left = MIN(0xffff, cpu->icount_budget);
cpu_neg(cpu)->icount_decr.u16.low = insns_left;
Expand Down
Loading