Re: [tip: timers/core] hrtimer: Annotate lockless access to timer->state

From: Thomas Gleixner
Date: Wed Nov 06 2019 - 17:16:55 EST


On Wed, 6 Nov 2019, Eric Dumazet wrote:
> > -static inline int hrtimer_is_queued(struct hrtimer *timer)
> > +static inline bool hrtimer_is_queued(struct hrtimer *timer)
> > {
> > - return timer->state & HRTIMER_STATE_ENQUEUED;
> > + /* The READ_ONCE pairs with the update functions of timer->state */
> > + return !!READ_ONCE(timer->state) & HRTIMER_STATE_ENQUEUED;
>
> You probably meant :
>
> return !!(READ_ONCE(timer->state) & HRTIMER_STATE_ENQUEUED);
>
> Sorry for not spotting this earlier.

Yes, I'm a moron....