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: <c1421f42-4107-4a6a-80f3-c46d915b40a6@intel.com>
Date: Mon, 14 Jul 2025 08:37:50 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: "Reshetova, Elena" <elena.reshetova@...el.com>
Cc: "jarkko@...nel.org" <jarkko@...nel.org>,
 "seanjc@...gle.com" <seanjc@...gle.com>, "Huang, Kai" <kai.huang@...el.com>,
 "mingo@...nel.org" <mingo@...nel.org>,
 "linux-sgx@...r.kernel.org" <linux-sgx@...r.kernel.org>,
 "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
 "x86@...nel.org" <x86@...nel.org>, "Mallick, Asit K"
 <asit.k.mallick@...el.com>,
 "Scarlata, Vincent R" <vincent.r.scarlata@...el.com>,
 "Cai, Chong" <chongc@...gle.com>, "Aktas, Erdem" <erdemaktas@...gle.com>,
 "Annapurve, Vishal" <vannapurve@...gle.com>,
 "dionnaglaze@...gle.com" <dionnaglaze@...gle.com>,
 "Bondarevska, Nataliia" <bondarn@...gle.com>,
 "Raynor, Scott" <scott.raynor@...el.com>
Subject: Re: [PATCH v7 5/5] x86/sgx: Enable automatic SVN updates for SGX
 enclaves

On 7/14/25 06:54, Dave Hansen wrote:
> On 7/14/25 00:35, Reshetova, Elena wrote:
>> I think you put it: this would require a spinlock in the fast path and
>> *in theory* if we are running many many concurrent enclaves can create 
>> contention
> FWIW, my mental model is that spinlocks that are held for short periods
> of time are pretty much the same cost as an atomic under contention.
> 
> If there are lots of users, the cost of moving the cacheline for the
> atomic or the spinlock dominates everything else. It doesn't matter
> whether that cacheline is an atomic_t or spinlock_t.
> 
> The only difference is that there is _visible_ spinning for a spinlock.

Oh, and I had a brain fart on this one. You've got a mutex, not a spinlock.

But the concept still applies: for small critical sections, the cost of
moving the cacheline dominates the cost of everything else, no matter if
it's a mutex, spinlock or atomic.

Never add complexity unless you're getting actual, real-world
performance out of it. In this case, the only thing you'd _maybe_
improve with added complexity is an open()/close() loop on /dev/sgx,
which is completely unrealistic.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ