[PATCH v2 2/2] fs/resctrl: Give a monitor domain the counters the groups already use

Ben Horgan ben.horgan at arm.com
Fri Nov 13 08:14:48 PST 2026


Hi Jinjie,

On 13/11/2026 08:35, tizi4590 wrote:
> From: Jinjie Ruan <ruanjinjie at huawei.com>
> 
> With assignable MBM counters, resctrl can be mounted while all CPUs of
> a monitor domain go offline and one of them comes back, either through
> CPU hotplug or because hibernation takes the non-boot CPUs offline. The
> domain is destroyed and re-created, and the new domain starts with no
> counters assigned. Counters are otherwise only assigned when a group is
> created, when rdtgroup_assign_cntrs() takes a free counter in each
> monitor domain for each MBM event, so no code revisits the groups that
> already exist.
> 
> Those groups read "Unassigned" on the new domain, on any system with
> assignable MBM counters. A counter assigned to them later through
> mbm_L3_assignments is the lowest free one in that domain, so the same
> group can end up with a different counter ID on different domains. For
> example, with the counter ID each group uses for mbm_total_bytes and
> "_" for none:
> 
>                                domain 0         domain 1
>   mount, mkdir g1              default=0 g1=1   default=0 g1=1
>   all CPUs of domain 1 offline default=0 g1=1   (destroyed)
>   one CPU of domain 1 online   default=0 g1=1   default=_ g1=_
>   assign g1 on domain 1        default=0 g1=1   default=_ g1=0
> 
> Each domain has its own counters, so g1 can use counter 0 on domain 1
> and counter 1 on domain 0 without affecting the other domain, but until
> it is assigned on domain 1 it reads Unassigned there.

I brought this up before and it was assessed that no change was required:
https://lore.kernel.org/lkml/171f92a3-fa2e-44fb-b0d1-1250c72e31d1@amd.com/

Do you have any particular reason for wanting this behaviour?

Thanks,

Ben

> 
> Assign the counters when the domain comes online, after its state is
> set up. Give each enabled MBM event of every group, including the
> monitor groups under mon_groups/, the counter ID the group uses in
> another domain, and leave the event unassigned when that ID is already
> taken on the new domain. Skip groups in pseudo-lock mode, as their RMID
> has been freed and they are not monitored.
> 
> A group that has no counter for an event in any domain stays unassigned
> on the new domain, as it was before. mbm_assign_on_mkdir only applies
> when a group is created, and counters that the user removed through
> mbm_L3_assignments stay removed.
> 
> Fixes: ef712fe97ec5 ("fs/resctrl: Auto assign counters on mkdir and clean up on group removal")
> Signed-off-by: Jinjie Ruan <ruanjinjie at huawei.com>
> Cc: <stable at vger.kernel.org>
> Cc: Tony Luck <tony.luck at intel.com>
> Cc: Reinette Chatre <reinette.chatre at intel.com>
> Cc: Babu Moger <babu.moger at amd.com>
> Cc: James Morse <james.morse at arm.com>
> Cc: Ben Horgan <ben.horgan at arm.com>
> Cc: Dave Martin <Dave.Martin at arm.com>
> ---
> Changes in v2:
> - Drop the MPAM part of the changelog, the MPAM driver is fixed by
>   "arm_mpam: resctrl: Use the domain's counter ID".
> - Link to v1: https://lore.kernel.org/all/20261106094537.2337188-1-ruanjinjie@huawei.com/



More information about the linux-arm-kernel mailing list