Hi Tony, On 7/13/2023 9:32 AM, Tony Luck wrote: > Add a placeholder in the array of struct rdt_hw_resource to be used > for event monitoring of systems with Sub-NUMA Cluster enabled. Could you please elaborate why a new resource is required? > > Update get_domain_id() to handle SCOPE_NODE. > > Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx> > Reviewed-by: Peter Newman <peternewman@xxxxxxxxxx> > --- > arch/x86/kernel/cpu/resctrl/internal.h | 4 +++- > arch/x86/kernel/cpu/resctrl/core.c | 12 ++++++++++++ > 2 files changed, 15 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h > index 8275b8a74f7e..243017096ddf 100644 > --- a/arch/x86/kernel/cpu/resctrl/internal.h > +++ b/arch/x86/kernel/cpu/resctrl/internal.h > @@ -435,6 +435,7 @@ enum resctrl_res_level { > RDT_RESOURCE_L2, > RDT_RESOURCE_MBA, > RDT_RESOURCE_SMBA, > + RDT_RESOURCE_NODE, > > /* Must be the last */ > RDT_NUM_RESOURCES, > @@ -442,7 +443,8 @@ enum resctrl_res_level { > > enum resctrl_scope { > SCOPE_L2_CACHE = 2, > - SCOPE_L3_CACHE = 3 > + SCOPE_L3_CACHE = 3, > + SCOPE_NODE, > }; A new resource _and_ a new scope is added. Could changelog please explain why this is required? > > static inline struct rdt_resource *resctrl_inc(struct rdt_resource *res) > diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c > index 6571514752f3..e4bd3072927c 100644 > --- a/arch/x86/kernel/cpu/resctrl/core.c > +++ b/arch/x86/kernel/cpu/resctrl/core.c > @@ -112,6 +112,16 @@ struct rdt_hw_resource rdt_resources_all[] = { > .fflags = RFTYPE_RES_MB, > }, > }, > + [RDT_RESOURCE_NODE] = > + { > + .r_resctrl = { > + .rid = RDT_RESOURCE_NODE, > + .name = "L3", > + .scope = SCOPE_NODE, > + .domains = domain_init(RDT_RESOURCE_NODE), > + .fflags = 0, > + }, > + }, > }; So the new resource has the same name, from user perspective, as RDT_RESOURCE_L3. From this perspective it thus seems to be a shadow of RDT_RESOURCE_L3 that is used as alternative for some properties of the actual RDT_RESOURCE_L3? This is starting to look as though this solution is wrenching itself into current architecture. >From what I can tell the monitoring in SNC environment needs a different domain list because of the change in scope. What else is needed in the resource that is different from the existing L3 resource? Could the monitoring scope of a resource not instead be made distinct from its allocation scope? By default monitoring and allocation scope will be the same and thus use the same domain list but when SNC is enabled then monitoring uses a different domain list. > /* > @@ -489,6 +499,8 @@ static int arch_domain_mbm_alloc(u32 num_rmid, struct rdt_hw_domain *hw_dom) > > static int get_domain_id(int cpu, enum resctrl_scope scope) > { > + if (scope == SCOPE_NODE) > + return cpu_to_node(cpu); > return get_cpu_cacheinfo_id(cpu, scope); > } > Reinette