Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp284911rdg; Tue, 10 Oct 2023 10:07:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpAmhhMuLcnLDQyO+gjUVkYLaS1jSII7wkCe+v1B7hUJGhoo5cGfJlxEdG8if9vq6OJ5zi X-Received: by 2002:a05:6a00:23ce:b0:68e:3eb6:d45 with SMTP id g14-20020a056a0023ce00b0068e3eb60d45mr19478407pfc.30.1696957634993; Tue, 10 Oct 2023 10:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696957634; cv=none; d=google.com; s=arc-20160816; b=EOgfrmMRogt5xJpqV6nBc5L2YYJru8Nvxek6UFGLMLxg4IsHZ+WS/1C07AWVVbfryb Guq9FLx7AQXk5bp8OTlJ0vfwI7vMvVmaTkUmGhUEXz+2vCi75JDmnYQjEHFU3RzaBup9 30VHC5z5veBNEi3qUMo7YhHIEK3StLenhQkTT6CHiRkzk9WtO0LGX8XAGYzRidZe7Jqw 5DX0qJ2MaYUZIX5gwiV0TqidDOYxBx4us6IlDJzOUMP14Qnp0DK2kWF6KKdGZSE8r3k8 q0WeQe1sKHk3rebG+Y2aM22f8gQh08dRn26PnyGEppvBSQ6SVr4cf2iNkt7vqkQUZ0JB fMPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:message-id:organization :from:content-transfer-encoding:mime-version:date:references:subject :cc:to:dkim-signature; bh=KJCtBLyV+bVrG3BYL+xQJjaUs/xpXZ+zfAIPThCQQxo=; fh=5jUR3IXpcNURyL615KxJZBNN/qmH7KYwcTHU5UESKMA=; b=z1Zrf1dI1je8l8BujCzpMcLhFHaj1myf5HkXn/wr9klOx3446SvoXU6paIvzwUu7SQ smfxlzfqoS3eR7POOvAVd//WYLqgnnRvj4qP2lL7Oyvd0Tdc0GZ/YdOMrPIMQZsjxnQn nLnSERfNp9pc4kBXA6yMHFQtmcJcT/Qy99AS4MoBpoFPmBtxhzcO4Od54TwjqfmDdB6q 4t/E5LQx3eH2E497kZjqR0Q2wz4cG/Q+AokYR3gjAf+Q4ajPxs4zYGBxwGxbfyBnwgVs SNL3Adsfvk+H2dD/mTdeeD/LrK42EJUgl7zT1giZfO93pVXfd/wVgJsXKHk+FU7XeLUu MADw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dUnmCnnL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bt23-20020a056a00439700b0068e39cd7acdsi9932742pfb.83.2023.10.10.10.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 10:07:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dUnmCnnL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 320D1802A829; Tue, 10 Oct 2023 10:07:12 -0700 (PDT) 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 S1343503AbjJJRHH (ORCPT + 99 others); Tue, 10 Oct 2023 13:07:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234383AbjJJRGq (ORCPT ); Tue, 10 Oct 2023 13:06:46 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6D4E10D5; Tue, 10 Oct 2023 10:06:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696957583; x=1728493583; h=to:cc:subject:references:date:mime-version: content-transfer-encoding:from:message-id:in-reply-to; bh=xpxagVahSuuVfh54QbO0O0LxyEGgv5d6nUjRC7qUNxI=; b=dUnmCnnLcpJy+1ROY+fg+2z3L6jT81ICzo4ExJfOWEbDsUCyT1wh4V8d FpFAUR/UAzvRjtBaK4SF1Hc+LNcMRUe6XA/mRieVnVyFHc07Inasa1Nsk YoVcYDmzuntBf4m7WZZAKIBBxMAx/7LKGGV5ccYRz9/siGFBVBTHd1LT1 pnumf8fS8jEzRfRD+SLqYRkgBTUr8OXkIqD7VGG2JvOOdGy2+9J/PciF0 IWqiO4DtoPyhjaG5yILltzESVYIdloVTyUr1LD8WYUaXMvy8MJcPzbtZ8 ntIv9+LeJx1HnAfi3ODdmKjThuhH2S+MG6dIHMJREHD02zXFsm0NdInFF A==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="450953603" X-IronPort-AV: E=Sophos;i="6.03,213,1694761200"; d="scan'208";a="450953603" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2023 10:06:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="819323024" X-IronPort-AV: E=Sophos;i="6.03,213,1694761200"; d="scan'208";a="819323024" Received: from hhuan26-mobl.amr.corp.intel.com ([10.92.96.100]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 10 Oct 2023 10:05:30 -0700 Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes To: "tj@kernel.org" , "linux-sgx@vger.kernel.org" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "cgroups@vger.kernel.org" , "hpa@zytor.com" , "mingo@redhat.com" , "linux-kernel@vger.kernel.org" , "bp@alien8.de" , "tglx@linutronix.de" , "jarkko@kernel.org" , "Mehta, Sohil" , "Huang, Kai" Cc: "kristen@linux.intel.com" , "Zhang, Bo" , "Li, Zhiquan1" , "Christopherson,, Sean" , "mikko.ylinen@linux.intel.com" , "anakrish@microsoft.com" , "yangjie@microsoft.com" Subject: Re: [PATCH v5 12/18] x86/sgx: Add EPC OOM path to forcefully reclaim EPC References: <20230923030657.16148-1-haitao.huang@linux.intel.com> <20230923030657.16148-13-haitao.huang@linux.intel.com> <1b265d0c9dfe17de2782962ed26a99cc9d330138.camel@intel.com> Date: Tue, 10 Oct 2023 12:05:29 -0500 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Haitao Huang" Organization: Intel Message-ID: In-Reply-To: User-Agent: Opera Mail/1.0 (Win32) X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED 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]); Tue, 10 Oct 2023 10:07:12 -0700 (PDT) On Mon, 09 Oct 2023 21:12:27 -0500, Huang, Kai wrote: > >> > > > >> > > Later the hosting process could migrated/reassigned to another >> cgroup? >> > > What to do when the new cgroup is OOM? >> > > >> > >> > You addressed in the documentation, no? >> > >> > +Migration >> > +--------- >> > + >> > +Once an EPC page is charged to a cgroup (during allocation), it >> > +remains charged to the original cgroup until the page is released >> > +or reclaimed. Migrating a process to a different cgroup doesn't >> > +move the EPC charges that it incurred while in the previous cgroup >> > +to its new cgroup. >> >> Should we kill the enclave though because some VA pages may be in the >> new >> group? >> > > I guess acceptable? > > And any difference if you keep VA/SECS to unreclaimabe list? Tracking VA/SECS allows all cgroups, in which an enclave has allocation, to identify the enclave following the back pointer and kill it as needed. > If you migrate one > enclave to another cgroup, the old EPC pages stay in the old cgroup > while the > new one is charged to the new group IIUC. > > I am not cgroup expert, but by searching some old thread it appears this > isn't a > supported model: > > https://lore.kernel.org/lkml/YEyR9181Qgzt+Ps9@mtj.duckdns.org/ > IIUC it's a different problem here. If we don't track the allocated VAs in the new group, then the enclave that spans the two groups can't be killed by the new group. If so, some enclave could just hide in some small group and never gets killed but keeps allocating in a different group? Thanks Haitao