lkml.org 
[lkml]   [2019]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4.19 032/114] timer: Read jiffies once when forwarding base clk
On Thu 2019-10-10 10:35:39, Greg Kroah-Hartman wrote:
> From: Li RongQing <lirongqing@baidu.com>
>
> commit e430d802d6a3aaf61bd3ed03d9404888a29b9bf9 upstream.
>
> The reason is that the code in collect_expired_timers() uses jiffies
> unprotected:
>
> if (next_event > jiffies)
> base->clk = jiffies;
>
> As the compiler is allowed to reload the value base->clk can advance
> between the check and the store and in the worst case advance farther than
> next event. That causes the timer expiry to be delayed until the wheel
> pointer wraps around.
>
> Convert the code to use READ_ONCE()

Does it really need to use READ_ONCE? "jiffies" is already volatile,
READ_ONCE just adds another volatile...

Best regards,
Pavel
--
(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: 2019-10-13 17:49    [W:0.340 / U:2.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site