Re: [PATCH] Fix data race in mark_rt_mutex_waiters

From: Hernan Ponce de Leon
Date: Thu Jan 26 2023 - 04:42:48 EST


On 1/24/2023 5:04 PM, Waiman Long wrote:

On 1/24/23 10:52, Peter Zijlstra wrote:
On Tue, Jan 24, 2023 at 10:42:24AM -0500, Waiman Long wrote:

I would suggest to do it as suggested by PeterZ. Instead of set_bit(),
however, it is probably better to use atomic_long_or() like

atomic_long_or_relaxed(RT_MUTEX_HAS_WAITERS, (atomic_long_t *)&lock->owner)
That function doesn't exist, atomic_long_or() is implicitly relaxed for
not returning a value.

You are right. atomic_long_or() doesn't have variants like some others.

Cheers,
Longman


When you say "replace the whole of that function", do you mean "barrier included"? I argue in the other email that I think this should not affect correctness (at least not obviously), but removing the barrier is doing more than just fixing the data race as this patch suggests.

Hernan