Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp459126rdb; Thu, 19 Oct 2023 09:06:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvk7quzHlWsr3dQty3d78m1x6gfScHa+BeHtGlzqEHsbHr6iawH8cB4PBjInjC9QjVwWPV X-Received: by 2002:a17:902:d48f:b0:1c8:9d32:339e with SMTP id c15-20020a170902d48f00b001c89d32339emr2731499plg.50.1697731592789; Thu, 19 Oct 2023 09:06:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697731592; cv=none; d=google.com; s=arc-20160816; b=Wr9Dr3LuDOK3jA6mouplAafWbSzKogEituvL0eM+RZTBnMUfKxPAfn/7z3xJ8Hrily EH+QJ8mzqAR0ZNwliO9gW4LZRfLS0zrqKszPLjLZgJ6fxkgPWTOSYZ5Tm+4thJnP/Sef uUdmpuQPksRY30nq27OSduv6fblYtmSRXzDhPHoWvsr1B2tAmS0Nkh+51Ks/RWYgAD37 xA/piS8E09JFLU58SNY38oNZWIjBzl5o4d7W/ukrwRUAf7dPyIz3LZ7qYmmvGcf3YkCg o9eWfGNOMEEquTfMfAOI2BXy9tylb014f3Xfe063P9QNPR8q2MHDvF4XTzVFfM3sgxPq saJg== 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=7PUSgOfKbPF1xVH0g8Tctarjl/DeUDaAlXJnPq68BqA=; fh=HvU325aVgnU1ZM07HRT/nZpRKOAGsARe3FiscL5bmK4=; b=dXDnYKmWczO9jKCpVjqoTsk3LhsJH3SmKhJqACsp0FK/JYi75L/rdYlF3fX/62vrLs 2sYiHlcm659BWCRA5CIYvXXeFriVMd6HV6Rr2K2CGo5lCgwt7LC+B23vcTuy3x/rFOa2 ajnDeYbfPclfU5oAo+4AChZD2gXQS3lddVYOw3NihlCpj7jFkSgPJSRIlonR6oeNCmob rqbguPvwq0kcSHtDSSlKSKcckmSVcMa1LzJuK6o40+JSkj1HnK4bkt0WGNWgfvzOWNEp mEJJXYbwZrRHIbzsgAnYgkE6v2RWWoTKWRCZ02zkSZvC2BxVswxTEavQipiOzwJYMArJ PJGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Wp/gCMcv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id r2-20020a170902c60200b001bdd35033f7si2309955plr.366.2023.10.19.09.06.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 09:06:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Wp/gCMcv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 761DA82A8562; Thu, 19 Oct 2023 09:06:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346401AbjJSQGN (ORCPT + 99 others); Thu, 19 Oct 2023 12:06:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345210AbjJSQGK (ORCPT ); Thu, 19 Oct 2023 12:06:10 -0400 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29E15B3; Thu, 19 Oct 2023 09:06:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697731570; x=1729267570; h=to:cc:subject:references:date:mime-version: content-transfer-encoding:from:message-id:in-reply-to; bh=SlREd5rAEUIr1hUoGq+4u2bMdbm4gp8hOc98GrHIKzc=; b=Wp/gCMcvxeR10KjXSZY4XOGCPz9mab5GtZ/iH6uc4gIx9bTwAAqybh3o CTcObgWhQtIfLifNBOp1nvsYyZk95FqKW2RyQ9eVppN5jBvi8d9WCiB5Y Gxe9fdoiFMbXhMIyIQwqUcIcu8hm7FRBY5trEAf1pTkRxylAjEVhKRlD1 Mg8583Hj/mw0RbLIZ7MGf1azOMiGe6MVaKS6Xh2Y5/JrLhw37crssFVic Rf/R4dhb0gN1SAmMYYC8SUQ+b5hnv7MRdtZvyVbL3g2I9A/rAi6219DQB iCqat+Nw7noxezcMqjEudXyHiQQRVgzSL+Vki4a50pXkKqIblA612AWzv Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10868"; a="4898559" X-IronPort-AV: E=Sophos;i="6.03,237,1694761200"; d="scan'208";a="4898559" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2023 09:05:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10868"; a="930664073" X-IronPort-AV: E=Sophos;i="6.03,237,1694761200"; d="scan'208";a="930664073" Received: from hhuan26-mobl.amr.corp.intel.com ([10.92.17.92]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 19 Oct 2023 09:05:22 -0700 Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes To: =?iso-8859-15?Q?Michal_Koutn=FD?= Cc: jarkko@kernel.org, dave.hansen@linux.intel.com, tj@kernel.org, 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, 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 Subject: Re: [PATCH v5 16/18] x86/sgx: Limit process EPC usage with misc cgroup controller References: <20230923030657.16148-1-haitao.huang@linux.intel.com> <20230923030657.16148-17-haitao.huang@linux.intel.com> Date: Thu, 19 Oct 2023 11:05:18 -0500 MIME-Version: 1.0 Content-Transfer-Encoding: Quoted-Printable From: "Haitao Huang" Organization: Intel Message-ID: In-Reply-To: User-Agent: Opera Mail/1.0 (Win32) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email 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 (howler.vger.email [0.0.0.0]); Thu, 19 Oct 2023 09:06:19 -0700 (PDT) On Tue, 17 Oct 2023 13:54:54 -0500, Michal Koutn=FD w= rote: > On Fri, Sep 22, 2023 at 08:06:55PM -0700, Haitao Huang = > wrote: >> +static void sgx_epc_cgroup_free(struct misc_cg *cg) >> +{ >> + struct sgx_epc_cgroup *epc_cg; >> + >> + epc_cg =3D sgx_epc_cgroup_from_misc_cg(cg); > > It should check for !epc_cg since the misc controller implementation > in misc_cg_alloc() would roll back even on non-allocated resources. Good catch. Will fix. > >> + cancel_work_sync(&epc_cg->reclaim_work); >> + kfree(epc_cg); >> +} >> + >> +static void sgx_epc_cgroup_max_write(struct misc_cg *cg) >> +{ >> + struct sgx_epc_reclaim_control rc; >> + struct sgx_epc_cgroup *epc_cg; >> + >> + epc_cg =3D sgx_epc_cgroup_from_misc_cg(cg); >> + >> + sgx_epc_reclaim_control_init(&rc, epc_cg); >> + /* Let the reclaimer to do the work so user is not blocked */ >> + queue_work(sgx_epc_cg_wq, &rc.epc_cg->reclaim_work); > > This is weird. The writer will never learn about the result of the > operation. > Right. With the new plan, this callback will be removed. Thanks Haitao