Commit 344576fa authored by Tejun Heo's avatar Tejun Heo

sched_ext: Improve logging around enable/disable

sched_ext currently doesn't generate messages when the BPF scheduler is
enabled and disabled unless there are errors. It is useful to have paper
trail. Improve logging around enable/disable:

- Generate info messages on enable and non-error disable.

- Update error exit message formatting so that it's consistent with
  non-error message. Also, prefix ei->msg with the BPF scheduler's name to
  make it clear where the message is coming from.

- Shorten scx_exit_reason() strings for SCX_EXIT_UNREG* for brevity and
  consistency.

v2: Use pr_*() instead of KERN_* consistently. (David)
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Suggested-by: default avatarPhil Auld <pauld@redhat.com>
Reviewed-by: default avatarPhil Auld <pauld@redhat.com>
Acked-by: default avatarDavid Vernet <void@manifault.com>
parent 991ef53a
......@@ -4013,11 +4013,11 @@ static const char *scx_exit_reason(enum scx_exit_kind kind)
{
switch (kind) {
case SCX_EXIT_UNREG:
return "Scheduler unregistered from user space";
return "unregistered from user space";
case SCX_EXIT_UNREG_BPF:
return "Scheduler unregistered from BPF";
return "unregistered from BPF";
case SCX_EXIT_UNREG_KERN:
return "Scheduler unregistered from the main kernel";
return "unregistered from the main kernel";
case SCX_EXIT_SYSRQ:
return "disabled by sysrq-S";
case SCX_EXIT_ERROR:
......@@ -4135,14 +4135,16 @@ static void scx_ops_disable_workfn(struct kthread_work *work)
percpu_up_write(&scx_fork_rwsem);
if (ei->kind >= SCX_EXIT_ERROR) {
printk(KERN_ERR "sched_ext: BPF scheduler \"%s\" errored, disabling\n", scx_ops.name);
pr_err("sched_ext: BPF scheduler \"%s\" disabled (%s)\n",
scx_ops.name, ei->reason);
if (ei->msg[0] == '\0')
printk(KERN_ERR "sched_ext: %s\n", ei->reason);
else
printk(KERN_ERR "sched_ext: %s (%s)\n", ei->reason, ei->msg);
if (ei->msg[0] != '\0')
pr_err("sched_ext: %s: %s\n", scx_ops.name, ei->msg);
stack_trace_print(ei->bt, ei->bt_len, 2);
} else {
pr_info("sched_ext: BPF scheduler \"%s\" disabled (%s)\n",
scx_ops.name, ei->reason);
}
if (scx_ops.exit)
......@@ -4817,6 +4819,8 @@ static int scx_ops_enable(struct sched_ext_ops *ops, struct bpf_link *link)
if (!(ops->flags & SCX_OPS_SWITCH_PARTIAL))
static_branch_enable(&__scx_switched_all);
pr_info("sched_ext: BPF scheduler \"%s\" enabled%s\n",
scx_ops.name, scx_switched_all() ? "" : " (partial)");
kobject_uevent(scx_root_kobj, KOBJ_ADD);
mutex_unlock(&scx_ops_enable_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment