Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp500868rdb; Thu, 1 Feb 2024 15:22:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IGuLteR4LkzEozZMr3p1leSZIARyE9RfSdupPPwy+b+x+/iBi97TT0QVZcPa17C/pmT8lzK X-Received: by 2002:ac8:5795:0:b0:42a:a934:1f4c with SMTP id v21-20020ac85795000000b0042aa9341f4cmr5076265qta.2.1706829729934; Thu, 01 Feb 2024 15:22:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706829729; cv=pass; d=google.com; s=arc-20160816; b=Dm5K5lObVm3h5DV64yCMABa0aWnzwX/uMkbphXtlKYsG6gx8nYv8a5lK3JPDjUVMjZ pOmQdM1MxH1WuFbvNE7SHJsLfe8hZJdgsB5yFJhpz7FyCg1l1I5s9bQoT3uasgOU2u5R MPpelhaxGCokxbUG/arhi3+vywI+hzNKmxwJzg0/N6tcMPTJBzm4pHiIqb16LVRi3i5t ARY36L2AWUJLAlEaS5rBr7TVjhFp1p8dyG0G/NbgUG0FkQTQ4x1QVMfsbHnj5SYhyJg9 rCpxOu4eQchDAx0Gy1ieO1h2C86lffLtsfclo4rzPnrmZkPvjeUTa7G6/93r3zbBpEBO z1dw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=qWxg1bTEbWqncg/Sukblt/2ikgDQo9/ifvPrwoNNbDE=; fh=syJ2CsvdmP4+mLqXIDQMz1bkRLFjmjMhLi2HEAEdwwU=; b=P1xbyCIBnycH9iQ8A2x5rde0fA5dOCzHVbk6TG7NOivEFy2leMbPqZrGHDo6jKeGH1 LmKZBlTGC4Kyv5/5/e+S4iz+W5/eBJKq+BTLNGrcSD1KXFNg3UEB9eZWe/qaZwjH6+uQ RCq27bdNcpPaVH6gCZ0aqxrqW7ZR0cOLSM1Qz9IcbSaEjlbm2mPf8P24K1/cXvG7/EQg QzolAUWXoQEl6C5s0I1DStf2KxL9nskG/AaxvYNZtauyu5VqQUICow5sMsYIMa3YdRFY sh6ESvmLr6E0WHIEkLVf/feCdaG1hKIBe2WthNljX4iWSh//6xMs8rM6IOL0buAvNOzb JXdQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sqDS41EM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-48985-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48985-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCW/HJNJO1gTiyT3kKlUNUb1mJ3u04TQ9bciH2ucK2eWLd7Pf3YVzCDXRm2i/hd1kUt50ypz5kmlJfwZKt4hnrU+acDwt602tYxEQQ7vcQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g22-20020ac87f56000000b0042be2b62457si643626qtk.183.2024.02.01.15.22.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 15:22:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48985-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sqDS41EM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-48985-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48985-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7E37B1C23DE0 for ; Thu, 1 Feb 2024 23:22:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7154A47F51; Thu, 1 Feb 2024 23:22:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sqDS41EM" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 829BC47A7A; Thu, 1 Feb 2024 23:22:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706829722; cv=none; b=O+rEGrlt496JnxhpXhBua7xCL+YOTc5SginuUqQyQ4WQMEUU0ZqDl1QPPniXPLpAu4VFZLO7Jx7d2z9p+m6ViUNtXmwqPnSswHvLuwfZMSow9uuJYr9i8XLRtz9A4Q1cyKqfpbh3/q946lYb8dQwcojhxtBTr4by1iBAw61msPY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706829722; c=relaxed/simple; bh=G6WlvYnkVrB0wsoSQYsuZNh4sVfvs3Gqe3vjwXFttD0=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=Xoh65GdyQkQ+8iIkaU9rjAGQSrxGvunmIpcVcBYiDGy3x3G8c7JpZV8XaIgDjiYJZOmrroxtUkRDHVD1NazVUwcZx7kowTXVkivzXmsdyIJcHzOBPqLF0AcR5qzV5i4458R0ljp6VvAk9HdUNxxGH2DjmZ3XKooKvAH3yvVknaM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sqDS41EM; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05682C433F1; Thu, 1 Feb 2024 23:21:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706829722; bh=G6WlvYnkVrB0wsoSQYsuZNh4sVfvs3Gqe3vjwXFttD0=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=sqDS41EMGOKSBtpX0WoSlvxKFtrclrRkhidXvwtvZp3GiKfjUuf1zT+Qq5+HQeFIG FX/EgpYJbGWDtWn5MIGOgeTGK8lrvxJGgbGyoOmcEkn5Bt8KyRdduvZe3CBmrgBwb6 oPTMPL5cndZ2Z3qGzpcL27tk/8ETXgVGtJXbUv91sI1z5gT9ZhfJ4pogF45nJOENXI TJqkM3/7nck+eqDhc9F3gSsevRw10vaaIN904xBfL7J8/H9YKltcxw1fdAXDIvZQIT vnjthjzHwSN8R6zMCvfhhgqkA7tlkR1pBR9shzlY5fU4irt0b64FqMlW7S8qd3SIDo FDrlmxqz+Eeeg== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 02 Feb 2024 01:21:56 +0200 Message-Id: Cc: , , , , , , Subject: Re: [PATCH v7 04/15] x86/sgx: Implement basic EPC misc cgroup functionality From: "Jarkko Sakkinen" To: "Haitao Huang" , , , , , , , , , , , , X-Mailer: aerc 0.15.2 References: <20240122172048.11953-1-haitao.huang@linux.intel.com> <20240122172048.11953-5-haitao.huang@linux.intel.com> In-Reply-To: On Wed Jan 24, 2024 at 5:29 AM EET, Haitao Huang wrote: > On Mon, 22 Jan 2024 14:25:53 -0600, Jarkko Sakkinen = =20 > wrote: > > > On Mon Jan 22, 2024 at 7:20 PM EET, Haitao Huang wrote: > >> From: Kristen Carlson Accardi > >> > >> SGX Enclave Page Cache (EPC) memory allocations are separate from norm= al > >> RAM allocations, and are managed solely by the SGX subsystem. The > >> existing cgroup memory controller cannot be used to limit or account f= or > >> SGX EPC memory, which is a desirable feature in some environments. Fo= r > >> example, in a Kubernates environment, a user can request certain EPC > >> quota for a pod but the orchestrator can not enforce the quota to limi= t > >> runtime EPC usage of the pod without an EPC cgroup controller. > >> > >> Utilize the misc controller [admin-guide/cgroup-v2.rst, 5-9. Misc] to > >> limit and track EPC allocations per cgroup. Earlier patches have added > >> the "sgx_epc" resource type in the misc cgroup subsystem. Add basic > >> support in SGX driver as the "sgx_epc" resource provider: > >> > >> - Set "capacity" of EPC by calling misc_cg_set_capacity() > >> - Update EPC usage counter, "current", by calling charge and uncharge > >> APIs for EPC allocation and deallocation, respectively. > >> - Setup sgx_epc resource type specific callbacks, which perform > >> initialization and cleanup during cgroup allocation and deallocation, > >> respectively. > >> > >> With these changes, the misc cgroup controller enables user to set a = =20 > >> hard > >> limit for EPC usage in the "misc.max" interface file. It reports curre= nt > >> usage in "misc.current", the total EPC memory available in > >> "misc.capacity", and the number of times EPC usage reached the max lim= it > >> in "misc.events". > >> > >> For now, the EPC cgroup simply blocks additional EPC allocation in > >> sgx_alloc_epc_page() when the limit is reached. Reclaimable pages are > >> still tracked in the global active list, only reclaimed by the global > >> reclaimer when the total free page count is lower than a threshold. > >> > >> 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-by: Haitao Huang > > > > For consistency sake I'd also add co-developed-by for Kristen. This is > > at least the format suggested by kernel documentation. > > > She is the "From Author", so only Signed-off-by is needed for her =20 > according to the second example in the doc[1]? Right but okay then Kristen afaik be the last sob so only re-ordering is needed I guess. > > Thanks > Haitao > [1]https://docs.kernel.org/process/submitting-patches.html#when-to-use-ac= ked-by-cc-and-co-developed-by BR, Jarkko