Hi Babu, On 12/12/24 12:15 PM, Babu Moger wrote: > Resctrl provides option to configure events by writing to the interfaces > /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config or > /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config when BMEC (Bandwidth > Monitoring Event Configuration) is supported. > > Whenever the event configuration is updated, MBM assignments must be > revised across all monitor groups within the impacted domains. This needs imperative tone description of what this patch does. ... > @@ -1825,6 +1825,54 @@ static int mbm_local_bytes_config_show(struct kernfs_open_file *of, > return 0; > } > > +/* > + * Review the cntr_cfg domain configuration. If a matching assignment is found, > + * update the counter assignment accordingly. This is within the IPI Context, This "Review the cntr_cfg domain configuration. If a matching assignment is found," is too vague for me to make sense of what it is trying to do. Can this be made more specific? > + * so call resctrl_abmc_config_one_amd directly. > + */ > +static void resctrl_arch_update_cntr(struct rdt_resource *r, struct rdt_mon_domain *d, > + enum resctrl_event_id evtid, u32 val) > +{ > + struct cntr_config config; > + struct rdtgroup *rdtgrp; > + struct mbm_state *m; > + u32 cntr_id; > + > + for (cntr_id = 0; cntr_id < r->mon.num_mbm_cntrs; cntr_id++) { > + rdtgrp = d->cntr_cfg[cntr_id].rdtgrp; > + if (rdtgrp && d->cntr_cfg[cntr_id].evtid == evtid) { > + memset(&config, 0, sizeof(struct cntr_config)); > + config.r = r; > + config.d = d; > + config.evtid = evtid; > + config.rmid = rdtgrp->mon.rmid; > + config.closid = rdtgrp->closid; > + config.cntr_id = cntr_id; > + config.val = val; > + config.assign = 1; > + > + resctrl_abmc_config_one_amd(&config); > + > + m = get_mbm_state(d, rdtgrp->closid, rdtgrp->mon.rmid, evtid); > + if (m) > + memset(m, 0, sizeof(struct mbm_state)); > + } > + } > +} > + > +static void resctrl_mon_event_config_set(void *info) > +{ > + struct mon_config_info *mon_info = info; > + struct rdt_mon_domain *d = mon_info->d; > + struct rdt_resource *r = mon_info->r; > + > + resctrl_arch_mon_event_config_set(d, mon_info->evtid, mon_info->mon_config); > + > + /* Check if assignments needs to be updated */ > + if (resctrl_arch_mbm_cntr_assign_enabled(r)) > + resctrl_arch_update_cntr(r, d, mon_info->evtid, > + mon_info->mon_config); > +} > > static void mbm_config_write_domain(struct rdt_resource *r, > struct rdt_mon_domain *d, u32 evtid, u32 val) > @@ -1840,6 +1888,7 @@ static void mbm_config_write_domain(struct rdt_resource *r, > if (config_val == INVALID_CONFIG_VALUE || config_val == val) > return; > > + mon_info.r = r; > mon_info.d = d; > mon_info.evtid = evtid; > mon_info.mon_config = val; > @@ -1851,7 +1900,7 @@ static void mbm_config_write_domain(struct rdt_resource *r, > * on one CPU is observed by all the CPUs in the domain. > */ > smp_call_function_any(&d->hdr.cpu_mask, > - resctrl_arch_mon_event_config_set, > + resctrl_mon_event_config_set, > &mon_info, 1); > > /* Reinette