From: Dave Hansen <dave.hansen@intel.com>
To: Jarkko Sakkinen <jarkko@kernel.org>, "Luck, Tony" <tony.luck@intel.com>
Cc: Reinette Chatre <reinette.chatre@intel.com>,
dave.hansen@linux.intel.com, tglx@linutronix.de, bp@alien8.de,
mingo@redhat.com, linux-sgx@vger.kernel.org, x86@kernel.org,
seanjc@google.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH V2] x86/sgx: Fix free page accounting
Date: Wed, 10 Nov 2021 20:01:37 -0800 [thread overview]
Message-ID: <bacbf33c-aade-fd16-ed95-20b1d0511752@intel.com> (raw)
In-Reply-To: <f99dca08d332b01daec9eed7e4a55f042b551a67.camel@kernel.org>
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.
prev parent reply other threads:[~2021-11-11 4:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-09 20:00 [PATCH V2] x86/sgx: Fix free page accounting Reinette Chatre
2021-11-10 15:11 ` Jarkko Sakkinen
2021-11-10 18:51 ` Reinette Chatre
2021-11-10 19:16 ` Luck, Tony
2021-11-11 2:56 ` Jarkko Sakkinen
2021-11-11 2:55 ` Jarkko Sakkinen
2021-11-11 3:26 ` Luck, Tony
2021-11-11 3:50 ` Jarkko Sakkinen
2021-11-11 4:01 ` Dave Hansen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bacbf33c-aade-fd16-ed95-20b1d0511752@intel.com \
--to=dave.hansen@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jarkko@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=reinette.chatre@intel.com \
--cc=seanjc@google.com \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox