Re: [PATCH] hrtimer: avoid retrigger_next_event IPI

From: Thomas Gleixner
Date: Sat Apr 10 2021 - 04:04:14 EST


On Fri, Apr 09 2021 at 13:51, Marcelo Tosatti wrote:
> On Fri, Apr 09, 2021 at 04:15:13PM +0200, Thomas Gleixner wrote:
>> On Wed, Apr 07 2021 at 10:53, Marcelo Tosatti wrote:
>> ---> fail because that newly started timer is on the old offset.
>
> CPU0 CPU1
>
>
> clock_was_set()
> Case-1: CPU-1 grabs base->lock before CPU-0:
> CPU-0 sees active_mask[CPU1] and IPIs.
>
> base = lock_hrtimer_base(timer, &flags);
> if (__hrtimer_start_range_ns(timer, tim, ...
> hrtimer_reprogram(timer, true);
>
> unlock_hrtimer_base(timer, &flags);
>
>
> raw_spin_lock_irqsave(&cpu_base->lock, flags);
> if (need_reprogram_timer(cpu_base))
> cpumask_set_cpu(cpu, mask);
> else
> hrtimer_update_base(cpu_base);
> raw_spin_unlock_irqrestore(&cpu_base->lock, flags);
>
> Case-2: CPU-1 grabs base->lock after CPU-0:
> CPU-0 will have updated the offsets remotely.
>
> base = lock_hrtimer_base(timer, &flags);
> if (__hrtimer_start_range_ns(timer, tim, ...
> hrtimer_reprogram(timer, true);
>
> unlock_hrtimer_base(timer, &flags);
>
>
> No?

Yeah, you're right. I misread the loop logic.

Can we please make that unconditional independent of nohz full. There is
no reason to special case it.

Thanks,

tglx