Re: [PATCH v16 31/34] fs/resctrl: Disable BMEC event configuration when mbm_event mode is enabled
From: Reinette Chatre
Date: Wed Jul 30 2025 - 16:11:35 EST
Hi Babu,
On 7/25/25 11:29 AM, Babu Moger wrote:
> @@ -1799,6 +1800,41 @@ static ssize_t mbm_local_bytes_config_write(struct kernfs_open_file *of,
> return ret ?: nbytes;
> }
>
> +/*
> + * resctrl_bmec_files_show() — Controls the visibility of BMEC-related resctrl
> + * files. When @show is true, the files are displayed; when false, the files
> + * are hidden.
> + * Don't treat kernfs_find_and_get failure as an error, since this function may
> + * be called regardless of whether BMEC is supported or the event is enabled.
> + */
> +static void resctrl_bmec_files_show(struct rdt_resource *r, struct kernfs_node *l3_mon_kn,
> + bool show)
> +{
> + struct kernfs_node *kn_config;
> + char name[32];
> +
> + if (!l3_mon_kn) {
> + sprintf(name, "%s_MON", r->name);
> + l3_mon_kn = kernfs_find_and_get(kn_info, name);
> + if (!l3_mon_kn)
> + return;
> + }
> +
> + kn_config = kernfs_find_and_get(l3_mon_kn, "mbm_total_bytes_config");
> + if (kn_config) {
> + kernfs_show(kn_config, show);
> + kernfs_put(kn_config);
> + }
> +
> + kn_config = kernfs_find_and_get(l3_mon_kn, "mbm_local_bytes_config");
> + if (kn_config) {
> + kernfs_show(kn_config, show);
> + kernfs_put(kn_config);
> + }
> +
> + kernfs_put(l3_mon_kn);
Looks like this will drop an extra reference if l3_mon_kn was provided as parameter.
Reinette