Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2285385rbb; Tue, 27 Feb 2024 17:52:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU+PfO3Fcn8Gw12e0eVgO1fdj9Vo81BegxGQJzJv7fRCn9iT7Vw23/1Su9PDt9Mc+5ca/u6eS8lv7Ow03N7d363rDxp/9/gO0G9ZscGIA== X-Google-Smtp-Source: AGHT+IF/jCb4Bp7SHiFSQH/dFl1ntmf3rsJXpg3wkbASSfj5ZYX962zN2FBcY49TQm0H8yozzxOE X-Received: by 2002:a17:902:f78c:b0:1dc:1379:2152 with SMTP id q12-20020a170902f78c00b001dc13792152mr13799039pln.56.1709085123060; Tue, 27 Feb 2024 17:52:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709085123; cv=pass; d=google.com; s=arc-20160816; b=lWdEilSa5UbfvgaGALhGT0BFFjgfIAk/nRklQjLZGHjSyPjn2eLxR6LZ3kkP1KsgLK gR/I6StUL8P0u21l4dZb4XBc/9DSxb3PTBs8talQ9rn+YMETa9J14fWIIDl6KiYa8wwp QoWqcyUQlM6VLN82jidFuNyAs+pUiTahLzBi81NN36O3vKAabzq58Ok9wVCCBB0e7do2 /ZgYafCTlBXc3/S13YRV/S90rHHr2DZTUmU+gzkEmNClk2BqPvP6bNiwju0emDGFV8E4 bkPPZto4lgMfylo53FhYLT7a/xVVYJ8B7S3Jw9jM9TcyK4qW2Zjgx1G/ifiKcpzhee1H 84iA== 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=asBQQdtFAwQ4dX2PEnyu5tMxGfbX75DGcqPEkMGeMGo=; fh=IJzMALII5mHefDVpTF9Ib9Ct9zAIsUtw+Mcx0YAu8iI=; b=tqlPWwY67n/x6BOLcBpo+qQy6vGZycSK8Qw3dA8oR1fPnsWjLSMxb6KMfPLXhsH1BY S1NTybG/BlGxJ1/vYVAyGx9zqk6IME9/x9n/kSZ1P5LVWPOWafE11+djPJhbSDCwHpDF e/4UfB1iUVNgCiqxU3uZix71N+kzpMApbkau/TPrRH/K/NaI8PJXCVp8gvZR8E987QZn PE3IDNA3BleVK3gj6av2747N6f/r2L/d04ZCD3m5L0D/Okh6nAjzdu6zDnLr9F64wpAe 6KNjIm4XUegbrba+8zzzIedXOBxx6grvPzhm8fekJMc++xnUYhlE4prAnNGxU5Pm57tH 6avg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="naYL5/wK"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-84057-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84057-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h21-20020a170902f7d500b001db64e9d84asi2221524plw.651.2024.02.27.17.52.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 17:52:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84057-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="naYL5/wK"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-84057-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84057-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 09C9C288E9F for ; Tue, 27 Feb 2024 21:36:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BC39A14F965; Tue, 27 Feb 2024 21:35:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="naYL5/wK" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (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 6CA2914C593; Tue, 27 Feb 2024 21:35:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709069755; cv=none; b=Jhq3GasqMEj7sS+p2OuXhD5lKaarnCpLDqPmKTOWdkeEVpC4S8l0DJwNHIhbSRoH1nfzITPGLbpD43JjzPlSTj1D4YiC3A3bz/X9pU7lj5d7p5jcXUgSr0VhlUUbym+x44fZvp8oocHrke2/BZ5CPZQv6J1TwZHr+pavnqJ1hUY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709069755; c=relaxed/simple; bh=3KypCAxJS3Tqg2q5+LI4MfZmK0r5vprErdy8tQBgUdI=; h=Content-Type:To:Cc:Subject:References:Date:MIME-Version:From: Message-ID:In-Reply-To; b=JMmS+g+q1oSvuJuyGmiBikMxq0rzmHHowRNwjNp19TUdPeAbIV44vndkXRy2kltUmmLQZ4aTb49svdw54Dt3emuR1OnzIVm5yXLQM926YOZttr5fdTF7JpVnlUkIHVQG4ljWYXPBCpfkEhV6YXy1Ci9Xq7oJmzUoDXrYgurg10k= 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=naYL5/wK; arc=none smtp.client-ip=198.175.65.17 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=1709069754; x=1740605754; h=to:cc:subject:references:date:mime-version: content-transfer-encoding:from:message-id:in-reply-to; bh=3KypCAxJS3Tqg2q5+LI4MfZmK0r5vprErdy8tQBgUdI=; b=naYL5/wKNfFujApE63Eh0RMoUnxhz0kKGoJYJ+QgpotHLc41xeqs02bJ rauNI22C/QAt+Nnt3I8IuY+MHHLHMj1xMffCO3b1C9cG+iGx4uhmmibjR ohYseImqYF/VbelYmiVdQAFXV+vfoG0bzSmM2sNkSvyzXeYXwkiHTzBrt ONl1la1LljFvrfYmhKkc97ggZIaVKFCDAnCDhEDlp3MjyR+QL8dZlzVhG NAwd9Ii5BYiMzQLfmeD2otQmgNqzPPDfWJ/Q8z30msm0i7xCXnsUZ0dje Cwel7ZP4ZtL27hg0anSz0or0wcwMsehSrl9lXHWn7p5sLdX/DXLyQ1+Km w==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="3599961" X-IronPort-AV: E=Sophos;i="6.06,188,1705392000"; d="scan'208";a="3599961" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2024 13:35:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,188,1705392000"; d="scan'208";a="7160006" Received: from hhuan26-mobl.amr.corp.intel.com ([10.122.136.251]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 27 Feb 2024 13:35:39 -0800 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, 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: Tue, 27 Feb 2024 15:35:38 -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: <7u3intene6yvlkuks5bix3tx27wog3da6ki5w2l5flaod5mjrq@flgmfdd4fbei> User-Agent: Opera Mail/1.0 (Win32) On Mon, 26 Feb 2024 12:25:58 -0600, Michal Koutn=FD w= rote: > 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 a= re > stored? > > > Thanks, > Michal Will do. Thanks Haitao