Re: [RFC PATCH v2 4/9] rv: Add a monitor for IRQ-exit scheduling ownership
From: Gabriele Monaco
Date: Mon Nov 23 2026 - 02:59:11 EST
On Sat, 2026-11-07 at 18:12 +0100, Karl Mehltretter wrote:
...
> +static void handle_resched_entry(void *data, struct task_struct *owner)
> +{
> + da_handle_start_run_event(owner, resched_entry_irqexit);
> +}
> +
> +static void handle_resched_exit(void *data, struct task_struct *owner)
> +{
> + /* Do not hide an invalid return behind enable-mid-invocation sync.
> */
> + if (owner != rv_get_current() || hardirq_count() || !irqs_disabled())
> + da_handle_start_run_event(owner, resched_exit_irqexit);
> + else
> + da_handle_start_event(owner, resched_exit_irqexit);
What's the added value of this logic? As far as I see from the model,
resched_entry is only available from the initial state and reschd_exit
is always going to the initial state.
You don't need to set both up, since both are equally likely, you're
eventually getting to start the monitor anyway.
But in case you really want a start from both, I'd say you can do:
* resched_entry -> handle_start_run (we are in init and handle)
* resched_exit -> handle_start (we are now in init, handle next event)
No need for any further condition.
Or am I missing something?
> +}
> +
> +static void probe_resched_entry(void *data, struct task_struct *owner,
> + unsigned long pc, bool irq_off)
Do you really need this level of indirection?
Just give all arguments to handle_* and drop the probe_*
> +{
> + handle_resched_entry(data, owner);
> +}
> +
> +static void probe_resched_exit(void *data, struct task_struct *owner,
> + unsigned long pc, bool irq_off)
> +{
> + handle_resched_exit(data, owner);
> +}
Thanks,
Gabriele