Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1884550rdf; Sun, 5 Nov 2023 19:27:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IEMZMI4SCcFdg4prqx+4Yr4Rx3Ngq8eXvCyA7LeSIl+OMyAHqMV65MjJ2zm9fQlVNA1Yenw X-Received: by 2002:a67:b20a:0:b0:45e:7768:6e1a with SMTP id b10-20020a67b20a000000b0045e77686e1amr3292743vsf.15.1699241226496; Sun, 05 Nov 2023 19:27:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699241226; cv=none; d=google.com; s=arc-20160816; b=ep8ml163+Zu2NNUlCQydOOvXnSYhXhzIF03fiBlz2fMVJAWK/EmXPgP12olEpHekqV bAFqnZmv9R57JbGteAg0tNaI9Seeb66lI5uhw20V+yLpxBVRIEFoIoQuCXgsBu06AebB yPWaMwATovFq/i4/0Qg+RzjM1lfUoDjxzf6DNwBcGva3k9Qy51/LHlf2S4IViOJIKV8q 44Q/+vBgpWe3hWauWmQI4vNTO2zPJhgaTMgzEe+qTW4aneyXXn+H+eZ1DZC0/nZf7giQ LHbX3HKk/yYMsmh8L4AL8opZmKqGeEWGbwJ03XYpglOgornataMyPZDHHtvSu1x8OnLD Wa1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:autocrypt:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=16hEpJyK4t6U7gx49fwTY6bI15ZJiHsgzXQDYDHEELE=; fh=ZbVEoBaXVK//4rb2ef3FJ1cfANOhHqLXa3p2YL3GLNM=; b=yE75f18MmGeyJWngXk5HZFSUeJF8elhX+ckhc3a4559OK36g6mtFo9WoyufhqFJVDu G4tDfxmGhHtjljh3pWx10PVl9c88SAyS1zv2RB1cIDFVcsOK402RKzPu4eaixbuX94Xs sJdhfqE27EGq3tx7RAlAZq5Vh2ljriZ3UTta5iTKLTj2/18Hj2inS1/ZUVXS6ZTwcYN6 k7FgEY2KGUTw2ENRs7n5bXb9UF9ZOWdZBh4wv/HM2hcQ7ljZlI5oLfD0hbull3+Z4Cf4 fCWeZMTsSHiM8N9TMI/E7Cdi7FPAUffKY2wKLWNiLxYyGRt6/qqFMiph9kGdhxmPp8wU rHow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="PXTLJ/mX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id n3-20020a632703000000b00577f4d85fdbsi7661137pgn.548.2023.11.05.19.27.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 19:27:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="PXTLJ/mX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 8F708805800B; Sun, 5 Nov 2023 19:26:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230180AbjKFD0z (ORCPT + 99 others); Sun, 5 Nov 2023 22:26:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230117AbjKFD0y (ORCPT ); Sun, 5 Nov 2023 22:26:54 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36E3BFB; Sun, 5 Nov 2023 19:26:51 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7787C433C9; Mon, 6 Nov 2023 03:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699241210; bh=16hEpJyK4t6U7gx49fwTY6bI15ZJiHsgzXQDYDHEELE=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=PXTLJ/mX6yE/jYLi6RbCsBx4yIXEgI0n3lsYK6FY08SbW9f8vYCByzPywC6hW4+vp qiEG4b7fGCVB/3YWjuh25f+lRX73XGbO5IKHQVoLNn8zFfJR24quxvPUb8fqM6i0gS J6GnBUwPmVqyVvjNSVw0QaP4u6jnU2int4YlF3GrvCB/EOpd6pFUa7+u/oaS6k1a3q hP/F2IP78ShycL4U3hs2n/dgGFedGsGgKfOo46oO1Fot4ZfHtIR/4Al+uFiPwBbi9m iUDBQsukSzgMCZlLXiorM3hESZ8EfCtGMQJPpQH8wb5gEvURI2q7CJiYZ5pnL/2NMs Z4Cm3uJoLe8RA== Message-ID: Subject: Re: [PATCH v6 00/12] Add Cgroup support for SGX EPC memory From: Jarkko Sakkinen To: Haitao Huang , 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 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 Date: Mon, 06 Nov 2023 05:26:44 +0200 In-Reply-To: <20231030182013.40086-1-haitao.huang@linux.intel.com> References: <20231030182013.40086-1-haitao.huang@linux.intel.com> Autocrypt: addr=jarkko@kernel.org; prefer-encrypt=mutual; keydata=mQINBF0RXVoBEACq7dxNqGliHRIUjKeA0Ajj8R0JiNRbhayBAmCmjfDh6m/QTNfyCmFBv6ZPe4EbBEyCgcFxerS0qgkaRD0FApKgtrX842rkwDyyhTA222rkv5Q/U2SY1Hi55kekBcAgYHVQzhvHnRrckvE7YxDlH06mnUGlL63s9NI/xnhtJvn92rLNvWqAyn+48Ud/EcE9oBo6vvq10O0UAHN/PEsyqtThN9tlTEKH8IMXmy1FAC70Ov8Ap63ZJT2RE7H4wbIYrHOOxarfHaKHcKy+UjZBhuQ54sGxxch2kXQCfkXOY7Ab7KKNkb4u2jDc6lyz8TJlc8Twi5KQcWBzomnYy5R0OJ01g6byY7vCSwAfCSp87P50F5O2pmjqd82mdB3Noy+CWIlV1kjMjaJglTyFGym7CWkvx7+yP+Jjq643aIbveN/Tx5OYZIhtSMRtJDzT+nDIgD83NyHL6JHO3LzKZEw6yZJWWSXyK9P5H8RX7ipWf3o3NaUCcs1K8wyTcgBZ/GT9X9SprH1ySYAGJz+G1UyPMQT1V4OirkQaMfN0Ht7jl6gEXXOs0Ks1sOdaKZUFIGn9P1cNRixp34Bw3edL4ZjNljXZa12MqzbaArTCm+WzJqrvkToOx2bqU37Y1vNskOBdYkCvWhKsIf8Gj5LZiVjFnX27bXeLv6Gd3asJ4qcQAl06+wARAQABtChKYXJra28gU2Fra2luZW4gPGphcmtrby5zYWtraW5lbkBpa2kuZmk+iQJXBBMBCgBBAhsBBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAhkBFiEEUQfmbTR4ipPjInyQOrBUhsd1L+EFAmSlnJMFCQl1crkACgkQOrBUhsd1L+EPKw/9EnoAjcbK+duuIN4JA6iXCfdWrYK8DhvaMgfNIbH4ZrtbMYwAPsHeZTv/C47pf48sp200OvdQoA2qoYdtX+I1JLhz7aaRtemBp1lw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DdXMfwklgAZ3RBdBDoOc9ydclhN855bf9h+LoouszCZCznnlQSsGjBv9Ojfn2QNzGd3/cCrL7xS82PguDXopi6oZycp9LpfKKWL7BWmkQT8lgbSrm+QNY4DzMiNPhcqMb+8Yj+V7kqbBS/yWV/kbl5CrI5P/Iz4ZeqKrh07dKUJaj+RGaifW3cZFx/VCHqLxVfa3DwrHtFwQops4/lewpCqBtfx9UWGHRZIfn2Y9EEEmx94ymhO3nN3bVo0GZHCgfcvSDbFgNEefbakVoCAMq6/oiPZTRN0bxktVC7r36lybcbRdCX+MF6OXZb/jjJ71WzkhThEaA+NXx6uaxOvIhgOU0h1qLFkxPpESEYolyhRSs2urvTtbFG/PqHHGlxrl2vLaRee5YJDfvpar+unOY44lfYVdvqd3udMbXhb7FFfajz0iSsok4VwEkh/6BCZ+x8sMSueroMf1jMFs N1LK7Vr OhxtP1vYUoyv1iQpYsijVlqHhqbA7Va/jVwBJi40tjMFS0E91mK1iRtBzA== Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.1-1 MIME-Version: 1.0 X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 05 Nov 2023 19:26:56 -0800 (PST) On Mon, 2023-10-30 at 11:20 -0700, Haitao Huang wrote: > SGX Enclave Page Cache (EPC) memory allocations are separate from normal = RAM allocations, and > are managed solely by the SGX subsystem. The existing cgroup memory contr= oller cannot be used > to limit or account for SGX EPC memory, which is a desirable feature in s= ome environments, > e.g., support for pod level control in a Kubernates cluster on a VM or ba= remetal host [1,2]. > =C2=A0 > This patchset implements the support for sgx_epc memory within the misc c= group controller. The > user can use the misc cgroup controller to set and enforce a max limit on= total EPC usage per > cgroup. The implementation reports current usage and events of reaching t= he limit per cgroup as > well as the total system capacity. > =C2=A0 > With the EPC misc controller enabled, every EPC page allocation is accoun= ted for a cgroup's > usage, reflected in the 'sgx_epc' entry in the 'misc.current' interface f= ile of the cgroup. > Much like normal system memory, EPC memory can be overcommitted via virtu= al memory techniques > and pages can be swapped out of the EPC to their backing store (normal sy= stem memory allocated > via shmem, accounted by the memory controller). When the EPC usage of a c= group reaches its hard > limit ('sgx_epc' entry in the 'misc.max' file), the cgroup starts a recla= mation process to swap > out some EPC pages within the same cgroup and its descendant to their bac= king store. Although > the SGX architecture supports swapping for all pages, to avoid extra comp= lexities, this > implementation does not support swapping for certain page types, e.g.=C2= =A0 Version Array(VA) pages, > and treat them as unreclaimable pages.=C2=A0 When the limit is reached bu= t nothing left in the > cgroup for reclamation, i.e., only unreclaimable pages left, any new EPC = allocation in the > cgroup will result in an ENOMEM error. >=20 > The EPC pages allocated for guest VMs by the virtual EPC driver are not r= eclaimable by the host > kernel [5]. Therefore they are also treated as unreclaimable from cgroup'= s point of view.=C2=A0 And > the virtual EPC driver translates an ENOMEM error resulted from an EPC al= location request into > a SIGBUS to the user process. >=20 > This work was originally authored by Sean Christopherson a few years ago,= and previously > modified by Kristen C. Accardi to utilize the misc cgroup controller rath= er than a custom > controller. I have been updating the patches based on review comments sin= ce V2 [3, 4, 10], > simplified the implementation/design and fixed some stability issues foun= d from testing. > =C2=A0 > The patches are organized as following:=20 > - Patches 1-3 are prerequisite misc cgroup changes for adding new APIs, s= tructs, resource > =C2=A0 types. > - Patch 4 implements basic misc controller for EPC without reclamation. > - Patches 5-9 prepare for per-cgroup reclamation. > =C2=A0=C2=A0=C2=A0 * Separate out the existing infrastructure of tracking= reclaimable pages > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 from the global reclaimer(ksgxd) to a newl= y created LRU list struct. > =C2=A0=C2=A0=C2=A0 * Separate out reusable top-level functions for reclam= ation. > - Patch 10 adds support for per-cgroup reclamation. > - Patch 11 adds documentation for the EPC cgroup. > - Patch 12 adds test scripts. >=20 > I appreciate your review and providing tags if appropriate. >=20 > --- > V6: > - Dropped OOM killing path, only implement non-preemptive enforcement of = max limit (Dave, Michal) > - Simplified reclamation flow by taking out sgx_epc_reclaim_control, forc= ed reclamation by > =C2=A0 ignoring 'age". > - Restructured patches: split misc API + resource types patch and the big= EPC cgroup patch > =C2=A0 (Kai, Michal) > - Dropped some Tested-by/Reviewed-by tags due to significant changes > - Added more selftests >=20 > v5: > - Replace the manual test script with a selftest script. > - Restore the "From" tag for some patches to Sean (Kai) > - Style fixes (Jarkko) >=20 > v4: > - Collected "Tested-by" from Mikko. I kept it for now as no functional ch= anges in v4. > - Rebased on to v6.6_rc1 and reordered patches as described above. > - Separated out the bug fixes [7,8,9]. This series depend on those patche= s. (Dave, Jarkko) > - Added comments in commit message to give more preview what's to come ne= xt. (Jarkko) > - Fixed some documentation error, gap, style (Mikko, Randy) > - Fixed some comments, typo, style in code (Mikko, Kai) > - Patch format and background for reclaimable vs unreclaimable (Kai, Jark= ko) > - Fixed typo (Pavel) > - Exclude the previous fixes/enhancements for self-tests. Patch 18 now de= pends on series [6] > - Use the same to list for cover and all patches. (Solo) > =C2=A0 > v3: > =C2=A0 > - Added EPC states to replace flags in sgx_epc_page struct. (Jarkko) > - Unrolled wrappers for cond_resched, list (Dave) > - Separate patches for adding reclaimable and unreclaimable lists. (Dave) > - Other improvements on patch flow, commit messages, styles. (Dave, Jarkk= o) > - Simplified the cgroup tree walking with plain > =C2=A0 css_for_each_descendant_pre. > - Fixed race conditions and crashes. > - OOM killer to wait for the victim enclave pages being reclaimed. > - Unblock the user by handling misc_max_write callback asynchronously. > - Rebased onto 6.4 and no longer base this series on the MCA patchset. > - Fix an overflow in misc_try_charge. > - Fix a NULL pointer in SGX PF handler. > - Updated and included the SGX selftest patches previously reviewed. Thos= e > =C2=A0 patches fix issues triggered in high EPC pressure required for cgr= oup > =C2=A0 testing. > - Added test scripts to help setup and test SGX EPC cgroups. > =C2=A0 > [1]https://lore.kernel.org/all/DM6PR21MB11772A6ED915825854B419D6C4989@DM6= PR21MB1177.namprd21.prod.outlook.com/ > [2]https://lore.kernel.org/all/ZD7Iutppjj+muH4p@himmelriiki/ > [3]https://lore.kernel.org/all/20221202183655.3767674-1-kristen@linux.int= el.com/ > [4]https://lore.kernel.org/linux-sgx/20230712230202.47929-1-haitao.huang@= linux.intel.com/ > [5]Documentation/arch/x86/sgx.rst, Section "Virtual EPC" > [6]https://lore.kernel.org/linux-sgx/20220905020411.17290-1-jarkko@kernel= .org/ > [7]https://lore.kernel.org/linux-sgx/ZLcXmvDKheCRYOjG@slm.duckdns.org/ > [8]https://lore.kernel.org/linux-sgx/20230721120231.13916-1-haitao.huang@= linux.intel.com/ > [9]https://lore.kernel.org/linux-sgx/20230728051024.33063-1-haitao.huang@= linux.intel.com/ > [10]https://lore.kernel.org/all/20230923030657.16148-1-haitao.huang@linux= .intel.com/ >=20 > Haitao Huang (2): > =C2=A0 x86/sgx: Introduce EPC page states > =C2=A0 selftests/sgx: Add scripts for EPC cgroup testing >=20 > Kristen Carlson Accardi (5): > =C2=A0 cgroup/misc: Add per resource callbacks for CSS events > =C2=A0 cgroup/misc: Export APIs for SGX driver > =C2=A0 cgroup/misc: Add SGX EPC resource type > =C2=A0 x86/sgx: Implement basic EPC misc cgroup functionality > =C2=A0 x86/sgx: Implement EPC reclamation for cgroup >=20 > Sean Christopherson (5): > =C2=A0 x86/sgx: Add sgx_epc_lru_list to encapsulate LRU list > =C2=A0 x86/sgx: Use sgx_epc_lru_list for existing active page list > =C2=A0 x86/sgx: Use a list to track to-be-reclaimed pages > =C2=A0 x86/sgx: Restructure top-level EPC reclaim function > =C2=A0 Docs/x86/sgx: Add description for cgroup support >=20 > =C2=A0Documentation/arch/x86/sgx.rst=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 74 ++++ > =C2=A0arch/x86/Kconfig=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 13 + > =C2=A0arch/x86/kernel/cpu/sgx/Makefile=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 1 + > =C2=A0arch/x86/kernel/cpu/sgx/encl.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 2 +- > =C2=A0arch/x86/kernel/cpu/sgx/epc_cgroup.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 | 319 ++++++++++++++++++ > =C2=A0arch/x86/kernel/cpu/sgx/epc_cgroup.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 49 +++ > =C2=A0arch/x86/kernel/cpu/sgx/main.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 245 +++++++++----- > =C2=A0arch/x86/kernel/cpu/sgx/sgx.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 88 +++= +- > =C2=A0include/linux/misc_cgroup.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2= =A0 42 +++ > =C2=A0kernel/cgroup/misc.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 52 ++- > =C2=A0.../selftests/sgx/run_epc_cg_selftests.sh=C2=A0=C2=A0=C2=A0=C2=A0 |= 196 +++++++++++ > =C2=A0.../selftests/sgx/watch_misc_for_tests.sh=C2=A0=C2=A0=C2=A0=C2=A0 |= =C2=A0 13 + > =C2=A012 files changed, 996 insertions(+), 98 deletions(-) > =C2=A0create mode 100644 arch/x86/kernel/cpu/sgx/epc_cgroup.c > =C2=A0create mode 100644 arch/x86/kernel/cpu/sgx/epc_cgroup.h > =C2=A0create mode 100755 tools/testing/selftests/sgx/run_epc_cg_selftests= .sh > =C2=A0create mode 100755 tools/testing/selftests/sgx/watch_misc_for_tests= .sh >=20 Is this expected to work on NUC7? Planning to test this next week (no time this week). BR, Jarkko