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

i#5505 kernel tracing: Add syscall instr encodings #6479

Merged
merged 17 commits into from
Dec 1, 2023

Conversation

abhinav92003
Copy link
Contributor

@abhinav92003 abhinav92003 commented Nov 28, 2023

Adds encodings for kernel system call instructions to the trace in raw2trace. Kernel system call traces are decoded using libipt which also provides the instruction encodings. We add support to drir_t to write these encodings to a new buffer which is re-used for all dynamic instances of that instr even across multiple system call traces.

Fixes taken/not-taken detection for conditional branches in the syscall trace.

Adds support in the syscall_mix tool to report the counts of each system call's traces also. Adds sysnum to system call trace start and end markers to achieve this.

Ran all Intel-PT tests locally:

$ ctest -VV -R 'SUDO'
...
The following tests passed:
	code_api|client.drpttracer_SUDO-test
	code_api|tool.drcachesim.phys_SUDO # not really PT. Just included because of ctest -R.
	code_api|tool.drcachesim.phys-threads_SUDO # not really PT. Just included because of ctest -R.
	code_api|tool.drcacheoff.phys_SUDO # not really PT. Just included because of ctest -R.
	code_api|tool.drcacheoff.kernel.simple_SUDO
	code_api|tool.drcacheoff.kernel.opcode-mix_SUDO
	code_api|tool.drcacheoff.kernel.syscall-mix_SUDO

100% tests passed, 0 tests failed out of 7

Found some flakiness due to #6486 in local runs of the kernel sudo tests, which will be addressed separately.

Issue: #5505

Adds encodings for kernel system call instructions to the trace in raw2trace.
Kernel system call traces are decoded using libipt which also provides the
instruction encodings. We write these encodings to a new buffer which is re-used
for all dynamic instances of that instr.

Adds a new drcachesim option to ignore failures in decoding instructions. This
is currently required because the kernel traces have opcodes that are not yet
recognized. Such decode failures are not critical because their impact is
limited (not counting unsupported instrs in the opcode_mix tool, or not showing
unsupported instrs in the view tool) unlike user-space instrs where missing
decoder support may lead to drreg issues etc. Uses the new option in opcode_mix
and the view tool.

Adds support in the syscall_mix tool to report the counts of each system call's
trace also.

Issue: #5505
@abhinav92003 abhinav92003 marked this pull request as ready for review November 28, 2023 22:03
Copy link
Contributor

@derekbruening derekbruening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this new option: seems we should just update the decoder. Also confused about the need for 3rd copy of the encodings.

clients/drcachesim/common/options.cpp Outdated Show resolved Hide resolved
clients/drcachesim/tools/opcode_mix.cpp Outdated Show resolved Hide resolved
clients/drcachesim/tools/opcode_mix.cpp Outdated Show resolved Hide resolved
clients/drcachesim/tools/opcode_mix.cpp Outdated Show resolved Hide resolved
clients/drcachesim/tracer/raw2trace.cpp Outdated Show resolved Hide resolved
clients/drcachesim/common/options.cpp Outdated Show resolved Hide resolved
clients/drcachesim/tracer/raw2trace.cpp Show resolved Hide resolved
clients/drcachesim/tracer/raw2trace.cpp Show resolved Hide resolved
clients/drcachesim/tracer/raw2trace.cpp Show resolved Hide resolved
clients/drcachesim/drpt2trace/drir.h Show resolved Hide resolved
clients/drcachesim/drpt2trace/drir.h Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/ir2trace.cpp Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/ir2trace.h Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.cpp Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.cpp Outdated Show resolved Hide resolved
@abhinav92003
Copy link
Contributor Author

x86-32 failures are #6417.

@abhinav92003 abhinav92003 merged commit b9441b3 into master Dec 1, 2023
14 of 15 checks passed
@abhinav92003 abhinav92003 deleted the i5505-kernel-instr-encodings branch December 1, 2023 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants