Re: [PATCH] timekeeping: publish suspend_timing_needed with release semantics
From: Thomas Gleixner
Date: Tue Sep 29 2026 - 08:06:27 EST
On Mon, Sep 21 2026 at 21:23, Jaidev Shastri via wrote:
> From: Jaidev Shastri <jaidevshastri@xxxxxx>
>
> timekeeping_suspend() sets suspend_timing_needed with a plain store
> after it has read the persistent clock. timekeeping_rtc_skipresume()
> reads it with a plain load on behalf of the RTC class during resume.
> Set it with smp_store_release() and read it with smp_load_acquire().
>
> Found with MBCheck, a static herd7-based memory consistency checker.
And what exactly is this release/acquire solving?
1) timekeeping_suspend()
suspend_timing_needed = true
...
2) system suspends
3) system resumes
4) timekeeping_resume()
if (inject_sleeptime)
suspend_timing_needed = false
5) system continues to resume
6) timekeeping_rtc_skipresume()
The store in #1 is completely uninteresting because suspend/resume is a big
pile of memory barriers so there is _ZERO_ chance that #6 cannot observe
the store in #1.
The more interesting case would be the conditional store in #4 which in
a pretty far fetched theory could lead to the case that
timekeeping_rtc_skipresume() would not observe it.
But if you actually look at the sequence which is between #4 and #6 this
theory becomes a myth.
Please analyze your tool findings properly before blindly claiming that
the tool actually found something problematic.
Thanks,
tglx