From: Kunwu Chan <kunwu.chan@gmail.com>
To: arnd@arndb.de, anna-maria@linutronix.de, frederic@kernel.org,
mingo@kernel.org, tglx@kernel.org
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
Kunwu Chan <kunwu.chan@gmail.com>
Subject: [PATCH v2 0/2] rwonce: Introduce {READ,WRITE}_ONCE_THIS_CPU()
Date: Fri, 2 Oct 2026 23:17:54 +0800 [thread overview]
Message-ID: <20261002151757.3605081-1-kunwu.chan@gmail.com> (raw)
This is a rework of [1] following the discussion with Thomas and Paul.
v1 marked the got_idle_tick accesses with plain READ_ONCE()/WRITE_ONCE().
However, the plain variants do not distinguish an intentional race
between execution contexts on the same CPU from an access that may race
across CPUs. This distinction allows concurrency tools such as KCSAN
to tell these cases apart, so that stricter task-vs-interrupt race
checking can be enabled without false positives on intentional
same-CPU races.
The first patch introduces READ_ONCE_THIS_CPU() and
WRITE_ONCE_THIS_CPU() for this purpose, currently as simple wrappers
around the plain variants. The second patch converts got_idle_tick
to use them.
Changes since v1 [1]:
- Introduce {READ,WRITE}_ONCE_THIS_CPU() instead of reusing the
plain variants. (Thomas Gleixner)
- Expand the commit messages to state the KCSAN rationale. (Thomas
Gleixner)
[1] https://lore.kernel.org/all/20260920085434.2918331-1-kunwu.chan@gmail.com/
Kunwu Chan (2):
rwonce: Add READ_ONCE_THIS_CPU() and WRITE_ONCE_THIS_CPU()
timers/nohz: Mark got_idle_tick accesses as same-CPU races
include/asm-generic/rwonce.h | 11 +++++++++++
kernel/time/tick-sched.c | 6 +++---
2 files changed, 14 insertions(+), 3 deletions(-)
--
2.43.0
next reply other threads:[~2026-10-02 15:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 15:17 Kunwu Chan [this message]
2026-10-02 15:17 ` [PATCH v2 1/2] rwonce: Add READ_ONCE_THIS_CPU() and WRITE_ONCE_THIS_CPU() Kunwu Chan
2026-10-02 15:44 ` Paul E. McKenney
2026-10-02 15:17 ` [PATCH v2 2/2] timers/nohz: Mark got_idle_tick accesses as same-CPU races Kunwu Chan
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=20261002151757.3605081-1-kunwu.chan@gmail.com \
--to=kunwu.chan@gmail.com \
--cc=anna-maria@linutronix.de \
--cc=arnd@arndb.de \
--cc=frederic@kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@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®