[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DM8PR11MB575054688AF2AC8E9B6A50A8E72AA@DM8PR11MB5750.namprd11.prod.outlook.com>
Date: Wed, 13 Aug 2025 13:56:14 +0000
From: "Reshetova, Elena" <elena.reshetova@...el.com>
To: "Huang, Kai" <kai.huang@...el.com>, "Hansen, Dave" <dave.hansen@...el.com>
CC: "seanjc@...gle.com" <seanjc@...gle.com>, "mingo@...nel.org"
<mingo@...nel.org>, "Scarlata, Vincent R" <vincent.r.scarlata@...el.com>,
"x86@...nel.org" <x86@...nel.org>, "jarkko@...nel.org" <jarkko@...nel.org>,
"Annapurve, Vishal" <vannapurve@...gle.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "Mallick, Asit K" <asit.k.mallick@...el.com>,
"Aktas, Erdem" <erdemaktas@...gle.com>, "Cai, Chong" <chongc@...gle.com>,
"Bondarevska, Nataliia" <bondarn@...gle.com>, "linux-sgx@...r.kernel.org"
<linux-sgx@...r.kernel.org>, "Raynor, Scott" <scott.raynor@...el.com>
Subject: RE: [PATCH v13 4/5] x86/sgx: Implement ENCLS[EUPDATESVN]
> -----Original Message-----
> From: Huang, Kai <kai.huang@...el.com>
> Sent: Wednesday, August 13, 2025 2:08 PM
> To: Reshetova, Elena <elena.reshetova@...el.com>; Hansen, Dave
> <dave.hansen@...el.com>
> Cc: seanjc@...gle.com; mingo@...nel.org; Scarlata, Vincent R
> <vincent.r.scarlata@...el.com>; x86@...nel.org; jarkko@...nel.org;
> Annapurve, Vishal <vannapurve@...gle.com>; linux-kernel@...r.kernel.org;
> Mallick, Asit K <asit.k.mallick@...el.com>; Aktas, Erdem
> <erdemaktas@...gle.com>; Cai, Chong <chongc@...gle.com>; Bondarevska,
> Nataliia <bondarn@...gle.com>; linux-sgx@...r.kernel.org; Raynor, Scott
> <scott.raynor@...el.com>
> Subject: Re: [PATCH v13 4/5] x86/sgx: Implement ENCLS[EUPDATESVN]
>
>
> >
> > +/* Counter to count the active SGX users */
> > +static int sgx_usage_count;
> >
>
> [...]
>
> > + * Return:
> > + * %0: - Success or not supported
> > + * %-EAGAIN: - Can be safely retried, failure is due to lack of
> > + * entropy in RNG
> > + * %-EIO: - Unexpected error, retries are not advisable
> > + */
>
> This time I actually downloaded those patches and applied to my local, and
> I found the descriptions of the error codes are not vertically aligned.
>
> Please fix (and it's sad we still need to fix this type of thing in v13).
Sorry about this, it seems like I need to change the editor, which keeps reverting
this on rebases ((
>
> Nit: as said before, the k-doc comment doc says:
>
> .. in order to produce the desired line breaks, you need to use a ReST
> list, e. g.:
>
> * Return:
> * * %0 - OK to runtime suspend the device
> * * %-EBUSY - Device should not be runtime suspended
>
> (hint: there's an additional '*' before the '%'.)
>
> But I guess it's just a nit but not a blocker.
Yes, I did go and check the kdoc style, but missed the additional '*'.
Will fix.
>
> > +static int __maybe_unused sgx_update_svn(void)
> > +{
> > + int ret;
> > +
> > + /*
> > + * If EUPDATESVN is not available, it is ok to
> > + * silently skip it to comply with legacy behavior.
> > + */
> > + if (!cpu_feature_enabled(X86_FEATURE_SGX_EUPDATESVN))
> > + return 0;
> > +
> > + /*
> > + * EPC is guaranteed to be empty when there are no users.
> > + * Ensure we are on our first user before proceeding further.
> > + */
> > + WARN(sgx_usage_count != 1, "Elevated usage count when calling
> EUPDATESVN\n");
>
> It seems you are obsessed to use "!= 1", rather than "!= 0".
>
> IIUC, Dave suggested the latter [*]:
>
> /* EPC is guaranteed to be empty when there are no users: */
> WARN(count, "Elevated usage count...");
>
> .. which is my natural response too.
>
> And the odd is I actually need to look at the next patch to see why "!= 1"
> is used.
I can change it to this version given that I change the code in the previous patch.
Thank you very much for your prompt review!
Best Regards,
Elena.
Powered by blists - more mailing lists