public inbox for linux-sgx@vger.kernel.org
 help / color / mirror / Atom feed
From: "Haitao Huang" <haitao.huang@linux.intel.com>
To: "dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"tj@kernel.org" <tj@kernel.org>,
	"mkoutny@suse.com" <mkoutny@suse.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-sgx@vger.kernel.org" <linux-sgx@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"cgroups@vger.kernel.org" <cgroups@vger.kernel.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"bp@alien8.de" <bp@alien8.de>, "hpa@zytor.com" <hpa@zytor.com>,
	"Mehta, Sohil" <sohil.mehta@intel.com>,
	"tim.c.chen@linux.intel.com" <tim.c.chen@linux.intel.com>,
	"Jarkko Sakkinen" <jarkko@kernel.org>,
	"Huang, Kai" <kai.huang@intel.com>
Cc: "Li, Zhiquan1" <zhiquan1.li@intel.com>,
	"kristen@linux.intel.com" <kristen@linux.intel.com>,
	"seanjc@google.com" <seanjc@google.com>,
	"Zhang, Bo" <zhanb@microsoft.com>,
	"anakrish@microsoft.com" <anakrish@microsoft.com>,
	"mikko.ylinen@linux.intel.com" <mikko.ylinen@linux.intel.com>,
	"yangjie@microsoft.com" <yangjie@microsoft.com>,
	"chrisyan@microsoft.com" <chrisyan@microsoft.com>
Subject: Re: [PATCH v14 14/14] selftests/sgx: Add scripts for EPC cgroup testing
Date: Tue, 11 Jun 2024 07:57:19 -0500	[thread overview]
Message-ID: <op.2o7cxtg8wjvjmi@hhuan26-mobl.amr.corp.intel.com> (raw)
In-Reply-To: <eb36980a-2a81-426b-82fb-7f598f7a0037@intel.com>

On Mon, 10 Jun 2024 17:39:53 -0500, Huang, Kai <kai.huang@intel.com> 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 (!sgx_page_reclaimer_init() || !sgx_cgroup_init()) {
>>            ret = -ENOMEM;
>>            goto err_page_cache;
>>        }
>
> Does it make more sense to move the sgx_cgroup_init() to the  
> sgx_drv_init()?  The SGX cgroup only works for the driver side anyway.  
> In this case, if something went wrong in sgx_cgroup_init(), the  
> sgx_vepc_init() could still have a chance to work.
>

vepc reclamation is not done by cgroup/ksgxd but try_charge() won't work  
if user expecting cgroup to limit vepc allocation. Would it be more  
consistent to just disable vepc, i.e., on system with MISC, sgx/vepc  
always go with cgroup enabled?

> And IIUC we need to reset the "capacity" to 0 if sgx_cgroup_init()  
> fails, no matter it is called inside sgx_drv_init() or sgx_init(),  
> otherwise the "epc" would appear in the cgroup hierarchy as a misc  
> cgroup resource.
>
> Another option is to defer setting the capacity to the point where we  
> have made sure sgx_drv_init() and sgx_cgroup_init() cannot fail.
>

Yes agree we need do this.
> Btw, I plan to review the rest from late of this week or next week  
> because this week I have some other staff needs to be finished first.
>

Sure. Thanks
Haitao

  reply	other threads:[~2024-06-11 12:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-31 22:26 [PATCH v14 00/14] Add Cgroup support for SGX EPC memory Haitao Huang
2024-05-31 22:26 ` [PATCH v14 01/14] x86/sgx: Replace boolean parameters with enums Haitao Huang
2024-05-31 22:26 ` [PATCH v14 02/14] cgroup/misc: Add per resource callbacks for CSS events Haitao Huang
     [not found]   ` <eeb1f936-2989-4de0-8353-b2373ce47474@huawei.com>
2024-06-06 14:51     ` Haitao Huang
2024-06-07  1:53       ` chenridong
2024-06-07 14:23         ` Haitao Huang
2024-05-31 22:26 ` [PATCH v14 03/14] cgroup/misc: Export APIs for SGX driver Haitao Huang
2024-05-31 22:26 ` [PATCH v14 04/14] cgroup/misc: Add SGX EPC resource type Haitao Huang
2024-05-31 22:26 ` [PATCH v14 05/14] x86/sgx: Implement basic EPC misc cgroup functionality Haitao Huang
2024-05-31 22:26 ` [PATCH v14 06/14] x86/sgx: Add sgx_epc_lru_list to encapsulate LRU list Haitao Huang
2024-05-31 22:26 ` [PATCH v14 07/14] x86/sgx: Abstract tracking reclaimable pages in LRU Haitao Huang
2024-05-31 22:26 ` [PATCH v14 08/14] x86/sgx: Add basic EPC reclamation flow for cgroup Haitao Huang
2024-05-31 22:26 ` [PATCH v14 09/14] x86/sgx: Abstract check for global reclaimable pages Haitao Huang
2024-05-31 22:26 ` [PATCH v14 10/14] x86/sgx: Implement async reclamation for cgroup Haitao Huang
2024-05-31 22:26 ` [PATCH v14 11/14] x86/sgx: Charge mem_cgroup for per-cgroup reclamation Haitao Huang
2024-05-31 22:26 ` [PATCH v14 12/14] x86/sgx: Turn on per-cgroup EPC reclamation Haitao Huang
2024-05-31 22:26 ` [PATCH v14 13/14] Docs/x86/sgx: Add description for cgroup support Haitao Huang
2024-05-31 22:26 ` [PATCH v14 14/14] selftests/sgx: Add scripts for EPC cgroup testing Haitao Huang
2024-06-04 22:00   ` Jarkko Sakkinen
2024-06-05 15:33     ` Haitao Huang
2024-06-05 22:30       ` Huang, Kai
2024-06-06  6:20         ` Jarkko Sakkinen
2024-06-06  6:23           ` Jarkko Sakkinen
2024-06-06  5:32       ` Jarkko Sakkinen
2024-06-06 13:13         ` Haitao Huang
2024-06-10 22:39           ` Huang, Kai
2024-06-11 12:57             ` Haitao Huang [this message]
2024-06-11 21:56               ` Huang, Kai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.2o7cxtg8wjvjmi@hhuan26-mobl.amr.corp.intel.com \
    --to=haitao.huang@linux.intel.com \
    --cc=anakrish@microsoft.com \
    --cc=bp@alien8.de \
    --cc=cgroups@vger.kernel.org \
    --cc=chrisyan@microsoft.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jarkko@kernel.org \
    --cc=kai.huang@intel.com \
    --cc=kristen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=mikko.ylinen@linux.intel.com \
    --cc=mingo@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=seanjc@google.com \
    --cc=sohil.mehta@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tim.c.chen@linux.intel.com \
    --cc=tj@kernel.org \
    --cc=x86@kernel.org \
    --cc=yangjie@microsoft.com \
    --cc=zhanb@microsoft.com \
    --cc=zhiquan1.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox