RE: [PATCH v5 5/5] x86/sgx: Enable automatic SVN updates for SGX enclaves

From: Reshetova, Elena
Date: Tue May 20 2025 - 02:46:25 EST


> > Yes, meaning is different, see above.
>
> So that's rather convoluted:
>
> atomic64_inc_not_zero(): returns 1 on successful increase, 0 on
> failure
> sgx_inc_usage_count(): returns 0 on successful increase, 1 on failure
> sgx_open(): returns 0 on successful increase, -EBUSY on failure
>
> Could we at least standardize sgx_inc_usage_count() on -EBUSY in the
> failure case, so it's a more obvious pattern:
>
> + ret = sgx_inc_usage_count();
> + if (ret < 0)
> + return ret;
>

Yes, will rewrite accordingly. Especially since I have to return two different
error codes into sgx_open() now to indicate different nature of issues with
running EUDPATESVN: temporal failure due to lack of entropy (-EAGAIN)
and potentially persistent problem when getting unexpected error codes
(-EIO).

Best Regards,
Elena.