[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c6c1df22-e3df-4acd-a93a-f2972cac9793@intel.com>
Date: Wed, 3 Sep 2025 10:55:04 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: <babu.moger@....com>, <corbet@....net>, <tony.luck@...el.com>,
<tglx@...utronix.de>, <mingo@...hat.com>, <bp@...en8.de>,
<dave.hansen@...ux.intel.com>
CC: <Dave.Martin@....com>, <james.morse@....com>, <x86@...nel.org>,
<hpa@...or.com>, <akpm@...ux-foundation.org>, <rostedt@...dmis.org>,
<paulmck@...nel.org>, <pawan.kumar.gupta@...ux.intel.com>, <kees@...nel.org>,
<arnd@...db.de>, <fvdl@...gle.com>, <seanjc@...gle.com>,
<thomas.lendacky@....com>, <yosry.ahmed@...ux.dev>, <xin@...or.com>,
<sohil.mehta@...el.com>, <kai.huang@...el.com>, <xiaoyao.li@...el.com>,
<peterz@...radead.org>, <mario.limonciello@....com>, <xin3.li@...el.com>,
<perry.yuan@....com>, <chang.seok.bae@...el.com>,
<linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<peternewman@...gle.com>, <eranian@...gle.com>, <gautham.shenoy@....com>
Subject: Re: [PATCH v17 25/33] fs/resctrl: Provide interface to update the
event configurations
Hi Babu,
On 9/3/25 10:38 AM, Moger, Babu wrote:
> On 9/2/25 21:41, Reinette Chatre wrote:
>> On 8/14/25 7:25 PM, Babu Moger wrote:
>>> +
>>> +ssize_t event_filter_write(struct kernfs_open_file *of, char *buf, size_t nbytes,
>>> + loff_t off)
>>> +{
>>> + struct mon_evt *mevt = rdt_kn_parent_priv(of->kn);
>>> + struct rdt_resource *r;
>>> + u32 evt_cfg = 0;
>>> + 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();
>>> +
>>> + r = resctrl_arch_get_resource(mevt->rid);
>>> + if (!resctrl_arch_mbm_cntr_assign_enabled(r)) {
>>> + rdt_last_cmd_puts("mbm_event counter assignment mode is not enabled\n");
>>> + ret = -EINVAL;
>>> + goto out_unlock;
>>> + }
>>> +
>>> + ret = resctrl_parse_mem_transactions(buf, &evt_cfg);
>>> + if (!ret && mevt->evt_cfg != evt_cfg) {
>>
>> ... is evt_cfg of 0 (a) a valid value (that will not cause hardware to fault) and
>> (b) a reasonable value to allow?
>>
>
> The value evt_cfg = 0 is valid and permitted for both ABMC and BMEC. I
> have confirmed here through verification and testing. In that case, the
> event counter will not be monitoring anything.
Thank you for checking.
I do not know what a use case for this would be but I also do not see why kernel
should prevent user space from doing this. Looks like event_filter_show() will then
just print a '\n' that is expected. Are counters expected to always return 0 in this
case or will they return an error? I am not clear on what qualifies as "invalid counter
configuration" for ABMC that results in RMID_VAL_ERROR.
Reinette
Powered by blists - more mailing lists