[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230123174844.GV2948950@paulmck-ThinkPad-P17-Gen-1>
Date: Mon, 23 Jan 2023 09:48:44 -0800
From: "Paul E. McKenney" <paulmck@...nel.org>
To: Alan Stern <stern@...land.harvard.edu>
Cc: Hernan Ponce de Leon <hernan.poncedeleon@...weicloud.com>,
Arjan van de Ven <arjan@...ux.intel.com>,
peterz@...radead.org, mingo@...hat.com, will@...nel.org,
longman@...hat.com, boqun.feng@...il.com, akpm@...l.org,
tglx@...utronix.de, joel@...lfernandes.org,
diogo.behrens@...wei.com, jonas.oberhauser@...wei.com,
linux-kernel@...r.kernel.org,
Hernan Ponce de Leon <hernanl.leon@...wei.com>,
stable@...r.kernel.org
Subject: Re: [PATCH] Fix data race in mark_rt_mutex_waiters
On Mon, Jan 23, 2023 at 12:34:37PM -0500, Alan Stern wrote:
> On Mon, Jan 23, 2023 at 08:40:14AM -0800, Paul E. McKenney wrote:
> > In the case, the value read is passed into cmpxchg_relaxed(), which
> > checks the value against memory. In this case, as Arjan noted, the only
> > compiler-and-silicon difference between data_race() and READ_ONCE()
> > is that use of data_race() might allow the compiler to do things like
> > tear the load, thus forcing the occasional spurious cmpxchg_relaxed()
> > failure.
>
> Is it possible in theory for a torn load to cause a spurious
> cmpxchg_relaxed() success? Or would that not matter here?
In this case, the new value is the old value with an additional bit set.
There is no check for that bit being clear, so I am having a hard time
seeing a difference.
Then again, much might depend on the ordering that Hernan is
referring to.
And Peter Zijlstra's suggestion of set_bit() is quite attractive,
give or take the casting issues called out by David Laight.
Thanx, Paul
Powered by blists - more mailing lists