Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp33890lqg; Wed, 10 Apr 2024 14:28:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXGawZJveb/vB8lMVRlUAZ5NJZJOj4U42oNUlDczpSldU9enIF/OC/QDmzKLWM75+KMHJAzZyS5CT3Z7gwEDDuh3m7tC2Km0F3lp9KIJA== X-Google-Smtp-Source: AGHT+IEXW9LwkWZV6AEh4Lj2JzN4ZnlYZrxKnIrviquT74SHrx2SjEQJR6NyeJXyw6STNz8Wd3cr X-Received: by 2002:a17:906:f108:b0:a51:c88e:e95a with SMTP id gv8-20020a170906f10800b00a51c88ee95amr1874959ejb.23.1712784526353; Wed, 10 Apr 2024 14:28:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712784526; cv=pass; d=google.com; s=arc-20160816; b=t0C61UUMOH0yQ3hWmgp0n2XVAG8FcM8gvdbXVVdz/oq+5xFSlE2mizIuoAB+x65kyy 4gJReC5QjnFOmHkKd950EJm0Lny4Q5XQTveWMurVASRuhriZAePgsadur/dc8n4gh+T9 1B5ttmiN38p1Yc7brTmiPQo9w48siuHDoa61DbLb17irEpHy4g23MpSMcpRjQ4sSRcCl /9AaQamBJc3eyr6tIWF5ag8K/KuMrOWyxboqGy6ed1ALDP8rXT5aHdN5zpNOUZv4ej4g 3d2PectDlz74M5vxy5nNIm1nHkn3Oxv32BuN5l6uQkubNy05/WnF0lHgwCLftJBKJi9w 7d3A== 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=NJGAgDZiBJv4XLfzTxciaGnQTxczbDLfD8Zhc12Q9WM=; fh=B8ThHU7mlbED90+HdMQILVYCTk/M3RnVnDODGmWzWc0=; b=jXRHMucQJhE/KBJQkreOO7TQYtJOgc/JZgL91ZpVqbGLM3Nj/CCnxIQJkv45vgDJR2 KdpmhbsdKl1HU9kWVzWpa124OumHcGhxXodpb5LebDjXVOCuiZDIeaxJfQSMfNCaqLdn fxZIOVtdeYqz3kTUwja6xgtohBD5E/5CQX7unVLKlSnJdzX10nYuYvYS5SzovU+LZ7Yg 4odPDnLoQKGOg0mH4lgb032+fM737QZ8X0cW5Y3XH/gotc6CesKUwZ0f83n5kQ3JBMF2 HMdsT4ZZhu0DTfyTWxJWGi36pLt63Bm3dFL4UwdFu0D6j6coh/MVcU4+N6g8GCxhHyVh UZDA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GgK8ySu+; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-139203-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139203-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id kx20-20020a170907775400b00a51d9d7bc2fsi49037ejc.66.2024.04.10.14.28.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 14:28:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139203-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GgK8ySu+; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-139203-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139203-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 am.mirrors.kernel.org (Postfix) with ESMTPS id CB0C91F2A419 for ; Wed, 10 Apr 2024 18:29:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB6F8180A82; Wed, 10 Apr 2024 18:28:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GgK8ySu+" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 88A731802BC; Wed, 10 Apr 2024 18:28:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712773692; cv=none; b=oAIlpUoxZm+jTlMjBv36jm53ZaZRJ5UCl8p3AQ5NokynIq14jHNhSrX7NEVljQCCOHJEsRzMrDiHfPrGWbjU1NIrDsP35+bntrgxksTuHxTkDYYJwX9loHNWCP0ECddurMvLyx2sUxqly0KF7JwVN/rZBr8IUk32j78yKDewJvc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712773692; c=relaxed/simple; bh=UZ42VS9dtADlg2+VEy0SyUfnbOwQEK+dXac4rGfc8xg=; h=Content-Type:To:Cc:Subject:References:Date:MIME-Version:From: Message-ID:In-Reply-To; b=BwCp5vdMLnXQAaDGzK9jp8PozT5U///Xtiza6/CFbHfFhB5RJWejuuGUan4ESfnISgkZx0ODDtYg3s4hJQjd7dWWBXL3B8d28Xb3m63wCgrDnz1x/k+wLN9vF/0jgIDKQ6XhUetRqLD35OMefHlj12DPLuoK0bBK/mOGjJtXmHg= 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=GgK8ySu+; arc=none smtp.client-ip=192.198.163.9 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=1712773691; x=1744309691; h=to:cc:subject:references:date:mime-version: content-transfer-encoding:from:message-id:in-reply-to; bh=UZ42VS9dtADlg2+VEy0SyUfnbOwQEK+dXac4rGfc8xg=; b=GgK8ySu+LmK/AZndZkqBPgI3jjofqrk+Z6V/SxgFMtQhHpk8Sk1W/zAX BLLEJHC+yeKLxh2WRpjNSTi73+UimWzIlJHs+MG2am41tJaADX18rXrFW Hulp7k62CBHxkJXvSCFy/37ky3wbZZ2K8g9CNEBQLFQ3UhtNSEblsKq3O lD7MsPTBnQcWdnNz0hnp2XodZA/o03zE7BSgpWnUgPLqrJ2XqdvPFb85C 2xfBJVLz8Pcr78mWJQZIGOuiecMeruynspPIiLPbjYJ5fC4hde7GEbl5S Pv6dLiA8c9fvdiLdcgH9vMLVUFoYHnm+ZpL5n9843i1nAIB1nYBPsOF0M w==; X-CSE-ConnectionGUID: e7AW/aTUQ1K2nBtc9bVW3Q== X-CSE-MsgGUID: xKrdm88KSMO/9Tli1OxfgQ== X-IronPort-AV: E=McAfee;i="6600,9927,11039"; a="18869346" X-IronPort-AV: E=Sophos;i="6.07,191,1708416000"; d="scan'208";a="18869346" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2024 11:28:10 -0700 X-CSE-ConnectionGUID: x+/R/9nSQg6TSrvNc6m2cw== X-CSE-MsgGUID: zStVy4rMR+S1RH81HMv71g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,191,1708416000"; d="scan'208";a="20682448" Received: from hhuan26-mobl.amr.corp.intel.com ([10.92.17.168]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/AES256-SHA; 10 Apr 2024 11:28:07 -0700 Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes To: =?iso-8859-15?Q?Michal_Koutn=FD?= , "Haitao Huang" Cc: "hpa@zytor.com" , "tim.c.chen@linux.intel.com" , "linux-sgx@vger.kernel.org" , "x86@kernel.org" , "dave.hansen@linux.intel.com" , "jarkko@kernel.org" , "cgroups@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "tglx@linutronix.de" , "Mehta, Sohil" , "tj@kernel.org" , "mingo@redhat.com" , "bp@alien8.de" , "Huang, Kai" , "mikko.ylinen@linux.intel.com" , "seanjc@google.com" , "anakrish@microsoft.com" , "Zhang, Bo" , "kristen@linux.intel.com" , "yangjie@microsoft.com" , "Li, Zhiquan1" , "chrisyan@microsoft.com" Subject: Re: Re: [PATCH v10 12/14] x86/sgx: Turn on per-cgroup EPC reclamation References: <20240328002229.30264-1-haitao.huang@linux.intel.com> <20240328002229.30264-13-haitao.huang@linux.intel.com> <7a21c0de-ba59-4e76-8d67-70957f9db581@intel.com> Date: Wed, 10 Apr 2024 13:28:06 -0500 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, 09 Apr 2024 10:34:06 -0500, Haitao Huang = wrote: > On Tue, 09 Apr 2024 04:03:22 -0500, Michal Koutn=FD = = > wrote: > >> On Mon, Apr 08, 2024 at 11:23:21PM -0500, Haitao Huang = >> wrote: >>> It's always non-NULL based on testing. >>> >>> It's hard for me to say definitely by reading the code. But IIUC >>> cgroup_disable command-line only blocks operations in /sys/fs/cgroup= = >>> so user >>> space can't set up controllers and config limits, etc., for the = >>> diasabled >>> ones. Each task->cgroups would still have a non-NULL pointer to the = = >>> static >>> root object for each cgroup that is enabled by KConfig, so >>> get_current_misc_cg() thus sgx_get_current_cg() should not return N= ULL >>> regardless 'cgroup_disable=3Dmisc'. >>> >>> Maybe @Michal or @tj can confirm? >> >> The current implementation creates root css object (see cgroup_init()= , >> cgroup_ssid_enabled() check is after cgroup_init_subsys()). >> I.e. it will look like all tasks are members of root cgroup wrt given= >> controller permanently and controller attribute files won't exist. >> >> (It is up to the controller implementation to do further optimization= >> based on the boot-time disablement (e.g. see uses of >> mem_cgroup_disabled()). Not sure if this is useful for misc controlle= r.) >> >> As for the WARN_ON(1), taking example from memcg -- NULL is best >> synonymous with root. It's a judgement call which of the values to st= ore >> and when to intepret it. >> >> HTH, >> Michal > Thanks for the info. > > The way I see it, misc does not have special handling like memcg so = > every task at least belong to the root(default) group even if it's = > disabled by command line parameter. So we would not get NULL from = > get_current_misc_cg(). I think I'll keep the WARN_ON_ONCE for now as a= = > reminder in case misc do have custom support for disabling in future. > Actually I think it makes more sense just add some comments instead of = WARN. That's what I did in v11 now. Thanks Haitao