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

Build kernel with KFT instrumentation #1393

Merged
merged 37 commits into from
Nov 22, 2023
Merged

Conversation

franciscozdo
Copy link
Collaborator

This PR contains only changes made to kernel to create data about function calls. There will be another PR with python code which will interpret this data.

@franciscozdo franciscozdo added the WiP not ready for code review label Jun 11, 2023
@franciscozdo franciscozdo added review please review this PR and removed WiP not ready for code review labels Jun 11, 2023
Copy link
Owner

@cahirwpz cahirwpz left a comment

Choose a reason for hiding this comment

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

I would much appreciate if you renamed kft.{c,h} to kftrace.{c,h} respectively.

Please note that most likely kft.h should be renamed to cpufunc.h and the function should be renamed to cpu_getcounter. But that would require some cleanup effort, which we don't want to incur ATM.

include/mips/kft.h Outdated Show resolved Hide resolved
include/riscv/kft.h Outdated Show resolved Hide resolved
include/aarch64/kft.h Outdated Show resolved Hide resolved
@franciscozdo franciscozdo added WiP not ready for code review and removed review please review this PR labels Jul 27, 2023
@franciscozdo franciscozdo added review please review this PR and removed WiP not ready for code review labels Aug 7, 2023
Copy link
Owner

@cahirwpz cahirwpz left a comment

Choose a reason for hiding this comment

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

Let's work towards integrating it well with launch script.

config.mk Outdated
@@ -4,7 +4,7 @@
# build system for given platform.
#

CONFIG_OPTS := KASAN LOCKDEP KGPROF MIPS AARCH64 RISCV KCSAN
CONFIG_OPTS := MIPS AARCH64 RISCV KASAN LOCKDEP KCSAN KGPROF KFTRACE
Copy link
Owner

Choose a reason for hiding this comment

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

Please don't reorder the options if you don't need to. What about KGPROF and KFTRACE now, shouldn't they be replaced by KFI?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have added them to make it possible to include sources that are saved in variables SOURCES_KFTRACE and SOURCES_KGPROF. I couldn't figure it out how to do it with single KFI flag.

I will reorder back the other flags.

build/build.kern.mk Show resolved Hide resolved
sys/kern/main.c Outdated Show resolved Hide resolved
sys/kern/kftrace.c Outdated Show resolved Hide resolved
sys/kern/kftrace.c Outdated Show resolved Hide resolved
sys/kern/kftrace.c Outdated Show resolved Hide resolved
static unsigned kft_used = 0;
static bool kft_enabled = false;

#define PC_MASK 0xFFFFFF /* 24 bits */
Copy link
Owner

Choose a reason for hiding this comment

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

Please note that lower two bits won't be used on all architectures with 4-byte only instruction words (i.e. all that we support currently).

sys/kern/kftrace.c Outdated Show resolved Hide resolved
.gdbinit-kftrace Show resolved Hide resolved
@cahirwpz cahirwpz requested a review from pj1031999 August 8, 2023 10:22
Copy link
Owner

@cahirwpz cahirwpz left a comment

Choose a reason for hiding this comment

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

LGTM

@cahirwpz cahirwpz merged commit 8950128 into cahirwpz:master Nov 22, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review please review this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants