> -----Original Message-----
> From: Huang, Kai <[email protected]>
> Sent: Wednesday, August 13, 2025 2:08 PM
> To: Reshetova, Elena <[email protected]>; Hansen, Dave
> <[email protected]>
> Cc: [email protected]; [email protected]; Scarlata, Vincent R
> <[email protected]>; [email protected]; [email protected];
> Annapurve, Vishal <[email protected]>; [email protected];
> Mallick, Asit K <[email protected]>; Aktas, Erdem
> <[email protected]>; Cai, Chong <[email protected]>; Bondarevska,
> Nataliia <[email protected]>; [email protected]; Raynor, Scott
> <[email protected]>
> 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.