From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "Huang, Kai" <kai.huang@intel.com>,
"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>
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, 06 Jun 2024 09:20:16 +0300 [thread overview]
Message-ID: <D1SPTDBBDU6F.2WLRZKYZWWTRB@kernel.org> (raw)
In-Reply-To: <7cbf3583-a23e-4437-afc2-1faeb4a1f436@intel.com>
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,
> >> 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.
Just then plain disable SGX if it fails to start.
Do not take down the whole system.
> This is a compromise that you don't want to reset "capacity" to 0 when
> alloc_workqueue() fails.
BUG_ON() is not a "compromise".
> 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.
When it is not possible continue to run the system at all, and only
then.
Here it is possible. Without SGX.
BR, Jarkko
next prev parent reply other threads:[~2024-06-06 6:20 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 [this message]
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=D1SPTDBBDU6F.2WLRZKYZWWTRB@kernel.org \
--to=jarkko@kernel.org \
--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=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