From nobody Sat Jun 13 07:47:17 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 551943D5234 for ; Fri, 8 May 2026 18:21:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778264514; cv=none; b=d/y3dx2+29CrXd5z4zMOoa9A9ikz4SyDlJrXTksCCCz5VQSlbKPCI3FPnQGX76a4wxXWaMuKuUPlwUVapOjcvlio5oT9Et2Eq3ZBxH6eL3LUOqeQFb54DT9eQzKTzkzBpk3LBojpJrd16tKTMJLKAfEBtyFwf7AmSqpj5HzZWEs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778264514; c=relaxed/simple; bh=E8mfTCDNKbeGgk6TThyI+YXc7htFJhG+Q5wfaOKsOpE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eAo2dXi4sRFuQAG8i8RnUqRVYqQbkd72RECFHoJFVzuO5TaxtQU13UzGFmTyD6mtqSPhl2LjwrbxM6u2qOSMRb93lGr6M9rkQUPv3Az90XxNiRPP6R/B/hh19ynajPF242MD0eIQDxBrpQMJAhYe1izzH17jThG7A98uETmVGU0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=auSzf3nm; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="auSzf3nm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778264512; x=1809800512; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=E8mfTCDNKbeGgk6TThyI+YXc7htFJhG+Q5wfaOKsOpE=; b=auSzf3nm0R3iRtWqEAnuuB8Bx3+LnyOx2rn1I8cRyRklFFcdO5o5xugY pP/ZFEtV0HaGf3RPQwq5lEu4Jyo71Ip3htXnuSW7WYroj2HYuQ9me8dYi 8lPOIgwtb4HrSEcg1y+QBZO50cQd5B/KjULBwmrrVllKHKAdaWWWxVKuw U8J30tY3OuASgI8rN5QojX6iK7hho5C2ey+MhJiOXFFHgoJTIXtG5xw+u ueIE2beabYltmNiX0Fvd9gSXVQRQ47bIo6WT4WfLm2D5nRjf8oj58rj0T ce0jPUO6trN5c3N0lB9FdkxjTUvy5wxzV03h9fm9cM5B/VuMgrSX/v28r w==; X-CSE-ConnectionGUID: H0CP1xehT4OLalU66QnF1Q== X-CSE-MsgGUID: VFwpo+r5SUSB9AZzwI7S8g== X-IronPort-AV: E=McAfee;i="6800,10657,11780"; a="79264147" X-IronPort-AV: E=Sophos;i="6.23,224,1770624000"; d="scan'208";a="79264147" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2026 11:21:49 -0700 X-CSE-ConnectionGUID: Nlfu6KUjSp+bFBQd/morjw== X-CSE-MsgGUID: ClGzbSbwQZSmGH4pAsU+7w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,224,1770624000"; d="scan'208";a="233776426" Received: from mdroper-mobl2.amr.corp.intel.com (HELO agluck-desk3.intel.com) ([10.124.220.98]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2026 11:21:49 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu Cc: Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH 1/4] fs/resctrl: Move functions to avoid forward references in subsequent fixes Date: Fri, 8 May 2026 11:21:40 -0700 Message-ID: <20260508182143.14592-2-tony.luck@intel.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260508182143.14592-1-tony.luck@intel.com> References: <20260508182143.14592-1-tony.luck@intel.com> 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 Content-Type: text/plain; charset="utf-8" No functional change. Just pull some functions before rdt_get_tree(). Signed-off-by: Tony Luck --- fs/resctrl/rdtgroup.c | 376 +++++++++++++++++++++--------------------- 1 file changed, 188 insertions(+), 188 deletions(-) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 5dfdaa6f9d8f..a6376a3fc4c3 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2782,6 +2782,194 @@ static void schemata_list_destroy(void) } } =20 +/* + * Move tasks from one to the other group. If @from is NULL, then all tasks + * in the systems are moved unconditionally (used for teardown). + * + * If @mask is not NULL the cpus on which moved tasks are running are set + * in that mask so the update smp function call is restricted to affected + * cpus. + */ +static void rdt_move_group_tasks(struct rdtgroup *from, struct rdtgroup *t= o, + struct cpumask *mask) +{ + struct task_struct *p, *t; + + read_lock(&tasklist_lock); + for_each_process_thread(p, t) { + if (!from || is_closid_match(t, from) || + is_rmid_match(t, from)) { + resctrl_arch_set_closid_rmid(t, to->closid, + to->mon.rmid); + + /* + * Order the closid/rmid stores above before the loads + * in task_curr(). This pairs with the full barrier + * between the rq->curr update and + * resctrl_arch_sched_in() during context switch. + */ + smp_mb(); + + /* + * If the task is on a CPU, set the CPU in the mask. + * The detection is inaccurate as tasks might move or + * schedule before the smp function call takes place. + * In such a case the function call is pointless, but + * there is no other side effect. + */ + if (IS_ENABLED(CONFIG_SMP) && mask && task_curr(t)) + cpumask_set_cpu(task_cpu(t), mask); + } + } + read_unlock(&tasklist_lock); +} + +static void free_all_child_rdtgrp(struct rdtgroup *rdtgrp) +{ + struct rdtgroup *sentry, *stmp; + struct list_head *head; + + head =3D &rdtgrp->mon.crdtgrp_list; + list_for_each_entry_safe(sentry, stmp, head, mon.crdtgrp_list) { + rdtgroup_unassign_cntrs(sentry); + free_rmid(sentry->closid, sentry->mon.rmid); + list_del(&sentry->mon.crdtgrp_list); + + if (atomic_read(&sentry->waitcount) !=3D 0) + sentry->flags =3D RDT_DELETED; + else + rdtgroup_remove(sentry); + } +} + +/* + * Forcibly remove all of subdirectories under root. + */ +static void rmdir_all_sub(void) +{ + struct rdtgroup *rdtgrp, *tmp; + + /* Move all tasks to the default resource group */ + rdt_move_group_tasks(NULL, &rdtgroup_default, NULL); + + list_for_each_entry_safe(rdtgrp, tmp, &rdt_all_groups, rdtgroup_list) { + /* Free any child rmids */ + free_all_child_rdtgrp(rdtgrp); + + /* Remove each rdtgroup other than root */ + if (rdtgrp =3D=3D &rdtgroup_default) + continue; + + if (rdtgrp->mode =3D=3D RDT_MODE_PSEUDO_LOCKSETUP || + rdtgrp->mode =3D=3D RDT_MODE_PSEUDO_LOCKED) + rdtgroup_pseudo_lock_remove(rdtgrp); + + /* + * Give any CPUs back to the default group. We cannot copy + * cpu_online_mask because a CPU might have executed the + * offline callback already, but is still marked online. + */ + cpumask_or(&rdtgroup_default.cpu_mask, + &rdtgroup_default.cpu_mask, &rdtgrp->cpu_mask); + + rdtgroup_unassign_cntrs(rdtgrp); + + free_rmid(rdtgrp->closid, rdtgrp->mon.rmid); + + kernfs_remove(rdtgrp->kn); + list_del(&rdtgrp->rdtgroup_list); + + if (atomic_read(&rdtgrp->waitcount) !=3D 0) + rdtgrp->flags =3D RDT_DELETED; + else + rdtgroup_remove(rdtgrp); + } + /* Notify online CPUs to update per cpu storage and PQR_ASSOC MSR */ + update_closid_rmid(cpu_online_mask, &rdtgroup_default); + + kernfs_remove(kn_info); + kernfs_remove(kn_mongrp); + kernfs_remove(kn_mondata); +} + +/** + * mon_get_kn_priv() - Get the mon_data priv data for this event. + * + * The same values are used across the mon_data directories of all control= and + * monitor groups for the same event in the same domain. Keep a list of + * allocated structures and re-use an existing one with the same values for + * @rid, @domid, etc. + * + * @rid: The resource id for the event file being created. + * @domid: The domain id for the event file being created. + * @mevt: The type of event file being created. + * @do_sum: Whether SNC summing monitors are being created. Only set + * when @rid =3D=3D RDT_RESOURCE_L3. + * + * Return: Pointer to mon_data private data of the event, NULL on failure. + */ +static struct mon_data *mon_get_kn_priv(enum resctrl_res_level rid, int do= mid, + struct mon_evt *mevt, + bool do_sum) +{ + struct mon_data *priv; + + lockdep_assert_held(&rdtgroup_mutex); + + list_for_each_entry(priv, &mon_data_kn_priv_list, list) { + if (priv->rid =3D=3D rid && priv->domid =3D=3D domid && + priv->sum =3D=3D do_sum && priv->evt =3D=3D mevt) + return priv; + } + + priv =3D kzalloc_obj(*priv); + if (!priv) + return NULL; + + priv->rid =3D rid; + priv->domid =3D domid; + priv->sum =3D do_sum; + priv->evt =3D mevt; + list_add_tail(&priv->list, &mon_data_kn_priv_list); + + return priv; +} + +/** + * mon_put_kn_priv() - Free all allocated mon_data structures. + * + * Called when resctrl file system is unmounted. + */ +static void mon_put_kn_priv(void) +{ + struct mon_data *priv, *tmp; + + lockdep_assert_held(&rdtgroup_mutex); + + list_for_each_entry_safe(priv, tmp, &mon_data_kn_priv_list, list) { + list_del(&priv->list); + kfree(priv); + } +} + +static void resctrl_fs_teardown(void) +{ + lockdep_assert_held(&rdtgroup_mutex); + + /* Cleared by rdtgroup_destroy_root() */ + if (!rdtgroup_default.kn) + return; + + rmdir_all_sub(); + rdtgroup_unassign_cntrs(&rdtgroup_default); + mon_put_kn_priv(); + rdt_pseudo_lock_release(); + rdtgroup_default.mode =3D RDT_MODE_SHAREABLE; + closid_exit(); + schemata_list_destroy(); + rdtgroup_destroy_root(); +} + static int rdt_get_tree(struct fs_context *fc) { struct rdt_fs_context *ctx =3D rdt_fc2context(fc); @@ -2981,194 +3169,6 @@ static int rdt_init_fs_context(struct fs_context *f= c) return 0; } =20 -/* - * Move tasks from one to the other group. If @from is NULL, then all tasks - * in the systems are moved unconditionally (used for teardown). - * - * If @mask is not NULL the cpus on which moved tasks are running are set - * in that mask so the update smp function call is restricted to affected - * cpus. - */ -static void rdt_move_group_tasks(struct rdtgroup *from, struct rdtgroup *t= o, - struct cpumask *mask) -{ - struct task_struct *p, *t; - - read_lock(&tasklist_lock); - for_each_process_thread(p, t) { - if (!from || is_closid_match(t, from) || - is_rmid_match(t, from)) { - resctrl_arch_set_closid_rmid(t, to->closid, - to->mon.rmid); - - /* - * Order the closid/rmid stores above before the loads - * in task_curr(). This pairs with the full barrier - * between the rq->curr update and - * resctrl_arch_sched_in() during context switch. - */ - smp_mb(); - - /* - * If the task is on a CPU, set the CPU in the mask. - * The detection is inaccurate as tasks might move or - * schedule before the smp function call takes place. - * In such a case the function call is pointless, but - * there is no other side effect. - */ - if (IS_ENABLED(CONFIG_SMP) && mask && task_curr(t)) - cpumask_set_cpu(task_cpu(t), mask); - } - } - read_unlock(&tasklist_lock); -} - -static void free_all_child_rdtgrp(struct rdtgroup *rdtgrp) -{ - struct rdtgroup *sentry, *stmp; - struct list_head *head; - - head =3D &rdtgrp->mon.crdtgrp_list; - list_for_each_entry_safe(sentry, stmp, head, mon.crdtgrp_list) { - rdtgroup_unassign_cntrs(sentry); - free_rmid(sentry->closid, sentry->mon.rmid); - list_del(&sentry->mon.crdtgrp_list); - - if (atomic_read(&sentry->waitcount) !=3D 0) - sentry->flags =3D RDT_DELETED; - else - rdtgroup_remove(sentry); - } -} - -/* - * Forcibly remove all of subdirectories under root. - */ -static void rmdir_all_sub(void) -{ - struct rdtgroup *rdtgrp, *tmp; - - /* Move all tasks to the default resource group */ - rdt_move_group_tasks(NULL, &rdtgroup_default, NULL); - - list_for_each_entry_safe(rdtgrp, tmp, &rdt_all_groups, rdtgroup_list) { - /* Free any child rmids */ - free_all_child_rdtgrp(rdtgrp); - - /* Remove each rdtgroup other than root */ - if (rdtgrp =3D=3D &rdtgroup_default) - continue; - - if (rdtgrp->mode =3D=3D RDT_MODE_PSEUDO_LOCKSETUP || - rdtgrp->mode =3D=3D RDT_MODE_PSEUDO_LOCKED) - rdtgroup_pseudo_lock_remove(rdtgrp); - - /* - * Give any CPUs back to the default group. We cannot copy - * cpu_online_mask because a CPU might have executed the - * offline callback already, but is still marked online. - */ - cpumask_or(&rdtgroup_default.cpu_mask, - &rdtgroup_default.cpu_mask, &rdtgrp->cpu_mask); - - rdtgroup_unassign_cntrs(rdtgrp); - - free_rmid(rdtgrp->closid, rdtgrp->mon.rmid); - - kernfs_remove(rdtgrp->kn); - list_del(&rdtgrp->rdtgroup_list); - - if (atomic_read(&rdtgrp->waitcount) !=3D 0) - rdtgrp->flags =3D RDT_DELETED; - else - rdtgroup_remove(rdtgrp); - } - /* Notify online CPUs to update per cpu storage and PQR_ASSOC MSR */ - update_closid_rmid(cpu_online_mask, &rdtgroup_default); - - kernfs_remove(kn_info); - kernfs_remove(kn_mongrp); - kernfs_remove(kn_mondata); -} - -/** - * mon_get_kn_priv() - Get the mon_data priv data for this event. - * - * The same values are used across the mon_data directories of all control= and - * monitor groups for the same event in the same domain. Keep a list of - * allocated structures and re-use an existing one with the same values for - * @rid, @domid, etc. - * - * @rid: The resource id for the event file being created. - * @domid: The domain id for the event file being created. - * @mevt: The type of event file being created. - * @do_sum: Whether SNC summing monitors are being created. Only set - * when @rid =3D=3D RDT_RESOURCE_L3. - * - * Return: Pointer to mon_data private data of the event, NULL on failure. - */ -static struct mon_data *mon_get_kn_priv(enum resctrl_res_level rid, int do= mid, - struct mon_evt *mevt, - bool do_sum) -{ - struct mon_data *priv; - - lockdep_assert_held(&rdtgroup_mutex); - - list_for_each_entry(priv, &mon_data_kn_priv_list, list) { - if (priv->rid =3D=3D rid && priv->domid =3D=3D domid && - priv->sum =3D=3D do_sum && priv->evt =3D=3D mevt) - return priv; - } - - priv =3D kzalloc_obj(*priv); - if (!priv) - return NULL; - - priv->rid =3D rid; - priv->domid =3D domid; - priv->sum =3D do_sum; - priv->evt =3D mevt; - list_add_tail(&priv->list, &mon_data_kn_priv_list); - - return priv; -} - -/** - * mon_put_kn_priv() - Free all allocated mon_data structures. - * - * Called when resctrl file system is unmounted. - */ -static void mon_put_kn_priv(void) -{ - struct mon_data *priv, *tmp; - - lockdep_assert_held(&rdtgroup_mutex); - - list_for_each_entry_safe(priv, tmp, &mon_data_kn_priv_list, list) { - list_del(&priv->list); - kfree(priv); - } -} - -static void resctrl_fs_teardown(void) -{ - lockdep_assert_held(&rdtgroup_mutex); - - /* Cleared by rdtgroup_destroy_root() */ - if (!rdtgroup_default.kn) - return; - - rmdir_all_sub(); - rdtgroup_unassign_cntrs(&rdtgroup_default); - mon_put_kn_priv(); - rdt_pseudo_lock_release(); - rdtgroup_default.mode =3D RDT_MODE_SHAREABLE; - closid_exit(); - schemata_list_destroy(); - rdtgroup_destroy_root(); -} - static void rdt_kill_sb(struct super_block *sb) { struct rdt_resource *r; --=20 2.54.0 From nobody Sat Jun 13 07:47:17 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 126E7388399 for ; Fri, 8 May 2026 18:21:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778264513; cv=none; b=qgLrNGhx+SUTJdd8b0pi6b5ayhHrP1tClBtovXqvPrQgGtGQvjZ9JEmKVs0KKGUdA5Ee1LafTuN9X9ToMXS+Ympm0tI9YaPYq7uCUOMc482/vXilb8tc5gDkSNCC5y75gPqtyPIRaeyBKkMZrUNkHbIadXsneZF4naDDEmZm7V4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778264513; c=relaxed/simple; bh=iyT99zIiNSdIpIGtVq5Qi2AwJVE0RhhZFB5O0IQZy2w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b0AbhAc+iyR2A5PUwZkwj1gb1+OHnX9deVmqbxNcik/IVyd2nGzqyf4xklFuXWUSqiczHBTN6jEq1P6y3tppC7QY8P/+3g7l4Xz9Xya+Vp+Ifb8vRgfSUeuJ22IaycdNs181zHcL2JKfvP9chCIEOTbcvCv0X3Y0sAnOpKI+GuY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Bp8rBNyR; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Bp8rBNyR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778264512; x=1809800512; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iyT99zIiNSdIpIGtVq5Qi2AwJVE0RhhZFB5O0IQZy2w=; b=Bp8rBNyR90VUViU18mYxjQ48fhijV+pWGSVQA+ewZvAMsemoyrBQiy2A QIN1+dti7WhU0ZbHYbffm2hI8+B/Wfc9i3IfGTVUFqTtkCWElyxYwQSYT zCktNxPHQN0nWiWdGfDiW8LizYAwA/k8cGDOaIwRBpUvdPZMkEVBKz622 WkFm3XlH/dEn3r1UeHkfc9/+lB4vFqUIiBQdBlvXOygjpSRXhdHa2OgKP A0+uqTAq6mSgXzMFiCCX24B4/d3O2LcYhr8iC6Va4nRL9YF67uRAbsP0S h3AU5ODCvLr6sb72U4YFhGG8qKXmu0qwS7lg3XCLhv0Dnmk2E/CVWk5my Q==; X-CSE-ConnectionGUID: HsV5BOqNTROCe+uHPEgybQ== X-CSE-MsgGUID: NzRkdHmPR5y+QW58uPW+Lw== X-IronPort-AV: E=McAfee;i="6800,10657,11780"; a="79264156" X-IronPort-AV: E=Sophos;i="6.23,224,1770624000"; d="scan'208";a="79264156" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2026 11:21:49 -0700 X-CSE-ConnectionGUID: ggcTjZMeQlKRrYyYCEzkVA== X-CSE-MsgGUID: WcjcKCZkR5K62iw8favORA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,224,1770624000"; d="scan'208";a="233776429" Received: from mdroper-mobl2.amr.corp.intel.com (HELO agluck-desk3.intel.com) ([10.124.220.98]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2026 11:21:49 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu Cc: Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH 2/4] fs/resctrl: Free mon_data structures on rdt_get_tree() failure Date: Fri, 8 May 2026 11:21:41 -0700 Message-ID: <20260508182143.14592-3-tony.luck@intel.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260508182143.14592-1-tony.luck@intel.com> References: <20260508182143.14592-1-tony.luck@intel.com> 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 Content-Type: text/plain; charset="utf-8" If mkdir_mondata_all() succeeds but a subsequent call in rdt_get_tree() fails, the mon_data structures allocated by mon_get_kn_priv() are leaked. Add mon_put_kn_priv() to the out_mondata error path to free them. mon_get_kn_priv() and mon_put_kn_priv() moved so defined before used. Fixes: ee4f0ec938ad ("fs/resctrl: Simplify allocation of mon_data structure= s") Reported-by: Reinette Chatre Assisted-by: GitHub_Copilot_CLI:claude-sonnet-4.6 Signed-off-by: Tony Luck --- fs/resctrl/rdtgroup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index a6376a3fc4c3..0db1a92aefbe 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -3067,8 +3067,10 @@ static int rdt_get_tree(struct fs_context *fc) out_psl: rdt_pseudo_lock_release(); out_mondata: - if (resctrl_arch_mon_capable()) + if (resctrl_arch_mon_capable()) { + mon_put_kn_priv(); kernfs_remove(kn_mondata); + } out_mongrp: if (resctrl_arch_mon_capable()) { rdtgroup_unassign_cntrs(&rdtgroup_default); --=20 2.54.0 From nobody Sat Jun 13 07:47:17 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 5A0423D6664 for ; Fri, 8 May 2026 18:21:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778264515; cv=none; b=ORoSUgD7fWZsLeppBvQ2wwqYioCN08BDdrEQdRFiaKUHpa2bgbKLPnOFG8wJpWfNDO0jedw44J0JxpT8AuwWn9kQP080W8ILdxFREUR4AJvFXCqjzps2zQEGuEYnr3iKQJDPG5QPAxE01QOpBNiB8hvc03YNqNdwm2cCFIxtD+A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778264515; c=relaxed/simple; bh=Gdc4Bymf/uM3xFnsXyHvyT6lXDJ0pEDBpo1UAzXz3Sc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rMkjnpYnteJN3tk7XBHQk7GjZJLil36Cs/jqks303MY5129P6STxDjTYRHoS53RnEP+9pRWM+ODfqALdABAZ3ULAcXsaLfEc7fw7POHk3US5Onhkhm3kVeZ7cFi0OP78nszxoimn7C1t3bvYEFqPnUKZLPamdg1oFPxzTzeniqw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=cbyI1mSG; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="cbyI1mSG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778264513; x=1809800513; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Gdc4Bymf/uM3xFnsXyHvyT6lXDJ0pEDBpo1UAzXz3Sc=; b=cbyI1mSGBA71ea8Zeyns9Vskqk791vBWDNIe7rPcg74xYTNOUC2++xxU hoSdap1awlNhuY7J1MxZ5AI5uiwQJ5+dqlHAYQwCFVrJsQrzHKwSIldi9 BeY2VDKaovKUd12dGPLsT2Nc5zid9/UyaijNV/Qw0s6ey+uJJIdPIAlJp WcZ1Bgq74H6YTLzfy7Gsv9P6ZFbJGGsf2Iwci7ATOkplUMaFdXoM8Y2Bl T0y5uE/RyM/7dlUXVftOShz8vArI0kC6zIo/rYMrTIdBI47EWmlxY4r6K 1YSLWOqreP3Oz+S74jl1QUZEgujc5je/5/uHxODTV5UTlSmuTxs9+zd+I w==; X-CSE-ConnectionGUID: mtIkqqxXRFWhAz6/n5+uNg== X-CSE-MsgGUID: gjIO9y16RGy4DrP1EtrrHw== X-IronPort-AV: E=McAfee;i="6800,10657,11780"; a="79264165" X-IronPort-AV: E=Sophos;i="6.23,224,1770624000"; d="scan'208";a="79264165" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2026 11:21:49 -0700 X-CSE-ConnectionGUID: qkLsgst9RiiRxErpdCrUCA== X-CSE-MsgGUID: KDtj6dQLRLW+baELP4BDLQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,224,1770624000"; d="scan'208";a="233776433" Received: from mdroper-mobl2.amr.corp.intel.com (HELO agluck-desk3.intel.com) ([10.124.220.98]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2026 11:21:49 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu Cc: Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH 3/4] fs/resctrl: Fix deadlock for errors during mount Date: Fri, 8 May 2026 11:21:42 -0700 Message-ID: <20260508182143.14592-4-tony.luck@intel.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260508182143.14592-1-tony.luck@intel.com> References: <20260508182143.14592-1-tony.luck@intel.com> 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 Content-Type: text/plain; charset="utf-8" From: Reinette Chatre Sashiko noticed[1] a deadlock in the resctrl mount code. rdt_get_tree() acquires rdtgroup_mutex before calling kernfs_get_tree(). If superblock setup fails inside kernfs_get_tree(), the VFS calls kill_sb on the same thread before the call returns. rdt_kill_sb() unconditionally attempts to acquire rdtgroup_mutex and deadlock occurs. Move the call to kernfs_get_tree() outside of locks. Add resctrl_unmount() helper to keep code consistent between the rdt_get_tree() failure path and a normal unmount. If kernfs_get_tree() fails and ctx->kfc.new_sb_created is set, then rdt_kil= l_sb() has already been called and no further cleanup is needed. Fixes: 5ff193fbde20 ("x86/intel_rdt: Add basic resctrl filesystem support") Co-developed-by: Tony Luck Signed-off-by: Tony Luck Link: https://sashiko.dev/#/patchset/20260429184858.36423-1-tony.luck%40int= el.com [1] --- fs/resctrl/rdtgroup.c | 63 ++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 0db1a92aefbe..62e1e4c30f78 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2970,6 +2970,29 @@ static void resctrl_fs_teardown(void) rdtgroup_destroy_root(); } =20 +static void resctrl_unmount(void) +{ + 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) + resctrl_arch_reset_all_ctrls(r); + + resctrl_fs_teardown(); + if (resctrl_arch_alloc_capable()) + resctrl_arch_disable_alloc(); + if (resctrl_arch_mon_capable()) + resctrl_arch_disable_mon(); + resctrl_mounted =3D false; + mutex_unlock(&rdtgroup_mutex); + cpus_read_unlock(); +} + static int rdt_get_tree(struct fs_context *fc) { struct rdt_fs_context *ctx =3D rdt_fc2context(fc); @@ -3043,10 +3066,6 @@ static int rdt_get_tree(struct fs_context *fc) if (ret) goto out_mondata; =20 - ret =3D kernfs_get_tree(fc); - if (ret < 0) - goto out_psl; - if (resctrl_arch_alloc_capable()) resctrl_arch_enable_alloc(); if (resctrl_arch_mon_capable()) @@ -3062,10 +3081,19 @@ static int rdt_get_tree(struct fs_context *fc) RESCTRL_PICK_ANY_CPU); } =20 - goto out; + rdt_last_cmd_clear(); + mutex_unlock(&rdtgroup_mutex); + cpus_read_unlock(); + + ret =3D kernfs_get_tree(fc); + /* + * resctrl can only be mounted once, new superblock only expected + * to be created once. + */ + if (!ctx->kfc.new_sb_created) + resctrl_unmount(); + return ret; =20 -out_psl: - rdt_pseudo_lock_release(); out_mondata: if (resctrl_arch_mon_capable()) { mon_put_kn_priv(); @@ -3086,7 +3114,6 @@ static int rdt_get_tree(struct fs_context *fc) out_root: rdtgroup_destroy_root(); out: - rdt_last_cmd_clear(); mutex_unlock(&rdtgroup_mutex); cpus_read_unlock(); return ret; @@ -3173,26 +3200,8 @@ static int rdt_init_fs_context(struct fs_context *fc) =20 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) - resctrl_arch_reset_all_ctrls(r); - - resctrl_fs_teardown(); - if (resctrl_arch_alloc_capable()) - resctrl_arch_disable_alloc(); - if (resctrl_arch_mon_capable()) - resctrl_arch_disable_mon(); - resctrl_mounted =3D false; + resctrl_unmount(); kernfs_kill_sb(sb); - mutex_unlock(&rdtgroup_mutex); - cpus_read_unlock(); } =20 static struct file_system_type rdt_fs_type =3D { --=20 2.54.0 From nobody Sat Jun 13 07:47:17 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 7A0EA3D5670 for ; Fri, 8 May 2026 18:21:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778264515; cv=none; b=YBP3kOHHi1GmNiFGxV+qj/ATkRbjpd7k1UQDZqlp4aKNAXkOrDFkzoDaAfUxL0S784N5lO9MRyay8syV/BJgXM5GYxjjA/FZdMcnb7g5sHI7bQDUHhBxuCd2GrKtla+M8gYTY7++ogGPNXNg5mr6MET3hdgAwiuSIDh2t7me5dM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778264515; c=relaxed/simple; bh=mqPKAKENpxqDTUksGBOXYvclAaeRmAP8h/OdzeG4Fjs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nShyaM95AMBJZXd//sqqq/TSF/tM5HHXpfrrTktRwe20rUStfcaSjmJCy1873WOZzXDUf2+oYVBKeaLwlqy8m9Dl5Rggg4I/oY3vOLK8HNR2RNFU8egXyUvf9kdg/Zwrf4tjp3RQNFNvnOL7Ctv8q67AE/Q8/jcqtmGH7imSkFo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YjJSXmwS; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YjJSXmwS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778264513; x=1809800513; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mqPKAKENpxqDTUksGBOXYvclAaeRmAP8h/OdzeG4Fjs=; b=YjJSXmwSCP+AZIOxuY65p7yk4tZzOi9iJeU9mRU3HOOL+pHpTdAwG0lF y5KVsPjDvLZBTB18PFjY+7KpR1oAVqv4jYfioEUslV+O167U/tR2A8bdp ZE38G+7NgAsVo9xFVMLYARbpfVxoWvkby0i6gFW70GWhuLz98/MVyW7WL nlnkOnxTWTjep21CsKBM5p1LIbOa6NaupPpv0JcE4JtRPYz3nRRrX0bRL vJKtl7oCT5dHzIlaXu8JwgDUnmxWFtziguZZUIbA5t7dSumF5wb3kN7oT jRr9bdD5l26xi1QuL8BMoKx1gJ9TzNOymMccfrdhAoPvAnnH9O6HjGEA/ Q==; X-CSE-ConnectionGUID: h2uv4qhpTwq0stynWF4cUA== X-CSE-MsgGUID: pR5pLt4ATi69ojWEWG6bEw== X-IronPort-AV: E=McAfee;i="6800,10657,11780"; a="79264174" X-IronPort-AV: E=Sophos;i="6.23,224,1770624000"; d="scan'208";a="79264174" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2026 11:21:50 -0700 X-CSE-ConnectionGUID: NAPzry18RjShpNYyXNeLvw== X-CSE-MsgGUID: bBPE7fLZTfCn04iitsO7hA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,224,1770624000"; d="scan'208";a="233776436" Received: from mdroper-mobl2.amr.corp.intel.com (HELO agluck-desk3.intel.com) ([10.124.220.98]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2026 11:21:49 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu Cc: Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH 4/4] fs/resctrl: Fix issues with worker threads when CPUs are taken offline Date: Fri, 8 May 2026 11:21:43 -0700 Message-ID: <20260508182143.14592-5-tony.luck@intel.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260508182143.14592-1-tony.luck@intel.com> References: <20260508182143.14592-1-tony.luck@intel.com> 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 Content-Type: text/plain; charset="utf-8" From: Reinette Chatre Sashiko noticed[1] a user-after-free in the resctrl worker thread code where the rdt_l3_mon_domain structure was freed while the worker was blocked waiting for locks. The root issue is that cancel_delayed_work() does not block in the case whe= re the worker thread is executing. This results in the race that Sashiko notic= ed, but also causes problems when the CPU that has been chosen to service the worker thread is taken offline. Note that worker threads are allowed to delete their own work_struct (see comment in kernel/workqueue.c:process_one_work()) so there can't be any problems on the return path from the worker in this case where the work_struct was deleted by other code while the worker was executing. Indicate failure of cancel_delayed_work() calls in resctrl_offline_cpu() by setting d->mbm_work_cpu or d->cqm_work_cpu to nr_cpu_ids. Make the worker threads check to see if they are no longer bound to the right CPU. In this case search the L3 domain list for any domain(s) with the work cpu set to nr_cpu_ids. In the case where the last CPU was removed from a domain, the domain has been removed from the list and there is nothing to do. If the domain still exists, then restart the worker on any of the remaining CPUs. Remove redundant cancel_delayed_work() calls from resctrl_offline_mon_domai= n(). Fixes: 24247aeeabe9 ("x86/intel_rdt/cqm: Improve limbo list processing") Co-developed-by: Tony Luck Signed-off-by: Tony Luck Link: https://sashiko.dev/#/patchset/20260429184858.36423-1-tony.luck%40int= el.com [1] --- fs/resctrl/monitor.c | 55 +++++++++++++++++++++++++++++++++++++++++++ fs/resctrl/rdtgroup.c | 27 +++++++++++++++------ 2 files changed, 75 insertions(+), 7 deletions(-) diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index 9fd901c78dc6..02434d11e024 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -791,12 +791,38 @@ static void mbm_update(struct rdt_resource *r, struct= rdt_l3_mon_domain *d, */ void cqm_handle_limbo(struct work_struct *work) { + struct rdt_resource *r =3D resctrl_arch_get_resource(RDT_RESOURCE_L3); unsigned long delay =3D msecs_to_jiffies(CQM_LIMBOCHECK_INTERVAL); struct rdt_l3_mon_domain *d; =20 cpus_read_lock(); mutex_lock(&rdtgroup_mutex); =20 + /* + * Worker was blocked waiting for the CPU it was running on to go + * offline. Handle two scenarios: + * - Worker was running on the last CPU of a domain. The domain and + * thus the work_struct has been freed so do not attempt to obtain + * domain via container_of(). All remaining domains have limbo + * handlers so the loop will not find any domains needing a + * limbo handler. Just exit. + * - Worker was running on CPU that just went offline with other + * CPUs in domain still running and available to take over the + * worker. Offline handler could not schedule a new worker on + * another CPU in the domain but signaled that this needs to be + * done by setting mbm_work_cpu to nr_cpu_ids. Find the domain + * that needs a worker and schedule it after the normal CQM + * interval. + */ + if (!is_percpu_thread()) { + list_for_each_entry(d, &r->mon_domains, hdr.list) { + if (d->cqm_work_cpu =3D=3D nr_cpu_ids) + cqm_setup_limbo_handler(d, CQM_LIMBOCHECK_INTERVAL, + RESCTRL_PICK_ANY_CPU); + } + goto out_unlock; + } + d =3D container_of(work, struct rdt_l3_mon_domain, cqm_limbo.work); =20 __check_limbo(d, false); @@ -808,6 +834,7 @@ void cqm_handle_limbo(struct work_struct *work) delay); } =20 +out_unlock: mutex_unlock(&rdtgroup_mutex); cpus_read_unlock(); } @@ -852,6 +879,34 @@ void mbm_handle_overflow(struct work_struct *work) goto out_unlock; =20 r =3D resctrl_arch_get_resource(RDT_RESOURCE_L3); + + /* + * Worker was blocked waiting for the CPU it was running on to go + * offline. Handle two scenarios: + * - Worker was running on the last CPU of a domain. The domain and + * thus the work_struct has been freed so do not attempt to obtain + * domain via container_of(). All remaining domains have overflow + * handlers so the loop will not find any domains needing an + * overflow handler. Just exit. + * - Worker was running on CPU that just went offline with other + * CPUs in domain still running and available to take over the + * worker. Offline handler could not schedule a new worker on + * another CPU in the domain but signaled that this needs to be + * done by setting mbm_work_cpu to nr_cpu_ids. Find the domain + * that needs a worker and schedule it to run after the normal + * MBM interval. This is completely safe on CPUs with wide MBM + * counters. Likely OK for old CPUs with narrow counters as the + * MBM_OVERFLOW_INTERVAL was picked conservatively. + */ + if (!is_percpu_thread()) { + list_for_each_entry(d, &r->mon_domains, hdr.list) { + if (d->mbm_work_cpu =3D=3D nr_cpu_ids) + mbm_setup_overflow_handler(d, MBM_OVERFLOW_INTERVAL, + RESCTRL_PICK_ANY_CPU); + } + goto out_unlock; + } + d =3D container_of(work, struct rdt_l3_mon_domain, mbm_over.work); =20 list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) { diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 62e1e4c30f78..bab9afd5066e 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -4343,8 +4343,7 @@ void resctrl_offline_mon_domain(struct rdt_resource *= r, struct rdt_domain_hdr *h goto out_unlock; =20 d =3D container_of(hdr, struct rdt_l3_mon_domain, hdr); - if (resctrl_is_mbm_enabled()) - cancel_delayed_work(&d->mbm_over); + if (resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID) && has_busy_rmid(= d)) { /* * When a package is going down, forcefully @@ -4355,7 +4354,6 @@ void resctrl_offline_mon_domain(struct rdt_resource *= r, struct rdt_domain_hdr *h * package never comes back. */ __check_limbo(d, true); - cancel_delayed_work(&d->cqm_limbo); } =20 domain_destroy_l3_mon_state(d); @@ -4536,13 +4534,28 @@ void resctrl_offline_cpu(unsigned int cpu) d =3D get_mon_domain_from_cpu(cpu, l3); if (d) { if (resctrl_is_mbm_enabled() && cpu =3D=3D d->mbm_work_cpu) { - cancel_delayed_work(&d->mbm_over); - mbm_setup_overflow_handler(d, 0, cpu); + if (cancel_delayed_work(&d->mbm_over)) { + mbm_setup_overflow_handler(d, 0, cpu); + } else { + /* + * Unable to schedule work on new CPU if it + * is currently running since the re-schedule + * will just force new work to run on + * current CPU. Mark domain's worker as + * needing to be rescheduled to be handled + * by worker itself. + */ + d->mbm_work_cpu =3D nr_cpu_ids; + } } if (resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID) && cpu =3D=3D d->cqm_work_cpu && has_busy_rmid(d)) { - cancel_delayed_work(&d->cqm_limbo); - cqm_setup_limbo_handler(d, 0, cpu); + if (cancel_delayed_work(&d->cqm_limbo)) { + cqm_setup_limbo_handler(d, 0, cpu); + } else { + /* Same as mbm_work_cpu case above */ + d->cqm_work_cpu =3D nr_cpu_ids; + } } } =20 --=20 2.54.0