lkml.org 
[lkml]   [2020]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4.19 089/114] hrtimer: Annotate lockless access to timer->state
Hi!

> From: Eric Dumazet <edumazet@google.com>
>
> commit 56144737e67329c9aaed15f942d46a6302e2e3d8 upstream.
>
> syzbot reported various data-race caused by hrtimer_is_queued() reading
> timer->state. A READ_ONCE() is required there to silence the warning.
>
> Also add the corresponding WRITE_ONCE() when timer->state is set.
>
> In remove_hrtimer() the hrtimer_is_queued() helper is open coded to avoid
> loading timer->state twice.

Is there a reason why READ_ONCE is not neccessary in remove_hrtimer?

Should there be comment there explaining it?

Best regards,
Pavel

> @@ -1002,8 +1004,9 @@ static void __remove_hrtimer(struct hrti
> static inline int
> remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, bool restart)
> {
> - if (hrtimer_is_queued(timer)) {
> - u8 state = timer->state;
> + u8 state = timer->state;
> +
> + if (state & HRTIMER_STATE_ENQUEUED) {
> int reprogram;
>
> /*
>

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2020-01-03 20:08    [W:0.423 / U:31.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site