-
Notifications
You must be signed in to change notification settings - Fork 29
Conversation
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.
Looks great. Thanks a lot for making the debug story so much better with these last few change sets.
kernel/sched/ext.c
Outdated
seq_buf_putc(s, '\n'); | ||
} | ||
|
||
static __printf(2, 0) void dump_line(struct seq_buf *s, const char *fmt, ...) |
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.
Should this be __printf(2, 3)
?
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.
Fixed.
tools/sched_ext/include/scx/common.h
Outdated
* needed from vmlinux.h. This is error-prone. Hopefully, we'll figure out a | ||
* better way to do this in the future. | ||
*/ | ||
enum scx_ops_flags { |
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.
Per our offline discussion, we could use __COMPAT_ENUM_OR_ZERO()
here to give this CO-RE semantics. Something like:
define SCX_OPS_KEEP_BUILTIN_IDLE __COMPAT_enum_or_zero("scx_ops_flags", SCX_OPS_KEEP_BUILTIN_IDLE)
Feel free to ignore or apply as you think best.
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.
I dropped this patch. Let's do it in a separate patch. In an earlier version, I added a new ops flag for trace dumping but then switched to using a TP which makes this change unnecessary for this PR. I'll add this later.
Nothing's gained by keeping these percpu. Let's make them global.
No functional changes.
Add dump_line() which wraps seq_buf_vprintf(). Replace seq_buf_printf() and seq_buf_putc() usages with the new wrapper. Also, don't print more than one line. This is preparation for sending debug dump through a tracepoint.
Let's output stack trace using dump_line() too.
- Factor out __bstr_format() which takes broken out buffer arguments. Will be used to implement incremental formatting. - bstr_format() now takes struct scx_bstr_buf * instead of implicitly using the global buffer. - Rename scx_bstr_buf to scx_exit_bstr_buf and switch the dump path to its own bstr_buf. No functional changes.
scx_bpf_dump_bstr() was outputing character by character into the dump buffer. This is fine for the dump attached to the exit info but we also want to output through a tracepoint. This patch makes ops dump output into lines so that dump_line() is always called with a full line.
Make dump_line() append newline implicitly and add dump_newline() for outputting a blank line. The latter is needed because __printf format checking gets unhappy with empty format string "". This doesn't cause any behavior changes and will be used to enable dump output through a tracepoint.
- In dump_stack_trace(), seq_buf_commit() triggers BUG() if $s is already overflowed when $ns was created. Commit iff $avail is non-zero. - seq_buf_putc() and seq_buf_vprintf() trigger a warning if @s has zero length, which can happen with $ns. Skip them for empy seq_bufs.
Add a new tracepoint, sched_ext_dump, which also receives the dump output. The TP output is not limted by dump buffer size and truncation will only happen on trace buffer overflows.
This triggers debug dump in a non-destructive manner.
sched_ext_dump
tracepoint.sysrq-D
.