Re: [PATCH v5 17/20] x86/resctrl: Introduce the interface switch between monitor modes
From: Markus Elfring
Date: Sat Jul 13 2024 - 03:17:16 EST
…
> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> @@ -910,6 +910,40 @@ static int rdtgroup_num_mbm_cntrs_show(struct kernfs_open_file *of,
> return 0;
> }
>
> +static ssize_t rdtgroup_mbm_mode_write(struct kernfs_open_file *of,
> + char *buf, size_t nbytes,
> + loff_t off)
> +{
…
> + cpus_read_lock();
> + mutex_lock(&rdtgroup_mutex);
> +
> + rdt_last_cmd_clear();
…
> + mutex_unlock(&rdtgroup_mutex);
> + cpus_read_unlock();
> +
> + return ret ?: nbytes;
> +}
…
Would you become interested to apply statements like the following?
* guard(cpus_read_lock)();
https://elixir.bootlin.com/linux/v6.10-rc7/source/include/linux/cleanup.h#L133
* guard(mutex)(&rdtgroup_mutex);
https://elixir.bootlin.com/linux/v6.10-rc7/source/include/linux/mutex.h#L196
Regards,
Markus