Home
last modified time | relevance | path

Searched hist:ff229eee3d897f52bd001c841f2d3cce8853ecdc (Results 1 – 1 of 1) sorted by relevance

/openbmc/linux/kernel/time/
H A Dhrtimer.cdiff ff229eee3d897f52bd001c841f2d3cce8853ecdc Tue Oct 08 12:32:04 CDT 2019 Eric Dumazet <edumazet@google.com> hrtimer: Annotate lockless access to timer->base

Followup to commit dd2261ed45aa ("hrtimer: Protect lockless access
to timer->base")

lock_hrtimer_base() fetches timer->base without lock exclusion.

Compiler is allowed to read timer->base twice (even if considered dumb)
which could end up trying to lock migration_base and return
&migration_base.

base = timer->base;
if (likely(base != &migration_base)) {

/* compiler reads timer->base again, and now (base == &migration_base)

raw_spin_lock_irqsave(&base->cpu_base->lock, *flags);
if (likely(base == timer->base))
return base; /* == &migration_base ! */

Similarly the write sides must use WRITE_ONCE() to avoid store tearing.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20191008173204.180879-1-edumazet@google.com