[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Wed, 10 Nov 2021 20:01:37 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: Jarkko Sakkinen <jarkko@...nel.org>,
"Luck, Tony" <tony.luck@...el.com>
Cc: Reinette Chatre <reinette.chatre@...el.com>,
dave.hansen@...ux.intel.com, tglx@...utronix.de, bp@...en8.de,
mingo@...hat.com, linux-sgx@...r.kernel.org, x86@...nel.org,
seanjc@...gle.com, hpa@...or.com, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH V2] x86/sgx: Fix free page accounting
On 11/10/21 7:50 PM, Jarkko Sakkinen wrote:
>> CPU_A CPU_B
>> ----- -----
>> spin_lock(&nodeA->lock); spin_lock(&nodeB->lock);
>> ... ...
>> sgx_nr_free_pages--; /* NOT SAFE */ sgx_nr_free_pages--;
>>
>> spin_unlock(&nodeA->lock); spin_unlock(&nodeB->lock);
>>
>> Maybe you missed the "NOT SAFE" hidden in the middle of
>> the picture?
>>
>> -Tony
> For me from that the ordering is not clear. E.g. compare to
> https://www.kernel.org/doc/Documentation/memory-barriers.txt
Jarkko,
Reinette's explanation looks great to me. Something "protected" by two
different locks is not protected at all. I don't think we need to fret
over this too much.
We don't need memory barriers or anything fancy at all to explain this.
Powered by blists - more mailing lists