Re: [RFC 1/2] timers: Add pending timer bool in struct timer_base

From: Thomas Gleixner
Date: Fri Jun 18 2021 - 17:06:13 EST


Nicolas,

On Thu, Jun 10 2021 at 14:59, Nicolas Saenz Julienne wrote:

please always Cc the relevant mailing lists and the maintainers.
MAINTAINERS exists for a reason.

> We need to efficiently check whether a timer base has no pending
> events.

'We need' is not a technical explanation. That's close to 'I want a pony'.

Please describe what you are trying to solve and why the existing
mechanisms are not good enough.

See Documentation/process/submitting-patches.rst

> So introduce a new variable in struct timer_base to do so.

The variable solves your problem? Interesting solution.

> base->next_expiry = bucket_expiry;
> base->next_expiry_recalc = false;
> +#ifdef CONFIG_PREEMPT_RT
> + base->pending = true;
> +#endif

What is RT specific about that?

> trigger_dyntick_cpu(base, timer);
> }
> }
> @@ -1598,6 +1602,9 @@ static unsigned long __next_timer_interrupt(struct timer_base *base)
> }
>
> base->next_expiry_recalc = false;
> +#ifdef CONFIG_PREEMPT_RT
> + base->pending = (next != base->clk + NEXT_TIMER_MAX_DELTA);
> +#endif

This lacks any information about the semantics of this flag:

- When is it valid and when not?
- What is the valid use case for this flag?

Summary of the supplied information: We need a flag, so we added one.

Sorry that's not sufficient.

Thanks,

tglx