[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <CZ9F33MWM7CO.2W1QSM24ZN6RM@seitikki>
Date: Mon, 19 Feb 2024 22:43:10 +0000
From: "Jarkko Sakkinen" <jarkko@...nel.org>
To: "Haitao Huang" <haitao.huang@...ux.intel.com>, "Dave Hansen"
<dave.hansen@...el.com>
Cc: <anakrish@...rosoft.com>, <bp@...en8.de>, <cgroups@...r.kernel.org>,
<chrisyan@...rosoft.com>, <dave.hansen@...ux.intel.com>, <hpa@...or.com>,
<kristen@...ux.intel.com>, <linux-kernel@...r.kernel.org>,
<linux-sgx@...r.kernel.org>, <mikko.ylinen@...ux.intel.com>,
<mingo@...hat.com>, <mkoutny@...e.com>, <seanjc@...gle.com>,
<sohil.mehta@...el.com>, <tglx@...utronix.de>,
<tim.c.chen@...ux.intel.com>, <tj@...nel.org>, <x86@...nel.org>,
<yangjie@...rosoft.com>, <zhanb@...rosoft.com>, <zhiquan1.li@...el.com>
Subject: Re: [RFC PATCH] x86/sgx: Remove 'reclaim' boolean parameters
On Mon Feb 19, 2024 at 10:25 PM UTC, Haitao Huang wrote:
> On Mon, 19 Feb 2024 14:42:29 -0600, Jarkko Sakkinen <jarkko@...nel.org>
> wrote:
>
> > On Mon Feb 19, 2024 at 3:56 PM UTC, Dave Hansen wrote:
> >> On 2/19/24 07:39, Haitao Huang wrote:
> >> > Remove all boolean parameters for 'reclaim' from the function
> >> > sgx_alloc_epc_page() and its callers by making two versions of each
> >> > function.
> >> >
> >> > Also opportunistically remove non-static declaration of
> >> > __sgx_alloc_epc_page() and a typo
> >> >
> >> > Signed-off-by: Haitao Huang <haitao.huang@...ux.intel.com>
> >> > Suggested-by: Jarkko Sakkinen <jarkko@...nel.org>
> >> > ---
> >> > arch/x86/kernel/cpu/sgx/encl.c | 56 +++++++++++++++++++++------
> >> > arch/x86/kernel/cpu/sgx/encl.h | 6 ++-
> >> > arch/x86/kernel/cpu/sgx/ioctl.c | 23 ++++++++---
> >> > arch/x86/kernel/cpu/sgx/main.c | 68
> >> ++++++++++++++++++++++-----------
> >> > arch/x86/kernel/cpu/sgx/sgx.h | 4 +-
> >> > arch/x86/kernel/cpu/sgx/virt.c | 2 +-
> >> > 6 files changed, 115 insertions(+), 44 deletions(-)
> >>
> >> Jarkko, did this turn out how you expected?
> >>
> >> I think passing around a function pointer to *only* communicate 1 bit of
> >> information is a _bit_ overkill here.
> >>
> >> Simply replacing the bool with:
> >>
> >> enum sgx_reclaim {
> >> SGX_NO_RECLAIM,
> >> SGX_DO_RECLAIM
> >> };
> >>
> >> would do the same thing. Right?
> >>
> >> Are you sure you want a function pointer for this?
> >
> > To look this in context I drafted quickly two branches representing
> > imaginary next version of the patch set.
> >
> > I guess this would simpler and totally sufficient approach.
> >
> > With this approach I'd then change also:
> >
> > [PATCH v9 04/15] x86/sgx: Implement basic EPC misc cgroup functionality
> >
> > And add the enum-parameter already in that patch with just "no reclaim"
> > enum. I.e. then 10/15 will add only "do reclaim" and the new
> > functionality.
> >
> > BR, Jarkko
> >
>
> Thanks. My understanding is:
>
> 1) For this patch, replace the boolean with the enum as Dave suggested. No
> two versions of the same functions. And this is a prerequisite for the
> cgroup series, positioned before [PATCH v9 04/15]
>
> 2) For [PATCH v9 04/15], pass a hard coded SGX_NO_RECLAIM to
> sgx_epc_cg_try_charge() from sgx_alloc_epc_page().
Yup, this will make the whole patch set also a bit leaner as the API
does not change in the middle.
>
> 3) For [PATCH v9 10/15], remove the hard coded value, pass the reclaim
> enum parameter value from sgx_alloc_epc_page() to sgx_epc_cg_try_charge()
> and add the reclaim logic.
>
> I'll send patches soon. But please let me know if I misunderstood.
BR, Jarkko
Powered by blists - more mailing lists