The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] fs/resctrl: Fix counter auto-assignment on mkdir with mbm_event enabled
@ 2025-09-16 17:25 Babu Moger
  2025-09-16 21:58 ` Reinette Chatre
  2025-09-17  9:38 ` [tip: x86/cache] " tip-bot2 for Babu Moger
  0 siblings, 2 replies; 6+ messages in thread
From: Babu Moger @ 2025-09-16 17:25 UTC (permalink / raw)
  To: babu.moger, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	bp
  Cc: x86, linux-kernel

Found that the automatic counter assignment is not working as expected when
"mbm_event" is enabled. Counters are being assigned regardless of whether
mbm_assign_on_mkdir is enabled or not.

The logic was mistakenly placed in rdtgroup_unassign_cntrs() instead of
rdtgroup_assign_cntrs().

Fix it by moving the code snippet to rdtgroup_assign_cntrs().

Fixes: ef712fe97ec57 ("fs/resctrl: Auto assign counters on mkdir and clean up on group removal")
Signed-off-by: Babu Moger <babu.moger@amd.com>
---
This issue was introduced during the rebase from v17 [1] to v18 [2].
https://lore.kernel.org/lkml/1ee0f8674f0ab48bdbc3e05c11b7df30d6fa53fe.1755224735.git.babu.moger@amd.com/ # [1]
https://lore.kernel.org/lkml/db4240e3d815c3f193402b36723995427ec358b0.1757108044.git.babu.moger@amd.com/ # [2]
---
 fs/resctrl/monitor.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
index 50c24460d992..4076336fbba6 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -1200,7 +1200,8 @@ void rdtgroup_assign_cntrs(struct rdtgroup *rdtgrp)
 {
 	struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
 
-	if (!r->mon_capable || !resctrl_arch_mbm_cntr_assign_enabled(r))
+	if (!r->mon_capable || !resctrl_arch_mbm_cntr_assign_enabled(r) ||
+	    !r->mon.mbm_assign_on_mkdir)
 		return;
 
 	if (resctrl_is_mon_event_enabled(QOS_L3_MBM_TOTAL_EVENT_ID))
@@ -1258,8 +1259,7 @@ void rdtgroup_unassign_cntrs(struct rdtgroup *rdtgrp)
 {
 	struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
 
-	if (!r->mon_capable || !resctrl_arch_mbm_cntr_assign_enabled(r) ||
-	    !r->mon.mbm_assign_on_mkdir)
+	if (!r->mon_capable || !resctrl_arch_mbm_cntr_assign_enabled(r))
 		return;
 
 	if (resctrl_is_mon_event_enabled(QOS_L3_MBM_TOTAL_EVENT_ID))
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-09-18  0:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-16 17:25 [PATCH] fs/resctrl: Fix counter auto-assignment on mkdir with mbm_event enabled Babu Moger
2025-09-16 21:58 ` Reinette Chatre
2025-09-16 22:46   ` Moger, Babu
2025-09-17  9:26     ` Borislav Petkov
2025-09-18  0:42       ` Moger, Babu
2025-09-17  9:38 ` [tip: x86/cache] " tip-bot2 for Babu Moger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox