Skip to content

Commit

Permalink
Merge pull request #104 from sched-ext/htejun
Browse files Browse the repository at this point in the history
user_exit_info: Print out debug dump if available
  • Loading branch information
htejun authored Jan 25, 2024
2 parents 09e2824 + 740e382 commit 7117a22
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scheds/include/scx/user_exit_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct user_exit_info {
int kind;
char reason[128];
char msg[1024];
char dump[32768];
};

#ifdef __bpf__
Expand All @@ -26,6 +27,7 @@ static inline void uei_record(struct user_exit_info *uei,
{
bpf_probe_read_kernel_str(uei->reason, sizeof(uei->reason), ei->reason);
bpf_probe_read_kernel_str(uei->msg, sizeof(uei->msg), ei->msg);
bpf_probe_read_kernel_str(uei->dump, sizeof(uei->dump), ei->dump);
/* use __sync to force memory barrier */
__sync_val_compare_and_swap(&uei->kind, uei->kind, ei->kind);
}
Expand All @@ -40,6 +42,12 @@ static inline bool uei_exited(struct user_exit_info *uei)

static inline void uei_print(const struct user_exit_info *uei)
{
if (uei->dump[0] != '\0') {
fputs("\nDEBUG DUMP\n", stderr);
fputs("================================================================================\n\n", stderr);
fputs(uei->dump, stderr);
fputs("\n================================================================================\n\n", stderr);
}
fprintf(stderr, "EXIT: %s", uei->reason);
if (uei->msg[0] != '\0')
fprintf(stderr, " (%s)", uei->msg);
Expand Down

0 comments on commit 7117a22

Please sign in to comment.