Re: [PATCH v7 14/15] rv: Add deadline monitors
From: gmonaco
Date: Wed Mar 18 2026 - 08:01:13 EST
Hello,
On Thu, 2026-03-12 at 14:37 +0100, Juri Lelli wrote:
> > +/* Used by other monitors */
> > +struct sched_class *rv_ext_sched_class;
> > +
> > +static int __init register_deadline(void)
> > +{
> > + if (IS_ENABLED(CONFIG_SCHED_CLASS_EXT))
> > + rv_ext_sched_class = (void
> > *)kallsyms_lookup_name("ext_sched_class");
>
> Looks like the above look up can fail. I don't actually see how/why
> if would fail if things build correctly and EXT tasks are around.
> But, theoretically, we could end up with rv_ext_sched_class = NULL ?
>
> > +static inline bool task_is_scx_enabled(struct task_struct *tsk)
> > +{
> > + return IS_ENABLED(CONFIG_SCHED_CLASS_EXT) &&
> > + tsk->sched_class == rv_ext_sched_class;
> > +}
> > +
> > +/* Expand id and target as arguments for da functions */
> > +#define EXPAND_ID(dl_se, cpu, type) get_entity_id(dl_se, cpu,
> > type), dl_se
> > +#define EXPAND_ID_TASK(tsk) get_entity_id(&tsk->dl, task_cpu(tsk),
> > DL_TASK), &tsk->dl
> > +
> > +static inline uint8_t get_server_type(struct task_struct *tsk)
> > +{
> > + if (tsk->policy == SCHED_NORMAL || tsk->policy ==
> > SCHED_EXT ||
> > + tsk->policy == SCHED_BATCH || tsk->policy ==
> > SCHED_IDLE)
> > + return task_is_scx_enabled(tsk) ? DL_SERVER_EXT :
> > DL_SERVER_FAIR;
> > + return DL_OTHER;
> > +}
>
> Considering that, if that happens, get_server_type() will return
> DL_SERVER_FAIR for scx tasks as well (possibly confusing monitors?),
> shall we add a warn or something just in case. A 'no we don't need
> that
> because it can't happen' works for me, just thought I should still
> mention this. :)
I forgot answering..
Well, technically yes, this all can fail.
I figured a silent degradation in this remote case would be alright,
but probably just print it during initialisation wouldn't hurt.
We cannot do much if it really happened and, yes, monitors would likely
fail if both SCX and fair servers coexist.
I'd assume it /should/ never happen, but it costs nothing adding:
pr_warn("Error detecting the ext class, monitors may report wrong
results.\n");
Thanks,
Gabriele