lkml.org 
[lkml]   [2023]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v10 11/13] x86/resctrl: Add interface to write mbm_total_bytes_config
From
Hi Reinette,

On 1/4/23 18:29, Reinette Chatre wrote:
> Hi Babu,
>
> On 12/22/2022 3:31 PM, Babu Moger wrote:
>
> ...
>
>> +static ssize_t mbm_total_bytes_config_write(struct kernfs_open_file *of,
>> + char *buf, size_t nbytes,
>> + loff_t off)
>> +{
>> + struct rdt_resource *r = of->kn->parent->priv;
>> + int ret;
>> +
>> + /* Valid input requires a trailing newline */
>> + if (nbytes == 0 || buf[nbytes - 1] != '\n')
>> + return -EINVAL;
>> +
>> + cpus_read_lock();
> Could you please elaborate why this lock is needed here as
> well as in the following patch?

Holding the cpus_read_lock() make sure that this cpu is online while doing
this operation. This code eventually sends an IPI to write the MSR on one
of the CPUs using the cpumasks. My understanding is to make sure cpumask
is stable while handling this write.  Same thing is done in
rdtgroup_schemata_write.

Thanks

Babu


>
> Reinette
>
--
Thanks
Babu Moger

\
 
 \ /
  Last update: 2023-03-26 23:28    [W:0.051 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site