Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1752176lqe; Mon, 8 Apr 2024 21:23:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVUdmiwXy+jbX+dWSf2ul/v/NLQWXl0BvzZiTujlxfd+xTEVO/2XVJ35hr94pDq07jLFE7tEVCGrJRA+vfSP3Cr18XsRj5tpj44p7PJ3g== X-Google-Smtp-Source: AGHT+IH0lCao5hiKNJeWPPGhTwu1L4TV1wo0M5MaR0IMTwtojspnLPZI3uzEe0mWq7KAYAtRO++H X-Received: by 2002:a05:6871:88a:b0:22e:dfbc:4d90 with SMTP id r10-20020a056871088a00b0022edfbc4d90mr11847102oaq.5.1712636621641; Mon, 08 Apr 2024 21:23:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712636621; cv=pass; d=google.com; s=arc-20160816; b=ZBWdn1ts9nx9Khij1W83OBbDrgqeX9FS5NXaigdEK1KU5mV2ExvjcnbcO1CFcjiK3+ 4CfVdc9rjg5fWfh/ZBfr+Ut/qd1BpIDrcGxEOO6uDPbBuQCu5gHUm/m1hgZG1QkpI3G9 eoEeaGOrMWSc495hk9TynOhADhvzUkMWYQNXYOCODs3bzu6D8JcKIASYgfMOBVEy66E1 HfLrXjr6zFxdmawyHk5+oHsIWOK39hRuR33+O5Ale95NHC2ZbZC4KQdQtqU3W5nRe6/2 FwjqiwIy3P563qRUOWR4W7qaT1FgKALR3r7bNaWlTJbpW3xzUCOYZdhtsLKOaAKnsBZe SFYQ== 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=n2VvuufAsEUOIAu7V2MJEQXI+mJKIk9mBX0fo5BjQXU=; fh=c7DqcBeHQipkJPapvB1JyMl2o5pSykTZfPfI9Aaj+Z8=; b=bb2hT3aV81oUYi/96QxVbMigqP0jx+/+tmdw0LzmSGvOj9JgZcRE3KbTm8FL1XCdYP 3H12VCtcCYEpmOQFDtgyeCzmHIOtA3MoDlTyvjCpz8LXzqzxnNsgL3FyK6iC7iAnuBtg At+FZzK6bC+KHCa2brYmRcOmKGbY5Z3e5pwS799peWAQPB6GzJ/Fpgh61ykEvdaSlL7I 0uEIxKMfhV7Jg4tVgx/iD8tKvfEYjQAo/gvvsNY4wE5AvglUvsLYHNry8VElqm30QYzd dkQL+sSr9QCqjX39wYvxH4DMV5c1i3mZec8xZreNz52vD71qqDxQMBHg6mtP/ZjpY1c6 2M+Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nTI9L8cB; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-136226-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136226-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 i20-20020aa787d4000000b006ecf5f5c0a0si7688958pfo.41.2024.04.08.21.23.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 21:23:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136226-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=nTI9L8cB; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-136226-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136226-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 13B18286FBA for ; Tue, 9 Apr 2024 04:23:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4BC260260; Tue, 9 Apr 2024 04:23:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nTI9L8cB" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 2296683CB0; Tue, 9 Apr 2024 04:23:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712636607; cv=none; b=TSOLWTfiXD9hnooT8YOKObw3vueDkId/1CQCksv3h42fJWEK58WzFY81k0d3i667KpuI3s3I5+d6iYyIZ9oeF98O5ge3O9EYgYPWyLKGGDns/uHQl3kPucwpdm+ooQK+Nxz1gZ/lCYUkF8DMFZcj9McR8m7t+GoI1wIMDHXKyX4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712636607; c=relaxed/simple; bh=SuQSgPe8CBiuq2s/IXE0JGCrExX0FOBruorD6DKwhDI=; h=Content-Type:To:Cc:Subject:References:Date:MIME-Version:From: Message-ID:In-Reply-To; b=VVfDvZPXTbd3GlqPq1NhBm4H4+c2emf+sQGcgrwzpqBqgfaZR5xiqqwzqZqKHgHDo1W0eHK354foyTHlG3hP0jpsv9GwEkd6C888o0G/3q03JAWYf9NPAovbviz+DWXyr2PMG08QbAxC4+NQsVDly8ruAs4kw9V+zvcbq/3Farg= 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=nTI9L8cB; arc=none smtp.client-ip=192.198.163.7 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=1712636606; x=1744172606; h=to:cc:subject:references:date:mime-version: content-transfer-encoding:from:message-id:in-reply-to; bh=SuQSgPe8CBiuq2s/IXE0JGCrExX0FOBruorD6DKwhDI=; b=nTI9L8cBUe4UZYDCljqedY/9k5z4cQNHJ3Hi1bouyyOjMT8aZto0tXLr vgnVPkpcfMf90M0StmFh/c8xdwZ/54bUs6QSNcJaeRD3kZuzPUIHBnIzu FxNSVfsL12baT7GjsLGS7HhZAF3vwlw98pY0aUNpyZr9l8test982VJ2A cR9GY6a1wpezTAna7wjvWMc/Qx9fAyFujL5AJbmB2sdEREUGVgwkKgOKc 9Ui8ZDxOKr5j3vmRbC1SAiJ+RoPq/1+FiUIFsOCs17IEitnha0p9/vpz6 bGxa0EOTU7ZOeaVIla0YdDzgL5BdGVS1mTdVpjFj1GnEs27X3ofvwY6IV A==; X-CSE-ConnectionGUID: nXg57YKOS6ek8UbTXoy9zg== X-CSE-MsgGUID: E+CCpb21TfeHwyDazU9tyQ== X-IronPort-AV: E=McAfee;i="6600,9927,11038"; a="33344738" X-IronPort-AV: E=Sophos;i="6.07,188,1708416000"; d="scan'208";a="33344738" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 21:23:25 -0700 X-CSE-ConnectionGUID: OqeZOLAWSVm4WyyvVODuHw== X-CSE-MsgGUID: eIudRArYTrG75Ijrlc2gPw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,188,1708416000"; d="scan'208";a="20182985" Received: from hhuan26-mobl.amr.corp.intel.com ([10.92.17.168]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/AES256-SHA; 08 Apr 2024 21:23:23 -0700 Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes To: "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" , "mkoutny@suse.com" , "tglx@linutronix.de" , "Mehta, Sohil" , "tj@kernel.org" , "mingo@redhat.com" , "bp@alien8.de" , "Huang, Kai" Cc: "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: [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: Mon, 08 Apr 2024 23:23:21 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Haitao Huang" Organization: Intel Message-ID: In-Reply-To: <7a21c0de-ba59-4e76-8d67-70957f9db581@intel.com> User-Agent: Opera Mail/1.0 (Win32) On Mon, 08 Apr 2024 17:37:10 -0500, Huang, Kai wrote: > > > On 9/04/2024 6:03 am, Haitao Huang wrote: >>>> >> The misc root cgroup is a static similar to sgx_cg_root. So >> misc_cg_root() won't be NULL >> However, based on how css_misc() was check NULL, I suppose >> sgx_get_current_cg() may be NULL when cgroup is disabled (again not >> 100% sure but we handle it anyway) > > Could you help to check? Sorry I am busy on something else thus won't > be able to do any actual check. > 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 NULL regardless 'cgroup_disable=misc'. Maybe @Michal or @tj can confirm? Thanks Haitao