Re: [PATCH v8 12/25] x86/resctrl: Remove MSR reading of event configuration value

From: Reinette Chatre
Date: Tue Oct 15 2024 - 23:16:24 EST


Hi Babu,

On 10/9/24 10:39 AM, Babu Moger wrote:
> The event configuration is domain specific and initialized during domain
> initialization. The values are stored in struct rdt_hw_mon_domain.
>
> It is not required to read the configuration register every time user asks
> for it. Use the value stored in struct rdt_hw_mon_domain instead.
>
> Introduce resctrl_arch_mon_event_config_get() and
> resctrl_arch_mon_event_config_set() to get/set architecture domain specific
> mbm_total_cfg/mbm_local_cfg values.
>
> Signed-off-by: Babu Moger <babu.moger@xxxxxxx>
> ---
...


> +void resctrl_arch_mon_event_config_set(void *info)
> +{
> + struct mon_config_info *mon_info = info;
> + struct rdt_hw_mon_domain *hw_dom;
> + unsigned int index;
> +
> + index = mon_event_config_index_get(mon_info->evtid);
> + if (index == INVALID_CONFIG_INDEX)
> + return;
> +
> + wrmsr(MSR_IA32_EVT_CFG_BASE + index, mon_info->mon_config, 0);
> +
> + hw_dom = resctrl_to_arch_mon_dom(mon_info->d);
> +
> + switch (mon_info->evtid) {
> + case QOS_L3_OCCUP_EVENT_ID:
> + break;

This check does no harm but I do not think it is necessary since earlier
mon_event_config_index_get() would return INVALID_CONFIG_INDEX if the
evtid is QOS_L3_OCCUP_EVENT_ID.

> + case QOS_L3_MBM_TOTAL_EVENT_ID:
> + hw_dom->mbm_total_cfg = mon_info->mon_config;
> + break;
> + case QOS_L3_MBM_LOCAL_EVENT_ID:
> + hw_dom->mbm_local_cfg = mon_info->mon_config;

nit: unnecessary space

> + break;
> + }
> +}
> +

Reinette