Re: [PATCH v14 14/14] selftests/sgx: Add scripts for EPC cgroup testing

2024-06-11 Thread Huang, Kai
On Tue, 2024-06-11 at 07:57 -0500, Haitao Huang wrote: > On Mon, 10 Jun 2024 17:39:53 -0500, Huang, Kai wrote: > > > > > > --- a/arch/x86/kernel/cpu/sgx/main.c > > > +++ b/arch/x86/kernel/cpu/sgx/main.c > > > @@ -1045,7 +1045,7 @@ static int __init sgx_init(void) > > >if

Re: [PATCH v14 14/14] selftests/sgx: Add scripts for EPC cgroup testing

2024-06-11 Thread Haitao Huang
On Mon, 10 Jun 2024 17:39:53 -0500, Huang, Kai wrote: --- a/arch/x86/kernel/cpu/sgx/main.c +++ b/arch/x86/kernel/cpu/sgx/main.c @@ -1045,7 +1045,7 @@ static int __init sgx_init(void) if (!sgx_page_cache_init()) return -ENOMEM; -if (!sgx_page_reclaimer_init()) { +if

Re: [PATCH v14 14/14] selftests/sgx: Add scripts for EPC cgroup testing

2024-06-10 Thread Huang, Kai
--- a/arch/x86/kernel/cpu/sgx/main.c +++ b/arch/x86/kernel/cpu/sgx/main.c @@ -1045,7 +1045,7 @@ static int __init sgx_init(void) if (!sgx_page_cache_init()) return -ENOMEM; -if (!sgx_page_reclaimer_init()) { +if (!sgx_page_reclaimer_init() || !sgx_cgroup_init()) {

Re: [PATCH v14 14/14] selftests/sgx: Add scripts for EPC cgroup testing

2024-06-06 Thread Haitao Huang
On Thu, 06 Jun 2024 00:32:55 -0500, Jarkko Sakkinen wrote: On Wed Jun 5, 2024 at 6:33 PM EEST, Haitao Huang wrote: sgx_cgroup_try_charge() expects sgx_cg_wq, so it would break unless we check and return 0 which was the initially implemented in v12. But then Kai had some concern on that we

Re: [PATCH v14 14/14] selftests/sgx: Add scripts for EPC cgroup testing

2024-06-06 Thread Jarkko Sakkinen
On Thu Jun 6, 2024 at 9:20 AM EEST, Jarkko Sakkinen wrote: > > There are existing code where BUG_ON() is used during the kernel early > > boot code when memory allocation fails (e.g., see cgroup_init_subsys()), > > so it might be acceptable to use BUG_ON() here, but it's up to > > maintainers

Re: [PATCH v14 14/14] selftests/sgx: Add scripts for EPC cgroup testing

2024-06-06 Thread Jarkko Sakkinen
On Thu Jun 6, 2024 at 1:30 AM EEST, Huang, Kai wrote: > > >> Reorg: > >> > >> void sgx_cgroup_init(void) > >> { > >> struct workqueue_struct *wq; > >> > >> /* eagerly allocate the workqueue: */ > >> wq = alloc_workqueue("sgx_cg_wq", wq_unbound | wq_freezable, > >>

Re: [PATCH v14 14/14] selftests/sgx: Add scripts for EPC cgroup testing

2024-06-05 Thread Jarkko Sakkinen
On Wed Jun 5, 2024 at 6:33 PM EEST, Haitao Huang wrote: > sgx_cgroup_try_charge() expects sgx_cg_wq, so it would break unless we > check and return 0 which was the initially implemented in v12. But then > Kai had some concern on that we expose all the interface files to allow > user to set

Re: [PATCH v14 14/14] selftests/sgx: Add scripts for EPC cgroup testing

2024-06-05 Thread Huang, Kai
Reorg: void sgx_cgroup_init(void) { struct workqueue_struct *wq; /* eagerly allocate the workqueue: */ wq = alloc_workqueue("sgx_cg_wq", wq_unbound | wq_freezable, wq_unbound_max_active); if (!wq) {     pr_warn("sgx_cg_wq creation failed\n");     return;

Re: [PATCH v14 14/14] selftests/sgx: Add scripts for EPC cgroup testing

2024-06-05 Thread Haitao Huang
Hi Jarkko Thanks for your review. On Tue, 04 Jun 2024 17:00:34 -0500, Jarkko Sakkinen wrote: On Sat Jun 1, 2024 at 1:26 AM EEST, Haitao Huang wrote: With different cgroups, the script starts one or multiple concurrent SGX selftests (test_sgx), each to run the

Re: [PATCH v14 14/14] selftests/sgx: Add scripts for EPC cgroup testing

2024-06-04 Thread Jarkko Sakkinen
On Sat Jun 1, 2024 at 1:26 AM EEST, Haitao Huang wrote: > With different cgroups, the script starts one or multiple concurrent SGX > selftests (test_sgx), each to run the unclobbered_vdso_oversubscribed > test case, which loads an enclave of EPC size equal to the EPC capacity > available on the

[PATCH v14 14/14] selftests/sgx: Add scripts for EPC cgroup testing

2024-05-31 Thread Haitao Huang
With different cgroups, the script starts one or multiple concurrent SGX selftests (test_sgx), each to run the unclobbered_vdso_oversubscribed test case, which loads an enclave of EPC size equal to the EPC capacity available on the platform. The script checks results against the expectation set