lkml.org 
[lkml]   [2024]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v9 04/15] x86/sgx: Implement basic EPC misc cgroup functionality
Date
From
On Tue, 27 Feb 2024 15:35:38 -0600, Haitao Huang  
<haitao.huang@linux.intel.com> wrote:

> On Mon, 26 Feb 2024 12:25:58 -0600, Michal Koutný <mkoutny@suse.com>
> wrote:
>
>> On Mon, Feb 05, 2024 at 01:06:27PM -0800, Haitao Huang
>> <haitao.huang@linux.intel.com> wrote:
>>> +static int sgx_epc_cgroup_alloc(struct misc_cg *cg);
>>> +
>>> +const struct misc_res_ops sgx_epc_cgroup_ops = {
>>> + .alloc = sgx_epc_cgroup_alloc,
>>> + .free = sgx_epc_cgroup_free,
>>> +};
>>> +
>>> +static void sgx_epc_misc_init(struct misc_cg *cg, struct
>>> sgx_epc_cgroup *epc_cg)
>>> +{
>>> + cg->res[MISC_CG_RES_SGX_EPC].priv = epc_cg;
>>> + epc_cg->cg = cg;
>>> +}
>>
>> This is a possibly a nit pick but I share it here for consideration.
>>
>> Would it be more prudent to have the signature like
>> alloc(struct misc_res *res, struct misc_cg *cg)
>> so that implementations are free of the assumption of how cg and res are
>> stored?
>>
>>
>> Thanks,
>> Michal
>
> Will do.
>
> Thanks
> Haitao
>
Actually, because the root node is initialized in sgx_cgroup_init(), which
only has access to misc_cg_root() so we can't pass a misc_res struct
without knowing cg->res relationship. We could hide it with a getter, but
I think it's a little overkill at the moment. I can sign up for adding
this improvement if we feel it needed in future.

Thanks
Haitao

\
 
 \ /
  Last update: 2024-05-27 15:43    [W:0.078 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site