Re: [PATCH v9 24/32] timers: Split out "get next timer interrupt" functionality

From: Sebastian Siewior
Date: Wed Dec 06 2023 - 05:21:04 EST


On 2023-12-01 10:26:46 [+0100], Anna-Maria Behnsen wrote:
> diff --git a/kernel/time/timer.c b/kernel/time/timer.c
> index 0d53d853ae22..fc376e06980e 100644
> --- a/kernel/time/timer.c
> +++ b/kernel/time/timer.c

> +static inline u64 __get_next_timer_interrupt(unsigned long basej, u64 basem,
> + bool *idle)
> +{
> + struct timer_events tevt = { .local = KTIME_MAX, .global = KTIME_MAX };
> + struct timer_base *base_local, *base_global;
> + unsigned long nextevt;
> + u64 expires;
> +
> + /*
> + * Pretend that there is no timer pending if the cpu is offline.
> + * Possible pending timers will be migrated later to an active cpu.
> + */
> + if (cpu_is_offline(smp_processor_id())) {
> + if (idle)
> + *idle = true;
> + return tevt.local;
> + }
> +
> + base_local = this_cpu_ptr(&timer_bases[BASE_LOCAL]);
> + base_global = this_cpu_ptr(&timer_bases[BASE_GLOBAL]);
> +
> + raw_spin_lock(&base_local->lock);
> + raw_spin_lock_nested(&base_global->lock, SINGLE_DEPTH_NESTING);
> +
> + nextevt = fetch_next_timer_interrupt(basej, basem, base_local,
> + base_global, &tevt);

Now you split it, move it and we have the __forward_timer_base() back in
case of the shortcut which is now in fetch_next_timer_interrupt().
All good.

>
> /*
> * We have a fresh next event. Check whether we can forward the

Sebastian