this page
+* (because the page is still in enclave's xarray). To prevent
+* CPU2 from loading the page, mark the page as busy.
*/
+ entry->desc |= SGX_ENCL_PAGE_BUSY;
mutex_unlock(>lock);
sgx_zap
. A
future commit will introduce a new case when the enclave page is being
removed; this new case will set only the SGX_ENCL_PAGE_BUSY flag.
LGTM.
Reviewed-by: Haitao Huang
Thanks
Haitao
On Thu, 20 Jun 2024 08:28:57 -0500, Huang, Kai wrote:
On 18/06/2024 12:53 am, Huang, Haitao wrote:
From: Kristen Carlson Accardi
Currently in the EPC page allocation, the kernel simply fails the
allocation when the current EPC cgroup fails to charge due to its usage
reaching limit. This
+ if (cgroup_subsys_enabled(misc_cgrp_subsys)) {
+ sgx_cg_wq = alloc_workqueue("sgx_cg_wq", WQ_UNBOUND |
WQ_FREEZABLE,
+ WQ_UNBOUND_MAX_ACTIVE);
+ return -ENOMEM;
Argh, missing if(!sgx_cg_wq), sorry for the brain
Hi Kai
On Thu, 20 Jun 2024 05:30:16 -0500, Huang, Kai wrote:
On 18/06/2024 12:53 am, Huang, Haitao wrote:
From: Kristen Carlson Accardi
Previous patches have implemented all infrastructure needed for
per-cgroup EPC page tracking and reclaiming. But all reclaimable EPC
pages are still
On Tue, 18 Jun 2024 18:15:37 -0500, Huang, Kai wrote:
On Tue, 2024-06-18 at 07:56 -0500, Haitao Huang wrote:
On Tue, 18 Jun 2024 06:31:09 -0500, Huang, Kai
wrote:
>
> > @@ -921,7 +956,8 @@ static int __init sgx_init(void)
> > if (!sgx_page_cache_init())
> >
On Tue, 18 Jun 2024 06:31:09 -0500, Huang, Kai wrote:
@@ -921,7 +956,8 @@ 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()) {
+
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
, just call _misc_cg_res_free(cg, MISC_CG_RES_TYPES)
to free all.
That makes sense now, Will do that.
(BTW you need comment inline :-)
Thanks
Haitao
On 2024/6/6 22:51, Haitao Huang wrote:
On Thu, 06 Jun 2024 08:37:31 -0500, chenridong
wrote:
If _misc_cg_res_alloc fails, maybe some
On Thu, 06 Jun 2024 08:37:31 -0500, chenridong
wrote:
If _misc_cg_res_alloc fails, maybe some types do not call ->alloc(), but
all types ->free() callback >will be called, is that ok?
Not sure I understand. Are you suggesting we ignore failures from
->alloc() callback in
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
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
On Tue, 28 May 2024 11:23:13 -0500, Dave Hansen
wrote:
On 5/17/24 04:06, Dmitrii Kuvaiskii wrote:
...
First, why is SGX so special here? How is the SGX problem different
than what the core mm code does?
--- a/arch/x86/kernel/cpu/sgx/encl.h
+++ b/arch/x86/kernel/cpu/sgx/encl.h
@@ -25,6
, it turns off swapping before start,
and turns swapping back on afterwards.
Add README to document how to run the tests.
Signed-off-by: Haitao Huang
Reviewed-by: Jarkko Sakkinen
Tested-by: Jarkko Sakkinen
---
V13:
- More improvement on handling error cases and style fixes.
- Add settings file
-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Cc: Sean Christopherson
Reviewed-by: Bagas Sanjaya
Reviewed-by: Jarkko Sakkinen
Acked-by: Kai Huang
Tested-by: Mikko Ylinen
Tested-by: Jarkko Sakkinen
---
V8:
- Limit text width to 80 characters to be consistent.
V6:
- Remove mentioning of VMM
-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Reviewed-by: Jarkko Sakkinen
Tested-by: Mikko Ylinen
Tested-by: Jarkko Sakkinen
---
V14:
- Update global reclamation to use the new
ing for an mm struct from enclave's mm_list.
Signed-off-by: Haitao Huang
Reported-by: Mikko Ylinen
Reviewed-by: Kai Huang
Reviewed-by: Jarkko Sakkinen
Tested-by: Mikko Ylinen
Tested-by: Jarkko Sakkinen
---
V10:
- Pass mm struct instead of a boolean 'indirect'. (Dave, Jarkko)
V9:
- Reduce num
Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Reviewed-by: Jarkko Sakkinen
Tested-by: Jarkko Sakkinen
---
V13:
- Revert to BUG_ON() in case of workq allocation failure in init and
only alloc if misc is enabled.
V11:
- Print error
PC pages are still tracked in the global LRU thus
no per-cgroup reclamation is actually active at the moment. Per-cgroup
tracking and reclamation will be turned on in the end after all
necessary infrastructure is in place.
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-o
to
sgx_can_reclaim_global().
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Reviewed-by: Jarkko Sakkinen
Reviewed-by: Kai Huang
Tested-by: Jarkko Sakkinen
---
V13:
- Rename
to
the global LRU directly.
This allows EPC page being able to be tracked in "per-cgroup" LRU when
that becomes ready.
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Cc: Sean Christopherson
Reviewed-by: Jarkko Sakkinen
Reviewed-by: Kai Huang
Tested-by: Jarkko Sakkinen
---
V6:
- removed introduction to unreclaimables in commit message.
V4:
- Removed unneeded comments for the spinlock
.
Later patches will reorganize the tracking and reclamation code in the
global reclaimer and implement per-cgroup tracking and reclaiming.
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-
From: Kristen Carlson Accardi
Add SGX EPC memory, MISC_CG_RES_SGX_EPC, to be a valid resource type
for the misc controller.
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Reviewed-by: Jarkko Sakkinen
Reviewed-by: Kai Huang
Tested-by: Jarkko
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Reviewed-by: Jarkko Sakkinen
Reviewed-by: Tejun Heo
Reviewed-by: Kai Huang
Tested-by: Jarkko Sakkinen
---
V12:
- Add comments in commit to clarify reason to pass in misc_cg, not
misc_res. (Kai)
- Remove unlikely (Kai)
V8:
- Abstract out
start a global level reclamation from the
root. Export misc_cg_root() for the SGX driver to access.
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Reviewed-by: Jarkko Sakkinen
Reviewed-by: Tejun Heo
Reviewed-by: Kai Huang
Tested-by: Jarkko
Replace boolean parameters for 'reclaim' in the function
sgx_alloc_epc_page() and its callers with an enum.
Also opportunistically remove non-static declaration of
__sgx_alloc_epc_page() and a typo
Signed-off-by: Haitao Huang
Suggested-by: Jarkko Sakkinen
Suggested-by: Dave Hansen
Reviewed
5108.5676-1-haitao.hu...@linux.intel.com/
Haitao Huang (3):
x86/sgx: Replace boolean parameters with enums
x86/sgx: Charge mem_cgroup for per-cgroup reclamation
selftests/sgx: Add scripts for EPC cgroup testing
Kristen Carlson Accardi (9):
cgroup/misc: Add per resource callbacks for CSS events
On Wed, 15 May 2024 16:55:59 -0500, Haitao Huang
wrote:
On Wed, 15 May 2024 01:55:21 -0500, Bojun Zhu
wrote:
EDMM's ioctl()s support batch operations, which may be
time-consuming. Try to explicitly give up the CPU as the prefix
operation at the every begin of "for loop" in
sg
sgx_encl_free_epc_page(epc_page);
+ sgx_free_epc_page(epc_page);
err_out_unlock:
mutex_unlock(>lock);
kfree(encl_page);
Reviewed-by: Haitao Huang
x_encl_remove_pages(struct sgx_encl
*encl,
* Do not keep encl->lock because of dependency on
* mmap_lock acquired in sgx_zap_enclave_ptes().
*/
+ entry->desc |= SGX_ENCL_PAGE_BEING_REMOVED;
mutex_unlock(>lock
On Wed, 15 May 2024 01:55:21 -0500, Bojun Zhu
wrote:
EDMM's ioctl()s support batch operations, which may be
time-consuming. Try to explicitly give up the CPU as the prefix
operation at the every begin of "for loop" in
sgx_enclave_{ modify_types | restrict_permissions | remove_pages}
to give
On Mon, 06 May 2024 19:10:42 -0500, Huang, Kai wrote:
On 1/05/2024 7:51 am, Haitao Huang wrote:
static void sgx_reclaim_pages_global(struct mm_struct *charge_mm)
{
- sgx_reclaim_pages(_global_lru, charge_mm);
+ if (IS_ENABLED(CONFIG_CGROUP_MISC
Hi Kai
Sorry there seems to be some delay in receiving my emails.
On Thu, 02 May 2024 18:23:06 -0500, Huang, Kai wrote:
On 1/05/2024 7:51 am, Haitao Huang wrote:
From: Kristen Carlson Accardi
For the global reclaimer to determine if any page available for
reclamation at the global level
-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Cc: Sean Christopherson
Reviewed-by: Bagas Sanjaya
Acked-by: Kai Huang
Tested-by: Mikko Ylinen
Tested-by: Jarkko Sakkinen
---
V8:
- Limit text width to 80 characters to be consistent.
V6:
- Remove mentioning of VMM specific behavior on handling
, it turns off swapping before start,
and turns swapping back on afterwards.
Add README to document how to run the tests.
Signed-off-by: Haitao Huang
---
V13:
- More improvement on handling error cases and style fixes.
- Add settings file for custom timeout
V12:
- Integrate the scripts
reclamation
both work properly with all pages tracked in per-cgroup LRUs.
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Tested-by: Mikko Ylinen
Tested-by: Jarkko Sakkinen
to
sgx_can_reclaim_global().
Rename sgx_should_reclaim() to sgx_should_reclaim_global() as it is used
to check if a global reclamation should be performed.
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Tested-by: Jarkko Sakkinen
---
V13:
- Revert to BUG_ON() in case of workq allocation failure in init and
only alloc if misc is enabled.
V11:
- Print error instead of WARN (Kai)
- Add check
er-cgroup reclamation is actually active at the moment. Per-cgroup
tracking and reclamation will be turned on in the end after all
necessary infrastructure is in place.
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-
to
the global LRU directly.
This allows EPC page being able to be tracked in "per-cgroup" LRU when
that becomes ready.
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Cc: Sean Christopherson
Reviewed-by: Jarkko Sakkinen
Reviewed-by: Kai Huang
Tested-by: Jarkko Sakkinen
---
V6:
- removed introduction to unreclaimables in commit message.
V4:
- Removed unneeded comments for the spinlock
ing for an mm struct from enclave's mm_list.
Signed-off-by: Haitao Huang
Reported-by: Mikko Ylinen
Reviewed-by: Kai Huang
Tested-by: Mikko Ylinen
Tested-by: Jarkko Sakkinen
---
V10:
- Pass mm struct instead of a boolean 'indirect'. (Dave, Jarkko)
V9:
- Reduce number of if statements. (Tim)
.
Later patches will reorganize the tracking and reclamation code in the
global reclaimer and implement per-cgroup tracking and reclaiming.
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-
From: Kristen Carlson Accardi
Add SGX EPC memory, MISC_CG_RES_SGX_EPC, to be a valid resource type
for the misc controller.
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Reviewed-by: Jarkko Sakkinen
Reviewed-by: Kai Huang
Tested-by: Jarkko
start a global level reclamation from the
root. Export misc_cg_root() for the SGX driver to access.
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Reviewed-by: Jarkko Sakkinen
Reviewed-by: Tejun Heo
Reviewed-by: Kai Huang
Tested-by: Jarkko
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Reviewed-by: Jarkko Sakkinen
Reviewed-by: Tejun Heo
Reviewed-by: Kai Huang
Tested-by: Jarkko Sakkinen
---
V12:
- Add comments in commit to clarify reason to pass in misc_cg, not
misc_res. (Kai)
- Remove unlikely (Kai)
V8:
- Abstract out
rg/lkml/20240410182558.41467-1-haitao.hu...@linux.intel.com/
[17]v12:
https://lore.kernel.org/lkml/20240416032011.58578-1-haitao.hu...@linux.intel.com/
Haitao Huang (3):
x86/sgx: Replace boolean parameters with enums
x86/sgx: Charge mem_cgroup for per-cgroup reclamation
selftests/sgx: Add scripts for EPC
Replace boolean parameters for 'reclaim' in the function
sgx_alloc_epc_page() and its callers with an enum.
Also opportunistically remove non-static declaration of
__sgx_alloc_epc_page() and a typo
Signed-off-by: Haitao Huang
Suggested-by: Jarkko Sakkinen
Suggested-by: Dave Hansen
Reviewed
On Mon, 29 Apr 2024 17:18:05 -0500, Huang, Kai wrote:
/*
@@ -42,7 +63,8 @@ static inline struct sgx_epc_lru_list
*sgx_lru_list(struct sgx_epc_page *epc_pag
*/
static inline bool sgx_can_reclaim(void)
{
-return !list_empty(_global_lru.reclaimable);
+return
On Mon, 29 Apr 2024 11:43:05 -0500, Jarkko Sakkinen
wrote:
On Mon Apr 29, 2024 at 7:18 PM EEST, Haitao Huang wrote:
Hi Jarkko
On Sun, 28 Apr 2024 17:03:17 -0500, Jarkko Sakkinen
wrote:
> On Fri Apr 26, 2024 at 5:28 PM EEST, Dave Hansen wrote:
>> On 4/16/24 07:15, Jarkko Sakki
Hi Jarkko
On Sun, 28 Apr 2024 17:03:17 -0500, Jarkko Sakkinen
wrote:
On Fri Apr 26, 2024 at 5:28 PM EEST, Dave Hansen wrote:
On 4/16/24 07:15, Jarkko Sakkinen wrote:
> On Tue Apr 16, 2024 at 8:42 AM EEST, Huang, Kai wrote:
> Yes, exactly. I'd take one week break and cycle the kselftest
On Mon, 29 Apr 2024 05:49:13 -0500, Huang, Kai wrote:
+/*
+ * Get the per-cgroup or global LRU list that tracks the given
reclaimable page.
+ */
static inline struct sgx_epc_lru_list *sgx_lru_list(struct
sgx_epc_page *epc_page)
{
+#ifdef CONFIG_CGROUP_MISC
+ /*
+*
Hi Jarkko
On Tue, 16 Apr 2024 11:08:11 -0500, Jarkko Sakkinen
wrote:
On Tue Apr 16, 2024 at 5:54 PM EEST, Haitao Huang wrote:
I did declare the configs in the config file but I missed it in my patch
as stated earlier. IIUC, that would not cause this error though.
Maybe I should exit
On Tue, 23 Apr 2024 17:13:15 -0500, Huang, Kai wrote:
On Tue, 2024-04-23 at 10:30 -0500, Haitao Huang wrote:
> > It's a workaround because you use the capacity==0 but it does not
really
> > mean to disable the misc cgroup for specific resource IIUC.
>
> Please read
On Wed, 17 Apr 2024 18:51:28 -0500, Huang, Kai wrote:
On 16/04/2024 3:20 pm, Haitao Huang wrote:
From: Kristen Carlson Accardi
Currently in the EPC page allocation, the kernel simply fails the
allocation when the current EPC cgroup fails to charge due to its usage
reaching limit
On Tue, 23 Apr 2024 09:19:53 -0500, Huang, Kai wrote:
On Tue, 2024-04-23 at 08:08 -0500, Haitao Huang wrote:
On Mon, 22 Apr 2024 17:16:34 -0500, Huang, Kai
wrote:
> On Mon, 2024-04-22 at 11:17 -0500, Haitao Huang wrote:
> > On Sun, 21 Apr 2024 19:22:27 -0500, Huang, Kai
On Mon, 22 Apr 2024 17:16:34 -0500, Huang, Kai wrote:
On Mon, 2024-04-22 at 11:17 -0500, Haitao Huang wrote:
On Sun, 21 Apr 2024 19:22:27 -0500, Huang, Kai
wrote:
> On Fri, 2024-04-19 at 20:14 -0500, Haitao Huang wrote:
> > > > I think we can add support for "
Hi Jarkko
On Mon, 15 Apr 2024 14:08:44 -0500, Jarkko Sakkinen
wrote:
I did run the basic test by manually creating the cgroup so you could
add tested-by from my side to the other kernel patches expect this one
I've reviewed it enough rounds and given various code suggestions etc.
For me
On Sun, 21 Apr 2024 19:22:27 -0500, Huang, Kai wrote:
On Fri, 2024-04-19 at 20:14 -0500, Haitao Huang wrote:
> > I think we can add support for "sgx_cgroup=disabled" in future if
indeed
> > needed. But just for init failure, no?
> >
>
> It's not about
On Fri, 19 Apr 2024 17:44:59 -0500, Huang, Kai wrote:
On Fri, 2024-04-19 at 13:55 -0500, Haitao Huang wrote:
On Thu, 18 Apr 2024 20:32:14 -0500, Huang, Kai
wrote:
>
>
> On 16/04/2024 3:20 pm, Haitao Huang wrote:
> > From: Kristen Carlson Accardi
> > In cases EPC pa
On Thu, 18 Apr 2024 20:32:14 -0500, Huang, Kai wrote:
On 16/04/2024 3:20 pm, Haitao Huang wrote:
From: Kristen Carlson Accardi
In cases EPC pages need be allocated during a page fault and the cgroup
usage is near its limit, an asynchronous reclamation needs be triggered
to avoid blocking
On Thu, 18 Apr 2024 18:29:53 -0500, Huang, Kai wrote:
--- /dev/null
+++ b/arch/x86/kernel/cpu/sgx/epc_cgroup.h
@@ -0,0 +1,72 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _SGX_EPC_CGROUP_H_
+#define _SGX_EPC_CGROUP_H_
+
+#include
I don't see why you need here. Also, ...
On Tue, 16 Apr 2024 08:22:06 -0500, Huang, Kai wrote:
On Mon, 2024-04-15 at 20:20 -0700, Haitao Huang wrote:
From: Kristen Carlson Accardi
SGX Enclave Page Cache (EPC) memory allocations are separate from normal
RAM allocations, and are managed solely by the SGX subsystem. The
existing
On Tue, 16 Apr 2024 17:21:24 -0500, Haitao Huang
wrote:
On Tue, 16 Apr 2024 17:04:21 -0500, Haitao Huang
wrote:
On Tue, 16 Apr 2024 11:08:11 -0500, Jarkko Sakkinen
wrote:
On Tue Apr 16, 2024 at 5:54 PM EEST, Haitao Huang wrote:
I did declare the configs in the config file but I
On Tue, 16 Apr 2024 09:07:33 -0500, Huang, Kai wrote:
On Mon, 2024-04-15 at 20:20 -0700, Haitao Huang wrote:
From: Kristen Carlson Accardi
The functions, sgx_{mark,unmark}_page_reclaimable(), manage the tracking
of reclaimable EPC pages: sgx_mark_page_reclaimable() adds a newly
allocated
On Mon, 15 Apr 2024 22:20:02 -0500, Haitao Huang
wrote:
diff --git a/arch/x86/kernel/cpu/sgx/Makefile
b/arch/x86/kernel/cpu/sgx/Makefile
index 9c1656779b2a..400baa7cfb69 100644
--- a/arch/x86/kernel/cpu/sgx/Makefile
+++ b/arch/x86/kernel/cpu/sgx/Makefile
@@ -1,6 +1,7 @@
obj-y
On Tue, 16 Apr 2024 17:04:21 -0500, Haitao Huang
wrote:
On Tue, 16 Apr 2024 11:08:11 -0500, Jarkko Sakkinen
wrote:
On Tue Apr 16, 2024 at 5:54 PM EEST, Haitao Huang wrote:
I did declare the configs in the config file but I missed it in my
patch
as stated earlier. IIUC, that would
On Tue, 16 Apr 2024 11:08:11 -0500, Jarkko Sakkinen
wrote:
On Tue Apr 16, 2024 at 5:54 PM EEST, Haitao Huang wrote:
I did declare the configs in the config file but I missed it in my patch
as stated earlier. IIUC, that would not cause this error though.
Maybe I should exit with the skip
On Tue, 16 Apr 2024 00:42:41 -0500, Huang, Kai wrote:
I'll send a fixup for this patch or another version of the series if
more
changes are needed.
Hi Haitao,
I don't like to say but in general I think you are sending too
frequently. The
last version was sent April, 11th (my time),
On Tue, 16 Apr 2024 09:10:12 -0500, Jarkko Sakkinen
wrote:
On Tue Apr 16, 2024 at 5:05 PM EEST, Jarkko Sakkinen wrote:
On Tue Apr 16, 2024 at 6:20 AM EEST, Haitao Huang wrote:
> With different cgroups, the script starts one or multiple concurrent
SGX
> selftests (test_sgx), each
Missed adding the config file:
index ..e7f1db1d3eff
--- /dev/null
+++ b/tools/testing/selftests/sgx/config
@@ -0,0 +1,4 @@
+CONFIG_CGROUPS=y
+CONFIG_CGROUP_MISC=y
+CONFIG_MEMCG=y
+CONFIG_X86_SGX=y
I'll send a fixup for this patch or another version of the series if more
changes
, it turns off swapping before start,
and turns swapping back on afterwards.
Add README to document how to run the tests.
Signed-off-by: Haitao Huang
---
V12:
- Integrate the scripts to the "run_tests" target. (Jarkko)
V11:
- Remove cgroups-tools dependency and make scripts ash
-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Cc: Sean Christopherson
Tested-by: Mikko Ylinen
Tested-by: Jarkko Sakkinen
---
V8:
- Limit text width to 80 characters to be consistent.
V6:
- Remove mentioning of VMM specific behavior on handling SIGBUS
- Remove statement of forced reclamation
both work properly with all pages tracked in per-cgroup LRUs.
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Tested-by: Mikko Ylinen
Tested-by: Jarkko Sakkinen
---
V12
-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Tested-by: Jarkko Sakkinen
---
V10:
- Add comments for the new function. (Jarkko)
V7:
- Split this out from the big patch, #10
er-cgroup reclamation is actually active at the moment. Per-cgroup
tracking and reclamation will be turned on in the end after all
necessary infrastructure is in place.
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-b
ing for an mm struct from enclave's mm_list.
Signed-off-by: Haitao Huang
Reported-by: Mikko Ylinen
Tested-by: Mikko Ylinen
Tested-by: Jarkko Sakkinen
---
V10:
- Pass mm struct instead of a boolean 'indirect'. (Dave, Jarkko)
V9:
- Reduce number of if statements. (Tim)
V8:
- Limit text paragraphs to
in
sgx_alloc_epc_pages().
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Tested-by: Jarkko Sakkinen
---
V11:
- Print error instead of WARN (Kai)
- Add check for need to queue an async
-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Reviewed-by: Jarkko Sakkinen
Tested-by: Jarkko Sakkinen
---
V7:
- Split this out from the big patch, #10 in V6. (Dave, Kai)
---
arch/x86
.
Later patches will reorganize the tracking and reclamation code in the
global reclaimer and implement per-cgroup tracking and reclaiming.
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-of
Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Cc: Sean Christopherson
Reviewed-by: Jarkko Sakkinen
Reviewed-by: Kai Huang
Tested-by: Jarkko Sakkinen
---
V6:
- removed introduction to unreclaimables in commit message.
V4:
- Removed unneeded comments for the spinlock
From: Kristen Carlson Accardi
Add SGX EPC memory, MISC_CG_RES_SGX_EPC, to be a valid resource type
for the misc controller.
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Reviewed-by: Jarkko Sakkinen
Reviewed-by: Kai Huang
Tested-by: Jarkko
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Reviewed-by: Jarkko Sakkinen
Reviewed-by: Tejun Heo
Reviewed-by: Kai Huang
Tested-by: Jarkko Sakkinen
---
V12:
- Add comments in commit to clarify reason to pass in misc_cg, not
misc_res. (Kai)
- Remove unlikely (Kai)
V8:
- Abstract out
start a global level reclamation from the
root. Export misc_cg_root() for the SGX driver to access.
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Reviewed-by: Jarkko Sakkinen
Reviewed-by: Tejun Heo
Reviewed-by: Kai Huang
Tested-by: Jarkko
Replace boolean parameters for 'reclaim' in the function
sgx_alloc_epc_page() and its callers with an enum.
Also opportunistically remove non-static declaration of
__sgx_alloc_epc_page() and a typo
Signed-off-by: Haitao Huang
Suggested-by: Jarkko Sakkinen
Suggested-by: Dave Hansen
Reviewed
nux-sgx/20240328002229.30264-1-haitao.hu...@linux.intel.com/T/#t
[16]v11:
https://lore.kernel.org/lkml/20240410182558.41467-1-haitao.hu...@linux.intel.com/
Haitao Huang (3):
x86/sgx: Replace boolean parameters with enums
x86/sgx: Charge mem_cgroup for per-cgroup reclamation
selftests/sgx: Add scripts
On Mon, 15 Apr 2024 14:08:44 -0500, Jarkko Sakkinen
wrote:
On Mon Apr 15, 2024 at 6:13 AM EEST, Haitao Huang wrote:
On Sun, 14 Apr 2024 10:01:03 -0500, Jarkko Sakkinen
wrote:
> On Wed Apr 10, 2024 at 9:25 PM EEST, Haitao Huang wrote:
>> To run selftests for EPC cgroup:
&
On Sat, 13 Apr 2024 16:34:17 -0500, Jarkko Sakkinen
wrote:
On Wed Apr 10, 2024 at 9:25 PM EEST, Haitao Huang wrote:
To run selftests for EPC cgroup:
sudo ./run_epc_cg_selftests.sh
To watch misc cgroup 'current' changes during testing, run this in a
separate terminal
On Sun, 14 Apr 2024 10:01:03 -0500, Jarkko Sakkinen
wrote:
On Wed Apr 10, 2024 at 9:25 PM EEST, Haitao Huang wrote:
To run selftests for EPC cgroup:
sudo ./run_epc_cg_selftests.sh
To watch misc cgroup 'current' changes during testing, run this in a
separate terminal
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
-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Cc: Sean Christopherson
---
V8:
- Limit text width to 80 characters to be consistent.
V6:
- Remove mentioning of VMM specific behavior on handling SIGBUS
- Remove statement of forced reclamation, add statement to specify
ENOMEM returned when
processes exit.
The script also includes a test with low mem_cg limit and LARGE sgx_epc
limit to verify that the RAM used for per-cgroup reclamation is charged
to a proper mem_cg. For this test, it turns off swapping before start,
and turns swapping back on afterwards.
Signed-off-by: Haitao Huang
-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
---
V10:
- Add comments for the new function. (Jarkko)
V7:
- Split this out from the big patch, #10 in V6. (Dave, Kai)
---
arch
both work properly with all pages tracked in per-cgroup LRUs.
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
---
V11:
- Reword the comments for global reclamation
in
sgx_alloc_epc_pages().
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
---
V11:
- Print error instead of WARN (Kai)
- Add check for need to queue an async reclamation before returning from
er-cgroup reclamation is actually active at the moment. Per-cgroup
tracking and reclamation will be turned on in the end after all
necessary infrastructure is in place.
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed
ing for an mm struct from enclave's mm_list.
Signed-off-by: Haitao Huang
Reported-by: Mikko Ylinen
---
V10:
- Pass mm struct instead of a boolean 'indirect'. (Dave, Jarkko)
V9:
- Reduce number of if statements. (Tim)
V8:
- Limit text paragraphs to 80 characters wide. (Jarkko)
---
arch/x86/kernel/
-by: Sean Christopherson
Signed-off-by: Sean Christopherson
Signed-off-by: Kristen Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Reviewed-by: Jarkko Sakkinen
---
V7:
- Split this out from the big patch, #10 in V6. (Dave, Kai)
---
arch/x86/kernel/cpu/sgx/main.c | 30
Carlson Accardi
Co-developed-by: Haitao Huang
Signed-off-by: Haitao Huang
Cc: Sean Christopherson
Reviewed-by: Jarkko Sakkinen
---
V6:
- removed introduction to unreclaimables in commit message.
V4:
- Removed unneeded comments for the spinlock and the non-reclaimables.
(Kai, Jarkko)
- Revised
1 - 100 of 358 matches
Mail list logo