[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f4f688ba-8953-4cb6-a749-94dad74692ed@acm.org>
Date: Fri, 23 Jan 2026 10:58:35 -0800
From: Bart Van Assche <bvanassche@....org>
To: elver@...gle.com, Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel@...r.kernel.org, bigeasy@...utronix.de, mingo@...nel.org,
tglx@...utronix.de, will@...nel.org, boqun.feng@...il.com,
longman@...hat.com, hch@....de, rostedt@...dmis.org, llvm@...ts.linux.dev
Subject: Re: [RFC][PATCH 0/4] locking: Add/convert context analysis bits
On 1/23/26 3:15 AM, Peter Zijlstra wrote:
> --- a/include/linux/rtmutex.h
> +++ b/include/linux/rtmutex.h
> @@ -41,7 +41,7 @@ struct rt_mutex_base {
> */
> static inline bool rt_mutex_base_is_locked(struct rt_mutex_base *lock)
> {
> - return READ_ONCE(lock->owner) != NULL;
> + return data_race(READ_ONCE(lock->owner) != NULL);
> }
>
> #ifdef CONFIG_RT_MUTEXES
> @@ -49,7 +49,7 @@ static inline bool rt_mutex_base_is_lock
>
> static inline struct task_struct *rt_mutex_owner(struct rt_mutex_base *lock)
> {
> - unsigned long owner = (unsigned long) READ_ONCE(lock->owner);
> + unsigned long owner = (unsigned long) data_race(READ_ONCE(lock->owner));
>
> return (struct task_struct *) (owner & ~RT_MUTEX_HAS_WAITERS);
> }
Marco, shouldn't lock context analysis be disabled for all READ_ONCE()
invocations? I expect that all code that uses READ_ONCE() to read a
structure member annotated with __guarded_by() will have to be annotated
with data_race(). Shouldn't the data_race() invocation be moved into the
READ_ONCE() definition?
Thanks,
Bart.
Powered by blists - more mailing lists