Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7949941rdb; Thu, 4 Jan 2024 13:02:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFZPQ/tBjTifkPmNLs4rMVow6/4D87EHFnyBSmFcTTH3iOJc3mn9bzOIZw4tNQpYk+mYGTI X-Received: by 2002:a05:6102:205d:b0:467:66bb:8e5c with SMTP id q29-20020a056102205d00b0046766bb8e5cmr821259vsr.12.1704402151885; Thu, 04 Jan 2024 13:02:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704402151; cv=none; d=google.com; s=arc-20160816; b=hAMkLsGAd6T6jjLbh26BPDRsOJ1CTBfLUXupVZq2MCT0hfkVeUHa2n/a+TtaeYjeWE BySI0PyqH3RdOIMDIo3KPqRfpt0YmoT2K3UxODEz+/9v3IBX4J+SLh2mVFqaCgO0q29l FMcKK5V0a9kRjLZX5MONayabP0OQ7eKT+DePFnO2bPn0tQZ/LGOUfSLt3hv3Hw0lSYfJ cq1M67FIhInuswR4wf6hM7w4yXwcWo85474EmsbdybamV+BsJb4DquAISXKaEvfaV8dL VJcDycSTjMrG7s5EmtnkiCUX6ybNn9S+bvh9S+xkAT/7mN+6Gveq/Vvo4IIFBaTNAH5h aYJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:message-id:organization:from :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:references:subject:cc:to :dkim-signature; bh=kJh/fSFPI61Mtq2PvgnMHvi5bQHvPZZeNz7HppB8w9A=; fh=qwZswc2xDA3/+m0eWdARPLr8MAKPdyYEhtL239MaDDE=; b=Bumo/bl3Izv/fBkgIUOfNW1hUPGJx7RLye3/GMpA7vomslZQ+slkQVLukFPb7zjN+6 pi+/nFyyd6evObBj3giq986GBEqidg5voGKu6I1keUv/BRCBz9wL+mMFLoeJOh0D9pWi STrM68WnX3T+Ohaf8LZju7T6eludjL7IyoXGfpU3618B99cpqRqX3sT2jl5e1j07dayq IupQEKI0YEtt08mGqNEgDW3+bvOG1uuS5RGlmz7vZqbXifNQ4z9sNiCfgTkmQB5km5Aj X4cFchHesesL/WtCjsHCE3sD78JObylNuxfJKvizHLjaXSc6sVWDclFG60lUcz85WfJb hVjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Gv0a367Q; spf=pass (google.com: domain of linux-kernel+bounces-17219-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17219-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y22-20020a67f256000000b00466f3e6eef2si28102vsm.417.2024.01.04.13.02.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 13:02:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17219-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Gv0a367Q; spf=pass (google.com: domain of linux-kernel+bounces-17219-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17219-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 9C22E1C229C3 for ; Thu, 4 Jan 2024 21:02:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B45F2C1BB; Thu, 4 Jan 2024 21:02:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Gv0a367Q" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) (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 414CD2C860; Thu, 4 Jan 2024 21:02:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704402124; x=1735938124; h=to:cc:subject:references:date:mime-version: content-transfer-encoding:from:message-id:in-reply-to; bh=jNkbhszzShPbArPxx0L05m7z25QEwrp4u/6skEB2hTk=; b=Gv0a367Qp1IWVeihxWrbKGOoUtniuMwOkajAvtpXUlF7C65xwRq7n4nm eqYcNXSSXZJVnkvJBQizHK3PZr24isxyE9lgSvYyNwuVapVvSeyxdPQ12 4OJ4RxpJh1uYhGWyxcEQZBfEo0YVEFmOysLfHo0WkIr2vYBrNaDE1Okm0 QTQ00UuD2Cpy03mN7lVkUVBMSnBWekP+h92aPHxHElEgNpLo91oGsFE5O 65Wn0Er/xWBFLOnXkH0FFNE6W0goc09F9QTEubZ6A/1ykKGtu00/WOpAq 0Wz5r6RXzg/LQ76vFE7Q56jvk3GkkS52xTwLOd1tBeAXTy7WdA+L/LkN9 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="376847776" X-IronPort-AV: E=Sophos;i="6.04,331,1695711600"; d="scan'208";a="376847776" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jan 2024 13:02:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="1027567628" X-IronPort-AV: E=Sophos;i="6.04,331,1695711600"; d="scan'208";a="1027567628" Received: from hhuan26-mobl.amr.corp.intel.com ([10.92.17.168]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 04 Jan 2024 13:02:00 -0800 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Mehta, Sohil" , "jarkko@kernel.org" , "x86@kernel.org" , "dave.hansen@linux.intel.com" , "cgroups@vger.kernel.org" , "hpa@zytor.com" , "mingo@redhat.com" , "tj@kernel.org" , "mkoutny@suse.com" , "tglx@linutronix.de" , "linux-sgx@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "bp@alien8.de" , "Huang, Kai" , "Dave Hansen" Cc: "mikko.ylinen@linux.intel.com" , "seanjc@google.com" , "Zhang, Bo" , "kristen@linux.intel.com" , "anakrish@microsoft.com" , "sean.j.christopherson@intel.com" , "Li, Zhiquan1" , "yangjie@microsoft.com" Subject: Re: [PATCH v6 09/12] x86/sgx: Restructure top-level EPC reclaim function References: <20231030182013.40086-1-haitao.huang@linux.intel.com> <20231030182013.40086-10-haitao.huang@linux.intel.com> <431c5d7f5aee7d11ec2e8aa2e526fde438fa53b4.camel@intel.com> <3c27bca678c1b041920a14a7da0d958c9861ebca.camel@intel.com> <73ed579be8ad81835df1c309b7c69b491b7f2c8e.camel@intel.com> <4b28fc01-50cf-469b-8161-7d56b863b42b@intel.com> <2aee5f75-836e-4a47-a29c-b272150227a8@intel.com> Date: Thu, 04 Jan 2024 15:01:59 -0600 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 From: "Haitao Huang" Organization: Intel Message-ID: In-Reply-To: <2aee5f75-836e-4a47-a29c-b272150227a8@intel.com> User-Agent: Opera Mail/1.0 (Win32) On Thu, 04 Jan 2024 13:27:07 -0600, Dave Hansen = = wrote: > On 1/4/24 11:11, Haitao Huang wrote: >> If those are OK with users and also make it acceptable for merge >> quickly, I'm happy to do that =F0=9F=99=82 > > How about we put some actual numbers behind this? How much complexity= > are we talking about here? What's the diffstat for the utterly > bare-bones implementation and what does it cost on top of that to do t= he > per-cgroup reclaim? > For bare-bone: arch/x86/Kconfig | 13 ++++++++++++ arch/x86/kernel/cpu/sgx/Makefile | 1 + arch/x86/kernel/cpu/sgx/epc_cgroup.c | 104 = ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++++++++++++++++++ arch/x86/kernel/cpu/sgx/epc_cgroup.h | 39 = +++++++++++++++++++++++++++++++++++ arch/x86/kernel/cpu/sgx/main.c | 41 = ++++++++++++++++++++++++++++++++++++ arch/x86/kernel/cpu/sgx/sgx.h | 5 +++++ include/linux/misc_cgroup.h | 42 = +++++++++++++++++++++++++++++++++++++ kernel/cgroup/misc.c | 52 = +++++++++++++++++++++++++++++++--------------- 8 files changed, 281 insertions(+), 16 deletions(-) Additional for per-cgroup reclaim: arch/x86/kernel/cpu/sgx/encl.c | 41 +++++++++-------- arch/x86/kernel/cpu/sgx/encl.h | 3 +- arch/x86/kernel/cpu/sgx/epc_cgroup.c | 224 = ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++-- arch/x86/kernel/cpu/sgx/epc_cgroup.h | 18 ++++++-- arch/x86/kernel/cpu/sgx/main.c | 226 = ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------= -------------------- arch/x86/kernel/cpu/sgx/sgx.h | 85 = +++++++++++++++++++++++++++++++++-- 6 files changed, 480 insertions(+), 117 deletions(-) Thanks Haitao