From: Jaidev Shastri via B4 Relay <devnull+jaidevshastri.vt.edu@kernel.org>
To: John Stultz <jstultz@google.com>,
Thomas Gleixner <tglx@kernel.org>,
Stephen Boyd <sboyd@kernel.org>,
Miroslav Lichvar <mlichvar@redhat.com>
Cc: linux-kernel@vger.kernel.org, Jaidev Shastri <jaidevshastri@vt.edu>
Subject: [PATCH] timekeeping: publish suspend_timing_needed with release semantics
Date: Mon, 21 Sep 2026 21:23:43 -0400 [thread overview]
Message-ID: <20260921-mb-timekeeping-v1-1-282f1f4121ed@vt.edu> (raw)
From: Jaidev Shastri <jaidevshastri@vt.edu>
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.
Signed-off-by: Jaidev Shastri <jaidevshastri@vt.edu>
---
kernel/time/timekeeping.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index ea2e6e55f..2b15268c3 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -2141,7 +2141,8 @@ static void __timekeeping_inject_sleeptime(struct timekeeper *tk,
*/
bool timekeeping_rtc_skipresume(void)
{
- return !suspend_timing_needed;
+ /* Pairs with the smp_store_release() in timekeeping_suspend(). */
+ return !smp_load_acquire(&suspend_timing_needed);
}
/*
@@ -2272,7 +2273,8 @@ int timekeeping_suspend(void)
if (timekeeping_suspend_time.tv_sec || timekeeping_suspend_time.tv_nsec)
persistent_clock_exists = true;
- suspend_timing_needed = true;
+ /* Pairs with the smp_load_acquire() in timekeeping_rtc_skipresume(). */
+ smp_store_release(&suspend_timing_needed, true);
raw_spin_lock_irqsave(&tk_core.lock, flags);
timekeeping_forward_now(tks);
---
base-commit: 93f51579e7df248780214094418f205253383cc5
change-id: 20260921-mb-timekeeping-ab8fe52810ec
Best regards,
--
Jaidev Shastri <jaidevshastri@vt.edu>
next reply other threads:[~2026-09-22 1:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 1:23 Jaidev Shastri via B4 Relay [this message]
2026-09-29 12:05 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260921-mb-timekeeping-v1-1-282f1f4121ed@vt.edu \
--to=devnull+jaidevshastri.vt.edu@kernel.org \
--cc=jaidevshastri@vt.edu \
--cc=jstultz@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mlichvar@redhat.com \
--cc=sboyd@kernel.org \
--cc=tglx@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®