Re: [PATCH v6 04/12] x86/sgx: Implement basic EPC misc cgroup functionality

2023-11-26 Thread Haitao Huang
On Mon, 27 Nov 2023 00:01:56 +0800, Haitao Huang wrote: > > > > Then here we can have something like: > > > > > > > > void sgx_reclaim_pages(struct sgx_epc_cg *epc_cg) > > > > { > > > > struct sgx_epc_lru_list *lru = epc_cg ? _cg->lru : > > > >

Re: [PATCH v6 04/12] x86/sgx: Implement basic EPC misc cgroup functionality

2023-11-26 Thread Haitao Huang
On Mon, 20 Nov 2023 11:16:42 +0800, Huang, Kai wrote: > > > > That's true. I was thinking no need to have them done in separate calls. > The caller has to check the return value for epc_cg instance first, then > check result of try_charge. But there is really only one caller, >

Re: [PATCH v6 04/12] x86/sgx: Implement basic EPC misc cgroup functionality

2023-11-19 Thread Huang, Kai
> > > > > > > That's true. I was thinking no need to have them done in separate calls. > > The caller has to check the return value for epc_cg instance first, then > > check result of try_charge. But there is really only one caller, > > sgx_alloc_epc_page() below, so I don't have strong

Re: [PATCH v6 04/12] x86/sgx: Implement basic EPC misc cgroup functionality

2023-11-15 Thread Jarkko Sakkinen
On Mon Oct 30, 2023 at 8:20 PM EET, Haitao Huang wrote: > From: Kristen Carlson Accardi > > Implement support for cgroup control of SGX Enclave Page Cache (EPC) > memory using the misc cgroup controller. EPC memory is independent > from normal system memory, e.g. must be reserved at boot from RAM

RE: [PATCH v6 04/12] x86/sgx: Implement basic EPC misc cgroup functionality

2023-11-07 Thread Huang, Kai
> I should have sticked to the orignial comment added in code. Actually > __sgx_alloc_epc_page() can fail if system runs out of EPC. That's the really > reason > for global reclaim. The free count enforcement is near the end of this method > after should_reclaim() check. Hi Haitao, Sorry I have

Re: [PATCH v6 04/12] x86/sgx: Implement basic EPC misc cgroup functionality

2023-11-06 Thread Haitao Huang
On Mon, 06 Nov 2023 19:16:30 -0600, Haitao Huang wrote: On Mon, 06 Nov 2023 16:18:30 -0600, Huang, Kai wrote: > > +/** > > + * sgx_epc_cgroup_try_charge() - hierarchically try to charge a single > > EPC page > > + * > > + * Returns EPC cgroup or NULL on success, -errno on failure. >

Re: [PATCH v6 04/12] x86/sgx: Implement basic EPC misc cgroup functionality

2023-11-06 Thread Haitao Huang
On Mon, 06 Nov 2023 16:18:30 -0600, Huang, Kai wrote: > > +/** > > + * sgx_epc_cgroup_try_charge() - hierarchically try to charge a single > > EPC page > > + * > > + * Returns EPC cgroup or NULL on success, -errno on failure. > > + */ > > +struct sgx_epc_cgroup

Re: [PATCH v6 04/12] x86/sgx: Implement basic EPC misc cgroup functionality

2023-11-06 Thread Huang, Kai
On Mon, 2023-10-30 at 11:20 -0700, Haitao Huang wrote: > +static int __init sgx_epc_cgroup_init(void) > +{ > + struct misc_cg *cg; > + > + if (!boot_cpu_has(X86_FEATURE_SGX)) > + return 0; > + > + cg = misc_cg_root(); > + BUG_ON(!cg); > + > + return

Re: [PATCH v6 04/12] x86/sgx: Implement basic EPC misc cgroup functionality

2023-11-06 Thread Huang, Kai
> > > > +/** > > > + * sgx_epc_cgroup_try_charge() - hierarchically try to charge a single > > > EPC page > > > + * > > > + * Returns EPC cgroup or NULL on success, -errno on failure. > > > + */ > > > +struct sgx_epc_cgroup *sgx_epc_cgroup_try_charge(void) > > > +{ > > > + struct sgx_epc_cgroup

Re: [PATCH v6 04/12] x86/sgx: Implement basic EPC misc cgroup functionality

2023-11-06 Thread Haitao Huang
On Mon, 06 Nov 2023 06:09:45 -0600, Huang, Kai wrote: On Mon, 2023-10-30 at 11:20 -0700, Haitao Huang wrote: From: Kristen Carlson Accardi Implement support for cgroup control of SGX Enclave Page Cache (EPC) memory using the misc cgroup controller. EPC memory is independent from normal

Re: [PATCH v6 04/12] x86/sgx: Implement basic EPC misc cgroup functionality

2023-11-06 Thread Huang, Kai
On Mon, 2023-10-30 at 11:20 -0700, Haitao Huang wrote: > From: Kristen Carlson Accardi > > Implement support for cgroup control of SGX Enclave Page Cache (EPC) > memory using the misc cgroup controller. EPC memory is independent > from normal system memory, e.g. must be reserved at boot from RAM