Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp27545lqp; Fri, 12 Apr 2024 09:34:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWwwvQoF1XDzk9ZEqJZmqYgjZZN04tEdfTDpgctmCIoccfhI3YFkxSGAo3wcfWd+kz5pkHWK2LSEd711ueEdEREPTvUdFg4dKfA2hdIvg== X-Google-Smtp-Source: AGHT+IFIAw70K0hQ7LL7HVIUNegCkJHphy8lbcJ48fETZwGL9/MFH2wX8wmE7C6bGVe0vCfciaZ3 X-Received: by 2002:a17:90a:ae15:b0:2a3:4544:ea80 with SMTP id t21-20020a17090aae1500b002a34544ea80mr3177928pjq.5.1712939640748; Fri, 12 Apr 2024 09:34:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712939640; cv=pass; d=google.com; s=arc-20160816; b=huwer3ABnX3Ja7bIah05kPazmzD39Z9iIecyuU5OTNNAAVQl3GIh91Rva0OZHRNHyw uJMGQ+dOXc+S8UwIAPskfH/Hhj4cNo4vd0O+HrH520QD5nmcx4J5gV+y83JvYGDFR4fe WfkAqvGV6e2Aw0Xg/FU6kxv9x0PYwCPHR6vO3ZlsXHHBgcWNqRfyWCPAjw5G64PoUrQB KCoQYQbIyI6Yzhf6KwTqq3hEc+ZqUG1vs4u5E/modOFk4GAcQ/HqywB1c07SgBvkdDZw /TRVV8mSkaRrsVg4Qk6uXVoPRPnD53gVM7EbiXUPLG1GDkN0KRzMbI0H9m6q+vJRwnXn cMGg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=tIrJqj62Lpt4X811J/pxAa1hgk+IGYOSJ0oo8dET8FE=; fh=YJ7GNJzNTpZo2CxRq9D+SewrZvpe6OJuBa4EsT7MJAc=; b=HiIH5zg21GpZVJw3cc/Hl2Sk5LFzHOOitEQCPYmHjb+J3Mj9ue1uutjBKFvfdo66h5 273PpS2L+t7VlvxcFbMLne4S6XYPHr1M5L3ABxuWxDIj928g50vBDGsGZncB+u4C/4Zv Qk7xIv4a1l+axFY2ZkNq+2BWn+KcGQcb2ORagYlUxMJBtasoCnHd+Qywws5H0HiIY3kZ c/j/uDx1hqTzPQ79QpZJktN9Qda9HCynqHCVwxypdnHRtUJ2Hn5WbbWmavH9HWD+MVry neTXrtTMb9Z1nGuZ2zkFPKDJyqrNWx7rwtjGW5eqGz3PE0P2JXakTuua01CnDSnUzLJG HP5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-143045-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143045-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id j34-20020a63fc22000000b005d8b7053276si3446911pgi.160.2024.04.12.09.34.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 09:34:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143045-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-143045-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143045-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 484CFB22C7E for ; Fri, 12 Apr 2024 16:18:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 831D2149C68; Fri, 12 Apr 2024 16:17:50 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9AE6D148850 for ; Fri, 12 Apr 2024 16:17:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712938670; cv=none; b=nmxWJVhcSnNhyLAtTwx4S1/MOfTqZZPASP4YDQqxZOyDxm+6Jim/UOiEDWx3rXfn03Ki7DQ8p1vgDBFnUVLm22uXRDK2cQ9wKJYjsQ/aQNocJix8umPYLNOr+W6WZ/QuNe9kEZHgnnmXFfXeyyJ/PkkKVO7YP8UHX0ndRQM/0XE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712938670; c=relaxed/simple; bh=23qXPzccGbJUkVqJ029wkcVrlAyJmFHp8rYgdXlCJPo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hGvCzPvZaUVc1yf6qxVVt/G1HrlVvsV1trlASMAMqp8DYKOpI6u9j9I+iVSpHgWDaPwNdDir7zahhHW3I/9wgAsqWn4wnOGmVWCJe/Mt/x0fPypVG2Ahm5YLKO0izE+VtC7xfPp2nHkiu5vM+bAxNtkYMHE2dxtvRrYx/UnyqKs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 19217339; Fri, 12 Apr 2024 09:18:17 -0700 (PDT) Received: from e133380.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 170173F64C; Fri, 12 Apr 2024 09:17:44 -0700 (PDT) Date: Fri, 12 Apr 2024 17:17:42 +0100 From: Dave Martin To: "Shaopeng Tan (Fujitsu)" Cc: 'James Morse' , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , "shameerali.kolothum.thodi@huawei.com" , D Scott Phillips OS , "carl@os.amperecomputing.com" , "lcherian@marvell.com" , "bobo.shaobowang@huawei.com" , "baolin.wang@linux.alibaba.com" , Jamie Iles , Xin Hao , "peternewman@google.com" , "dfustini@baylibre.com" , "amitsinght@marvell.com" , David Hildenbrand , Rex Nie Subject: Re: [PATCH v1 09/31] x86/resctrl: Add a resctrl helper to reset all the resources Message-ID: References: <20240321165106.31602-1-james.morse@arm.com> <20240321165106.31602-10-james.morse@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Apr 03, 2024 at 07:52:42AM +0000, Shaopeng Tan (Fujitsu) wrote: > Hello James, > > > On umount(), resctrl resets each resource back to its default configuration. It > > only ever does this for all resources in one go. > > > > reset_all_ctrls() is architecture specific as it works with struct > > rdt_hw_resource. > > > > Add an architecture helper to reset all resources. > > > > Signed-off-by: James Morse > > --- > > arch/x86/include/asm/resctrl.h | 2 ++ > > arch/x86/kernel/cpu/resctrl/rdtgroup.c | 16 +++++++++++----- > > 2 files changed, 13 insertions(+), 5 deletions(-) > > > > diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h > > index f61382258743..5f6a5375bb4a 100644 > > --- a/arch/x86/include/asm/resctrl.h > > +++ b/arch/x86/include/asm/resctrl.h > > @@ -15,6 +15,8 @@ > > */ > > #define X86_RESCTRL_EMPTY_CLOSID ((u32)~0) > > > > +void resctrl_arch_reset_resources(void); > > + > > /** > > * struct resctrl_pqr_state - State cache for the PQR MSR > > * @cur_rmid: The cached Resource Monitoring ID > > diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c > > b/arch/x86/kernel/cpu/resctrl/rdtgroup.c > > index 1a49c9918f8d..13c24cb18d76 100644 > > --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c > > +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c > > @@ -2859,6 +2859,14 @@ static int reset_all_ctrls(struct rdt_resource *r) > > return 0; > > } > > > > +void resctrl_arch_reset_resources(void) > > +{ > > + struct rdt_resource *r; > > + > > + for_each_capable_rdt_resource(r) > Could you explain why not "for_each_alloc_capable_rdt_resource(r)"? > > > + reset_all_ctrls(r); > > +} > > + > > /* > > * Move tasks from one to the other group. If @from is NULL, then all tasks > > * in the systems are moved unconditionally (used for teardown). > > @@ -2968,16 +2976,14 @@ static void rmdir_all_sub(void) > > > > static void rdt_kill_sb(struct super_block *sb) { > > - struct rdt_resource *r; > > - > > cpus_read_lock(); > > mutex_lock(&rdtgroup_mutex); > > > > rdt_disable_ctx(); > > > > - /*Put everything back to default values. */ > > - for_each_alloc_capable_rdt_resource(r) > This was "for_each_alloc_capable_rdt_resource(r)". > > Best regards, > Shaopeng TAN Noted for James to take a look at, thanks. If this was intentional, it probably needs more explanation -- it looks quite likely to have been unintentional, though. Cheers ---Dave