lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <96DD7021A77A45D4+430029ca-38ee-204a-4ee5-a5246b99bb62@uniontech.com>
Date:   Thu, 15 Jun 2023 16:27:41 +0800
From:   Guo Hui <guohui@...ontech.com>
To:     Waiman Long <longman@...hat.com>, peterz@...radead.org,
        mingo@...hat.com, will@...nel.org, boqun.feng@...il.com
Cc:     linux-kernel@...r.kernel.org, wangxiaohua@...ontech.com
Subject: Re: [PATCH] locking/osq_lock: Fix false sharing of
 optimistic_spin_node in osq_lock


On 6/15/23 10:57 AM, Waiman Long wrote:
>
> On 6/14/23 21:58, Waiman Long wrote:
>>> diff --git a/kernel/locking/osq_lock.c b/kernel/locking/osq_lock.c
>>> index d5610ad52b92..bdcd216b73c4 100644
>>> --- a/kernel/locking/osq_lock.c
>>> +++ b/kernel/locking/osq_lock.c
>>> @@ -24,7 +24,7 @@ static inline int encode_cpu(int cpu_nr)
>>>     static inline int node_cpu(struct optimistic_spin_node *node)
>>>   {
>>> -    return node->cpu - 1;
>>> +    return node->prev_cpu - 1;
>>>   }
>>
>> From the first glance, the patch looks OK. The only issue that I have 
>> so far is the "node_cpu" name which is misleading in this case. You 
>> should have renamed it to node_prev_cpu() instead as there is only 
>> one caller.
>
> One more thing. Unlike node->cpu, node->prev_cpu is subjected to 
> change. So you should have use READ_ONCE() to read it to match the 
> WRITE_ONCE() that modifies it.
>
> Thanks,
> Longman
>
>

Ok thanks, I got it.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ