> -----Original Message----- > From: Huang, Kai <kai.hu...@intel.com> > Sent: Tuesday, May 27, 2025 2:20 AM > To: Reshetova, Elena <elena.reshet...@intel.com>; jar...@kernel.org > Cc: Raynor, Scott <scott.ray...@intel.com>; Hansen, Dave > <dave.han...@intel.com>; mi...@kernel.org; Scarlata, Vincent R > <vincent.r.scarl...@intel.com>; x...@kernel.org; linux-...@vger.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>; > bond...@google.com; sea...@google.com; dionnagl...@google.com > Subject: Re: [PATCH v6 1/5] x86/sgx: Introduce a counter to count the > sgx_(vepc_)open() > > > > > > > > > /* > > > > diff --git a/arch/x86/kernel/cpu/sgx/main.c > > > b/arch/x86/kernel/cpu/sgx/main.c > > > > index 2de01b379aa3..a018b01b8736 100644 > > > > --- a/arch/x86/kernel/cpu/sgx/main.c > > > > +++ b/arch/x86/kernel/cpu/sgx/main.c > > > > @@ -917,6 +917,20 @@ int sgx_set_attribute(unsigned long > > > *allowed_attributes, > > > > } > > > > EXPORT_SYMBOL_GPL(sgx_set_attribute); > > > > > > > > +/* Counter to count the active SGX users */ > > > > +static atomic64_t sgx_usage_count; > > > > + > > > > +int sgx_inc_usage_count(void) > > > > +{ > > > > + atomic64_inc(&sgx_usage_count); > > > > + return 0; > > > > +} > > > > > > Maybe this was discussed but why this is not just a void-function? > > > > The last patch is cleaner if the prototype is already > > returning int here. Also error unwinding takes this into account > > right in this patch. Do you have objections to leave it as it is? > > > > > > You can clarify this in the changelog of this patch (which I also suggested in > v5).
Sure, will do. The reason I didn’t do it in v6 now is because I actually added the error handling in case error is returned in this patch, so thought it was self-explanatory, but as this comment from Jarkko shows I was wrong. Best Regards, Elena.