[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iKBaEdCzgF-MT1wrxBZtBD2Ktr9qeThTG_XKOy742XcmQ@mail.gmail.com>
Date: Wed, 6 Nov 2019 14:02:55 -0800
From: Eric Dumazet <edumazet@...gle.com>
To: LKML <linux-kernel@...r.kernel.org>
Cc: linux-tip-commits@...r.kernel.org,
syzbot <syzkaller@...glegroups.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>, Borislav Petkov <bp@...en8.de>
Subject: Re: [tip: timers/core] hrtimer: Annotate lockless access to timer->state
On Wed, Nov 6, 2019 at 1:06 PM tip-bot2 for Eric Dumazet
<tip-bot2@...utronix.de> wrote:
>
> The following commit has been merged into the timers/core branch of tip:
>
> Commit-ID: de4db39b9f0e682e59caa828a277632510901560
> Gitweb: https://git.kernel.org/tip/de4db39b9f0e682e59caa828a277632510901560
> Author: Eric Dumazet <edumazet@...gle.com>
> AuthorDate: Wed, 06 Nov 2019 09:48:04 -08:00
> Committer: Thomas Gleixner <tglx@...utronix.de>
> CommitterDate: Wed, 06 Nov 2019 21:59:56 +01:00
>
> hrtimer: Annotate lockless access to timer->state
...
> -/*
> - * Helper function to check, whether the timer is on one of the queues
> +/**
> + * hrtimer_is_queued = check, whether the timer is on one of the queues
> + * @timer: Timer to check
> + *
> + * Returns: True if the timer is queued, false otherwise
> + *
> + * The function can be used lockless, but it gives only a current snapshot.
> */
> -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.
Powered by blists - more mailing lists