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

From: Eric Dumazet
Date: Wed Nov 06 2019 - 17:59:51 EST


On Wed, Nov 6, 2019 at 2:53 PM Eric Dumazet <edumazet@xxxxxxxxxx> wrote:
>
> On Wed, Nov 6, 2019 at 2:24 PM tip-bot2 for Eric Dumazet
> <tip-bot2@xxxxxxxxxxxxx> wrote:
> >
> > The following commit has been merged into the timers/core branch of tip:
> >
> > Commit-ID: 56144737e67329c9aaed15f942d46a6302e2e3d8
> > Gitweb: https://git.kernel.org/tip/56144737e67329c9aaed15f942d46a6302e2e3d8
> > Author: Eric Dumazet <edumazet@xxxxxxxxxx>
> > AuthorDate: Wed, 06 Nov 2019 09:48:04 -08:00
> > Committer: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> > CommitterDate: Wed, 06 Nov 2019 23:18:31 +01:00
> >
> > hrtimer: Annotate lockless access to timer->state
> >
>
> I guess we also need to fix timer_pending(), since timer->entry.pprev
> could change while we read it.
>

It is interesting seeing hlist_add_head() has a WRITE_ONCE(h->first, n);,
but no WRITE_ONCE() for the pprev change.

The WRITE_ONCE() was added in commit 1c97be677f72b3c338312aecd36d8fff20322f32
("list: Use WRITE_ONCE() when adding to lists and hlists")