From: Phil Auld <pauld@redhat.com>
To: Tejun Heo <tj@kernel.org>
Cc: David Vernet <void@manifault.com>,
linux-kernel@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH sched_ext/for-6.12] sched_ext: Improve logging around enable/disable
Date: Thu, 8 Aug 2024 08:38:17 -0400 [thread overview]
Message-ID: <20240808123817.GA89141@pauld.westford.csb> (raw)
In-Reply-To: <ZrQW4gqIr_hTgp0z@slm.duckdns.org>
On Wed, Aug 07, 2024 at 02:52:50PM -1000 Tejun Heo wrote:
> 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.
>
Thanks! That looks very helpful.
Reviewed-by: Phil Auld <pauld@redhat.com>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Suggested-by: Phil Auld <pauld@redhat.com>
> ---
> kernel/sched/ext.c | 21 +++++++++++++--------
> 1 file changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index 60a7eb7d8a9e..eea2fda8e099 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
> @@ -4004,11 +4004,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:
> @@ -4126,14 +4126,17 @@ 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')
> + printk(KERN_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)
> @@ -4808,6 +4811,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);
>
>
--
next prev parent reply other threads:[~2024-08-08 12:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-08 0:52 Tejun Heo
2024-08-08 12:38 ` Phil Auld [this message]
2024-08-08 17:00 ` David Vernet
2024-08-08 23:47 ` [PATCH v2 " Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240808123817.GA89141@pauld.westford.csb \
--to=pauld@redhat.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--cc=void@manifault.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®