[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8d67cbcff50370e2b40d6229b6106f51883a7907.camel@intel.com>
Date: Sun, 10 Aug 2025 23:29:47 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "Reshetova, Elena" <elena.reshetova@...el.com>, "Hansen, Dave"
<dave.hansen@...el.com>
CC: "linux-sgx@...r.kernel.org" <linux-sgx@...r.kernel.org>,
"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>, "seanjc@...gle.com"
<seanjc@...gle.com>, "Raynor, Scott" <scott.raynor@...el.com>
Subject: Re: [PATCH v11 1/5] x86/sgx: Introduce functions to count the
sgx_(vepc_)open()
On Fri, 2025-08-08 at 10:47 +0000, Reshetova, Elena wrote:
> >
> > > diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c
> > > index 308dbbae6c6e..cf149b9f4916 100644
> > > --- a/arch/x86/kernel/cpu/sgx/encl.c
> > > +++ b/arch/x86/kernel/cpu/sgx/encl.c
> > > @@ -765,6 +765,7 @@ void sgx_encl_release(struct kref *ref)
> > > WARN_ON_ONCE(encl->secs.epc_page);
> > >
> > > kfree(encl);
> > > + sgx_dec_usage_count();
> > > }
> > >
> > >
> >
> > [...]
> >
> > > --- a/arch/x86/kernel/cpu/sgx/virt.c
> > > +++ b/arch/x86/kernel/cpu/sgx/virt.c
> > > @@ -255,10 +255,11 @@ static int sgx_vepc_release(struct inode *inode,
> > struct file *file)
> > > xa_destroy(&vepc->page_array);
> > > kfree(vepc);
> > >
> > > + sgx_dec_usage_count();
> > > return 0;
> > > }
> >
> > Given we have __sgx_(vepc_)open(), I think it makes more sense to have
> > __sgx_(encl_|vepc_)release() counterpart?
>
> Is it worth it? In case of *_open() variants there are quite error handling
> under different cases, but for release as you can see it is just a one-line
> addition. Not sure it is worth adding the wrappers just for that.
> But I can change it if people think it would look better this way.
Either way is fine to me. Feel free to ignore.
Powered by blists - more mailing lists