[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8b23eade-9015-4d40-b9f9-f7cf5a9d08c6@amd.com>
Date: Wed, 21 Aug 2024 13:08:38 -0500
From: "Moger, Babu" <babu.moger@....com>
To: Reinette Chatre <reinette.chatre@...el.com>, corbet@....net,
fenghua.yu@...el.com, tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com
Cc: x86@...nel.org, hpa@...or.com, paulmck@...nel.org, rdunlap@...radead.org,
tj@...nel.org, peterz@...radead.org, yanjiewtw@...il.com,
kim.phillips@....com, lukas.bulwahn@...il.com, seanjc@...gle.com,
jmattson@...gle.com, leitao@...ian.org, jpoimboe@...nel.org,
rick.p.edgecombe@...el.com, kirill.shutemov@...ux.intel.com,
jithu.joseph@...el.com, kai.huang@...el.com, kan.liang@...ux.intel.com,
daniel.sneddon@...ux.intel.com, pbonzini@...hat.com, sandipan.das@....com,
ilpo.jarvinen@...ux.intel.com, peternewman@...gle.com,
maciej.wieczor-retman@...el.com, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, eranian@...gle.com, james.morse@....com
Subject: Re: [PATCH v6 19/22] x86/resctrl: Introduce the interface to switch
between monitor modes
Hi Reinette,
On 8/16/24 16:42, Reinette Chatre wrote:
> Hi Babu,
>
> On 8/6/24 3:00 PM, Babu Moger wrote:
>> +static ssize_t rdtgroup_mbm_mode_write(struct kernfs_open_file *of,
>> + char *buf, size_t nbytes,
>> + loff_t off)
>> +{
>> + int mbm_cntr_assign = resctrl_arch_get_abmc_enabled();
>
> This needs to be protected by the mutex.
Agree.. Will do.
>
>> + struct rdt_resource *r = of->kn->parent->priv;
>> + int ret = 0;
>> +
>> + /* Valid input requires a trailing newline */
>> + if (nbytes == 0 || buf[nbytes - 1] != '\n')
>> + return -EINVAL;
>> +
>> + buf[nbytes - 1] = '\0';
>> +
>> + cpus_read_lock();
>> + mutex_lock(&rdtgroup_mutex);
>> +
>> + rdt_last_cmd_clear();
>> +
>> + if (!strcmp(buf, "legacy")) {
>> + if (mbm_cntr_assign)
>> + resctrl_arch_mbm_cntr_assign_disable();
>> + } else if (!strcmp(buf, "mbm_cntr_assign")) {
>> + if (!mbm_cntr_assign) {
>> + rdtgroup_mbm_cntr_reset(r);
>> + ret = resctrl_arch_mbm_cntr_assign_enable();
>> + }
>> + } else {
>> + ret = -EINVAL;
>> + }
>> +
>> + mutex_unlock(&rdtgroup_mutex);
>> + cpus_read_unlock();
>> +
>> + return ret ?: nbytes;
>> +}
>> +
>
> Reinette
>
--
Thanks
Babu Moger
Powered by blists - more mailing lists