> -----Original Message----- > From: Huang, Kai <kai.hu...@intel.com> > Sent: Wednesday, August 13, 2025 2:08 PM > To: Reshetova, Elena <elena.reshet...@intel.com>; Hansen, Dave > <dave.han...@intel.com> > Cc: sea...@google.com; mi...@kernel.org; Scarlata, Vincent R > <vincent.r.scarl...@intel.com>; x...@kernel.org; jar...@kernel.org; > Annapurve, Vishal <vannapu...@google.com>; linux-kernel@vger.kernel.org; > Mallick, Asit K <asit.k.mall...@intel.com>; Aktas, Erdem > <erdemak...@google.com>; Cai, Chong <cho...@google.com>; Bondarevska, > Nataliia <bond...@google.com>; linux-...@vger.kernel.org; Raynor, Scott > <scott.ray...@intel.com> > Subject: Re: [PATCH v13 5/5] x86/sgx: Enable automatic SVN updates for SGX > enclaves > > > > > Note: while in such cases the underlying crypto assets are regenrated, it > ^ > regenerated > >
Thank you for catching this! Will fix. > [...] > > > +/* Mutex to ensure no concurrent EPC accesses during EUPDATESVN */ > > +static DEFINE_MUTEX(sgx_svn_lock); > > + > > int sgx_inc_usage_count(void) > > { > > + int ret; > > + > > + guard(mutex)(&sgx_svn_lock); > > + > > + if (sgx_usage_count++ == 0) { > > + ret = sgx_update_svn(); > > + if (ret) > > + sgx_usage_count--; > > + return ret; > > + } > > + > > To me, I would prefer: > > int sgx_inc_usage_count(void) > { > guard(mutex)(&sgx_svn_lock); > > if (!sgx_usage_count) { > int ret = sgx_update_svn(); > if (ret) > return ret; > } > > sgx_usage_count++; > > return 0; > } I can change to this version, but functionality-wise it is equal. Best Regards, Elena.