public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: "Huang, Kai" <kai.huang@intel.com>
To: Haitao Huang <haitao.huang@linux.intel.com>,
	<dave.hansen@linux.intel.com>, <tj@kernel.org>,
	<mkoutny@suse.com>, <linux-kernel@vger.kernel.org>,
	<linux-sgx@vger.kernel.org>, <x86@kernel.org>,
	<cgroups@vger.kernel.org>, <tglx@linutronix.de>,
	<mingo@redhat.com>, <bp@alien8.de>, <hpa@zytor.com>,
	<sohil.mehta@intel.com>, <tim.c.chen@linux.intel.com>,
	Jarkko Sakkinen <jarkko@kernel.org>
Cc: <zhiquan1.li@intel.com>, <kristen@linux.intel.com>,
	<seanjc@google.com>, <zhanb@microsoft.com>,
	<anakrish@microsoft.com>, <mikko.ylinen@linux.intel.com>,
	<yangjie@microsoft.com>, <chrisyan@microsoft.com>
Subject: Re: [PATCH v14 14/14] selftests/sgx: Add scripts for EPC cgroup testing
Date: Thu, 6 Jun 2024 10:30:10 +1200	[thread overview]
Message-ID: <7cbf3583-a23e-4437-afc2-1faeb4a1f436@intel.com> (raw)
In-Reply-To: <op.2owf5xiwwjvjmi@hhuan26-mobl.amr.corp.intel.com>


>> 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;
> 
> 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 limits but we don't enforce. To keep it simple we settled 
> down back to BUG_ON(). 

[...]

> This would only happen rarely and user can add 
> command-line to disable SGX if s/he really wants to start kernel in this 
> case, just can't do SGX.

Just to be clear that I don't like BUG_ON() either.  It's inevitable you 
will get attention because of using it.

This is a compromise that you don't want to reset "capacity" to 0 when 
alloc_workqueue() fails.

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 to decide whether it is OK.

[...]

>> With "--strict" flag I also catched these:
>>
>> CHECK: spinlock_t definition without comment
>> #1308: FILE: arch/x86/kernel/cpu/sgx/sgx.h:122:
>> +    spinlock_t lock;
>>
> Yes I had a comment but Kai thought it was too obvious and I can't think 
> of a better one that's not obvious so I removed:
> 
> https://lore.kernel.org/linux-sgx/9ffb02a3344807f2c173fe8c7cb000cd6c7843b6.camel@intel.com/
>
To be clear, my reply was really about the comment itself isn't useful, 
but didn't say we shouldn't use a comment here.

> 
>> CHECK: multiple assignments should be avoided
>> #444: FILE: kernel/cgroup/misc.c:450:
>> +        parent_cg = cg = &root_cg;
>>
> 
> This was also suggested by Kai a few versions back:
> https://lore.kernel.org/linux-sgx/8f08f0b0f2b04b90d7cdb7b628f16f9080687c43.camel@intel.com/
> 

I didn't know checkpatch complains this.  Feel free to revert back as it 
is trivial to me.

  reply	other threads:[~2024-06-05 22:31 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 [this message]
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
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=7cbf3583-a23e-4437-afc2-1faeb4a1f436@intel.com \
    --to=kai.huang@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=haitao.huang@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jarkko@kernel.org \
    --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