From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E87A3CAE8A for ; Fri, 20 Mar 2026 17:07:13 +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=1774026434; cv=none; b=Fk4TPPOKzOzgXq4qI1C4BABuz3hwYFn03l2kkz0eSAaz21PenAlY+uKzny1geoESa3qqNFxs06VCZXVYbtw6bgGjxHbZ4nKCe5gNaa20nEw+NNZuFBORFGZk1qOYZweNzjTsjckrsIZ9jjkWPFur26/h5mEw5f4FIE8JAQCTTOE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774026434; c=relaxed/simple; bh=qwKlViBy3QLyetCaOsTCArLwXqvHYgNTa+JXxQ/GLdM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=syzJmHB/H9n3W3IL8CU0PnzC7OT/F6OanxE9DRXNCNm5Xm2AUzeHh3m9wg5wAYsGk75O8U/GPCF2hjRzQ2+NyPPEi+/XgA5GzGFkFbwR+W3/QMAIIZKjWp/dt4KlqrHJe7w60lAenqbAtZSt+NUWSdv6/NxddU0N+PZOKELc/VA= 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 B63CC165C; Fri, 20 Mar 2026 10:07:06 -0700 (PDT) Received: from [10.1.196.46] (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C07F83FA1F; Fri, 20 Mar 2026 10:07:10 -0700 (PDT) Message-ID: Date: Fri, 20 Mar 2026 17:07:09 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Thunderbird Daily Subject: Re: [PATCH v3 1/9] fs/resctrl: Fix MPAM Partid parsing errors by preserving CDP state during umount To: Zeng Heng , james.morse@arm.com, Dave.Martin@arm.com, reinette.chatre@intel.com, fenghuay@nvidia.com Cc: dave.hansen@linux.intel.com, tglx@kernel.org, mingo@redhat.com, hpa@zytor.com, bp@alien8.de, tony.luck@intel.com, babu.moger@amd.com, x86@kernel.org, linux-kernel@vger.kernel.org, wangkefeng.wang@huawei.com References: <20260317132141.1272506-1-zengheng4@huawei.com> <20260317132141.1272506-2-zengheng4@huawei.com> Content-Language: en-US From: Ben Horgan In-Reply-To: <20260317132141.1272506-2-zengheng4@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Zeng, On 3/17/26 13:21, Zeng Heng wrote: > This patch fixes a pre-existing issue in the resctrl filesystem teardown > sequence where premature clearing of cdp_enabled could lead to MPAM Partid > parsing errors. > > The closid to partid conversion logic inherently depends on the global > cdp_enabled state. However, rdt_disable_ctx() clears this flag early in > the umount path, while free_rmid() operations will reference after that. > This creates a window where partid parsing operates with inconsistent CDP > state, potentially make monitor reads with wrong partid mapping. > > Additionally, rmid_entry remaining in limbo between mount sessions may > trigger potential partid out-of-range errors, leading to MPAM fault > interrupts and subsequent MPAM disablement. > > Reorder rdt_kill_sb() to delay rdt_disable_ctx() until after > rmdir_all_sub() and resctrl_fs_teardown() complete. This ensures > all rmid-related operations finish with correct CDP state. > > Introduce rdt_flush_limbo() to flush and cancel limbo work before the > filesystem teardown completes. An alternative approach would be to cancel The code looks correct but it does introduce a subtle change of behaviour which may or may not be acceptable. A busy rmid may now be allocated after remount. Clean rmids were never guaranteed, e.g. when a domain goes offline, but this weakens the guarantee. > limbo work on umount and restart it on remount with remaked bitmap. > However, this would require substantial changes in the resctrl layer to > handle CDP state transitions across mount sessions, which is beyond the > scope of the reqpartid feature work this patchset focuses on. The current Another option to consider is whether limbo could be replaced by checking whether an rmid is busy at allocation. Do your changes here to resctrl_arch_rmid_idx_encode() have an impact on how limbo works? Thanks, Ben > fix addresses the immediate correctness issue with minimal churn. > > Signed-off-by: Zeng Heng > --- > fs/resctrl/rdtgroup.c | 24 ++++++++++++++++++++++-- > 1 file changed, 22 insertions(+), 2 deletions(-) > > diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c > index 5da305bd36c9..bc0735eef92a 100644 > --- a/fs/resctrl/rdtgroup.c > +++ b/fs/resctrl/rdtgroup.c > @@ -3165,6 +3165,25 @@ static void resctrl_fs_teardown(void) > rdtgroup_destroy_root(); > } > > +static void rdt_flush_limbo(void) > +{ > + struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3); > + struct rdt_l3_mon_domain *d; > + > + if (!IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID)) > + return; > + > + if (!resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID)) > + return; > + > + list_for_each_entry(d, &r->mon_domains, hdr.list) { > + if (has_busy_rmid(d)) { > + __check_limbo(d, true); > + cancel_delayed_work(&d->cqm_limbo); > + } > + } > +} > + > static void rdt_kill_sb(struct super_block *sb) > { > struct rdt_resource *r; > @@ -3172,13 +3191,14 @@ static void rdt_kill_sb(struct super_block *sb) > cpus_read_lock(); > mutex_lock(&rdtgroup_mutex); > > - rdt_disable_ctx(); > - > /* Put everything back to default values. */ > for_each_alloc_capable_rdt_resource(r) > resctrl_arch_reset_all_ctrls(r); > > resctrl_fs_teardown(); > + rdt_flush_limbo(); > + rdt_disable_ctx(); > + > if (resctrl_arch_alloc_capable()) > resctrl_arch_disable_alloc(); > if (resctrl_arch_mon_capable())