Re: [PATCH 17/25] hrtimer: Implementation of softirq hrtimer handling

From: Peter Zijlstra
Date: Wed Sep 27 2017 - 12:47:04 EST


On Wed, Sep 27, 2017 at 04:22:39PM +0200, Anna-Maria Gleixner wrote:
> I know and Thomas was unhappy about that as well, but we did not come
> up with a better solution.
>
> The nasty alternative is:
>
> static void __run_hrtimer(struct hrtimer_cpu_base *cpu_base,
> struct hrtimer_clock_base *base,
> - struct hrtimer *timer, ktime_t *now)
> + struct hrtimer *timer, ktime_t *now,
> + unsigned long flags)
> ...
> - raw_spin_unlock(&cpu_base->lock);
> + raw_spin_unlock_irqrestore(&cpu_base->lock, flags);
>
> ...
> - raw_spin_lock(&cpu_base->lock);
> + raw_spin_lock_irq(&cpu_base->lock, flags);
>
> and hand in flags from the callsites via local_save_flags().

Just push it up one more level and use raw_spin_lock_irqsave() in the
(soft)irq handlers and then pass the flags around.

Thta's what I did in that patch I just send.