Received: by 2002:ab2:5d18:0:b0:1ef:7a0f:c32d with SMTP id j24csp399158lqk; Sat, 9 Mar 2024 16:16:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW8MuGwsM+sT/l8Keprs7N76VAnGDeBlLWyNnSNL1Zk4SksZYgit0uXT+gWzDvvmwv4U5fva73mj6MnCabBvUCBSTOZSRdGL2Yel8QP8w== X-Google-Smtp-Source: AGHT+IEs1folLRz8fpFWp+TWihRw0hTecSVdkQ0dX8/TwPRnLFU6RkqdfpgPMjyiVhnyWwcWQFE8 X-Received: by 2002:a05:6358:6585:b0:17b:6171:ada5 with SMTP id x5-20020a056358658500b0017b6171ada5mr4146672rwh.19.1710029766481; Sat, 09 Mar 2024 16:16:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1710029766; cv=pass; d=google.com; s=arc-20160816; b=lg8OOk7L+Kh7zbKrmUqiHkhPgwq9r8fFIwPcy4cs1eIbG/SHtxEO0oJnPgqw9XoQvF THD7ecpLH/d0gixJMNBomOxb58xIsM4G5hE27YWRcP9WqLB98zTjexJi0AvmtIB3CVf8 wQsd7xBfHz82ExErngMFnM8tIO+AeBLUw3VFEwlR2Ypktuld3OuTuw8GuD+b4HmHbXqh bpsSP3meC8TY0NM6RarZ6AMEwNIlZPZWP0lcH5NhNHzrP7HfRJWAmJ7nLYJj2omQDrNZ 7blnUVwSUWxFuNeorw0itCBQ/GiVrh4aS8WtYkI6PYVFQdquVbMK2J4QgdlYZiMebEdQ fbdQ== ARC-Message-Signature: i=2; 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=WRb/8WKhIRtQTrpCBz6y/wMbZ5ICcS/noIkDjLzlgAw=; fh=YX/u19dsw/s7kXJleYMvcW6BaGOA01OdcV4X0W2Ms3Q=; b=z95mb7kWVVKv5hCrxjiE/twm6SW28GBL6DGka1AvtWIFA5AdW5idmcIkG6V3QMj5UE eBK4jQhHex0vInTvC+6g8PtNZGUYfJIo2oOOLg38qPu1QKZJ5T7AWD30JSlN+TR6Yz+6 WcCQZ0hEUIGKbuBLbb3bQ4IGRMRTK3XKA0xNv6sievUqXWwmzRTPzmXY5zohz6w+7JUP TW8X/JSLcqEVHSQw36mtVZ2KcrWHT9U/HNKDlWNoTImOEEPbnOItGip6PW7uOeJrPsW8 Vbl33Qz1QbCtZHHQWNG1Ljjjy+z7ip/9s7+u0ZP0FruIFXHuwdO7kzSw9dIGHE/pK+Al bRmA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EB+VOcDl; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-98044-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98044-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 d20-20020a05622a101400b0042ef9361343si2631405qte.445.2024.03.09.16.16.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 16:16:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98044-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=EB+VOcDl; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-98044-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98044-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 B24281C20F70 for ; Sat, 9 Mar 2024 21:11:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E47750A75; Sat, 9 Mar 2024 21:10:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="EB+VOcDl" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (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 EAAE64AEE8; Sat, 9 Mar 2024 21:10:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710018652; cv=none; b=ZGtzZK+Lxo7qPSQ2ge/TEDGVyTp1s2rhc0L3bQ5XOo8F1w+IVUu6Eku6L8gVq6FRx0DC8JNUowFCglaEUkx8MRTpWbCjmKBM22QhembCP1pCHFazOJrveuuq8qxWS2aoGsRZezr3N7RJK6MUp1UcA46MwkrWxMxg3q7xDOy3iJY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710018652; c=relaxed/simple; bh=Rl7tD8xxzur5fGawhrLhrE5uAeLD7c995cPg+u795XM=; h=Content-Type:To:Cc:Subject:References:Date:MIME-Version:From: Message-ID:In-Reply-To; b=afADBVGLXI+7tPYxqGtfGg3HYyANeooXO/rXLRmc+gfiCM+Zy1eK06ZwdSFksZdfhFurM5tIrVwCLGm2sSrWVXYGmPvKzVrGZJfO18j9p3eg/G4baJJ8ZUc6E0Rv4dmRqc/WM1eihdeRik2iWBVA39g2HPQ5sWxzt6Sxcl5SjkA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=EB+VOcDl; arc=none smtp.client-ip=192.198.163.14 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=1710018651; x=1741554651; h=to:cc:subject:references:date:mime-version: content-transfer-encoding:from:message-id:in-reply-to; bh=Rl7tD8xxzur5fGawhrLhrE5uAeLD7c995cPg+u795XM=; b=EB+VOcDldo4hFjbBn4xV1XdKU3Rzn+84+B6jXe91Y/DOUKBPij4HHrVn 9XgUZaeJWrxQymzScqfxsgA/v4K9LLyn23vS5Gsu7pNOtCpGUuy1EpRNo U1ILElCOHG7pnQ/n2HEJgeemmO3q/tmtMQlAr9TV8PSQcbBFHZWQWbXM0 GAqFxzkVmQifgmtxM2O9F8A7LzFAV91Ji9SCq0gKihpo1m17uzYdIGPrM gAYnUTtcYLZ6NivK9MwthUO/XfoDU/ObbonzRXhoSm6oey0mk9vKFcr54 mthR1hLSY1aZ7S1hL9XkiG4qbiAd4I6aZNM09IuuMjWSw1pvy3x6GJmjh A==; X-IronPort-AV: E=McAfee;i="6600,9927,11008"; a="4900907" X-IronPort-AV: E=Sophos;i="6.07,113,1708416000"; d="scan'208";a="4900907" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2024 13:10:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,113,1708416000"; d="scan'208";a="11215621" Received: from hhuan26-mobl.amr.corp.intel.com ([10.92.17.168]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 09 Mar 2024 13:10:47 -0800 Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes To: =?iso-8859-15?Q?Michal_Koutn=FD?= , "Haitao Huang" 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, tim.c.chen@linux.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, chrisyan@microsoft.com Subject: Re: [PATCH v9 04/15] x86/sgx: Implement basic EPC misc cgroup functionality References: <20240205210638.157741-1-haitao.huang@linux.intel.com> <20240205210638.157741-5-haitao.huang@linux.intel.com> <7u3intene6yvlkuks5bix3tx27wog3da6ki5w2l5flaod5mjrq@flgmfdd4fbei> Date: Sat, 09 Mar 2024 15:10:44 -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: User-Agent: Opera Mail/1.0 (Win32) On Tue, 27 Feb 2024 15:35:38 -0600, Haitao Huang = wrote: > On Mon, 26 Feb 2024 12:25:58 -0600, Michal Koutn=FD = = > wrote: > >> On Mon, Feb 05, 2024 at 01:06:27PM -0800, Haitao Huang = >> wrote: >>> +static int sgx_epc_cgroup_alloc(struct misc_cg *cg); >>> + >>> +const struct misc_res_ops sgx_epc_cgroup_ops =3D { >>> + .alloc =3D sgx_epc_cgroup_alloc, >>> + .free =3D sgx_epc_cgroup_free, >>> +}; >>> + >>> +static void sgx_epc_misc_init(struct misc_cg *cg, struct = >>> sgx_epc_cgroup *epc_cg) >>> +{ >>> + cg->res[MISC_CG_RES_SGX_EPC].priv =3D epc_cg; >>> + epc_cg->cg =3D cg; >>> +} >> >> This is a possibly a nit pick but I share it here for consideration. >> >> Would it be more prudent to have the signature like >> alloc(struct misc_res *res, struct misc_cg *cg) >> so that implementations are free of the assumption of how cg and res = are >> stored? >> >> >> Thanks, >> Michal > > Will do. > > Thanks > Haitao > Actually, because the root node is initialized in sgx_cgroup_init(), whi= ch = only has access to misc_cg_root() so we can't pass a misc_res struct = without knowing cg->res relationship. We could hide it with a getter, bu= t = I think it's a little overkill at the moment. I can sign up for adding = this improvement if we feel it needed in future. Thanks Haitao