Re: Re: [PATCH v10 12/14] x86/sgx: Turn on per-cgroup EPC reclamation

2024-04-10 Thread Haitao Huang
On Tue, 09 Apr 2024 10:34:06 -0500, Haitao Huang wrote: On Tue, 09 Apr 2024 04:03:22 -0500, Michal Koutný wrote: On Mon, Apr 08, 2024 at 11:23:21PM -0500, Haitao Huang wrote: It's always non-NULL based on testing. It's hard for me to say definitely by reading the code. But IIUC

Re: Re: [PATCH v10 12/14] x86/sgx: Turn on per-cgroup EPC reclamation

2024-04-09 Thread Haitao Huang
On Tue, 09 Apr 2024 04:03:22 -0500, Michal Koutný wrote: On Mon, Apr 08, 2024 at 11:23:21PM -0500, Haitao Huang wrote: It's always non-NULL based on testing. It's hard for me to say definitely by reading the code. But IIUC cgroup_disable command-line only blocks operations in

Re: Re: [PATCH v10 12/14] x86/sgx: Turn on per-cgroup EPC reclamation

2024-04-09 Thread Michal Koutný
On Mon, Apr 08, 2024 at 11:23:21PM -0500, Haitao Huang wrote: > It's always non-NULL based on testing. > > It's hard for me to say definitely by reading the code. But IIUC > cgroup_disable command-line only blocks operations in /sys/fs/cgroup so user > space can't set up controllers and config

Re: [PATCH v10 12/14] x86/sgx: Turn on per-cgroup EPC reclamation

2024-04-08 Thread Haitao Huang
On Mon, 08 Apr 2024 17:37:10 -0500, Huang, Kai wrote: On 9/04/2024 6:03 am, Haitao Huang wrote: The misc root cgroup is a static similar to sgx_cg_root. So misc_cg_root() won't be NULL However, based on how css_misc() was check NULL, I suppose sgx_get_current_cg() may be NULL when

Re: [PATCH v10 12/14] x86/sgx: Turn on per-cgroup EPC reclamation

2024-04-08 Thread Huang, Kai
On 9/04/2024 6:03 am, Haitao Huang wrote: The misc root cgroup is a static similar to sgx_cg_root. So misc_cg_root()  won't be NULL However, based on how css_misc() was check NULL, I suppose sgx_get_current_cg() may be NULL when cgroup is disabled (again not 100% sure but we handle it

Re: [PATCH v10 12/14] x86/sgx: Turn on per-cgroup EPC reclamation

2024-04-08 Thread Haitao Huang
On Mon, 08 Apr 2024 07:20:23 -0500, Huang, Kai wrote: --- a/arch/x86/kernel/cpu/sgx/epc_cgroup.h +++ b/arch/x86/kernel/cpu/sgx/epc_cgroup.h @@ -28,6 +28,10 @@ static inline int sgx_cgroup_try_charge(struct sgx_cgroup *sgx_cg, enum sgx_recl static inline void sgx_cgroup_uncharge(struct

Re: [PATCH v10 12/14] x86/sgx: Turn on per-cgroup EPC reclamation

2024-04-08 Thread Huang, Kai
> --- a/arch/x86/kernel/cpu/sgx/epc_cgroup.h > +++ b/arch/x86/kernel/cpu/sgx/epc_cgroup.h > @@ -28,6 +28,10 @@ static inline int sgx_cgroup_try_charge(struct sgx_cgroup > *sgx_cg, enum sgx_recl > static inline void sgx_cgroup_uncharge(struct sgx_cgroup *sgx_cg) { } > > static inline void