From: Ben Horgan <ben.horgan@arm.com>
To: Reinette Chatre <reinette.chatre@intel.com>,
tony.luck@intel.com, james.morse@arm.com, Dave.Martin@arm.com,
babu.moger@amd.com, bp@alien8.de, tglx@linutronix.de,
dave.hansen@linux.intel.com
Cc: x86@kernel.org, hpa@zytor.com, fustini@kernel.org,
fenghuay@nvidia.com, peternewman@google.com,
linux-kernel@vger.kernel.org, patches@lists.linux.dev
Subject: Re: [PATCH 06/11] fs/resctrl: Pass error reading event through to user space
Date: Tue, 17 Mar 2026 17:08:59 +0000 [thread overview]
Message-ID: <bf676288-5404-4c63-bf9f-ce2382f7ae91@arm.com> (raw)
In-Reply-To: <6ceb56817d137bee96a5e4508657bf9080cb4acf.1772476561.git.reinette.chatre@intel.com>
Hi Reinette,
On 3/2/26 18:46, Reinette Chatre wrote:
> Reading of event data is managed through populating a struct rmid_read with
> properties of event needing to be read. This data is dispatched to an
> appropriate CPU and upon completion any error can be found in rmid_read::err,
> or on success the event data will be in rmid_read::val.
>
> rmid_read::err is not updated in the unlikely scenario that the reading
> of the event was dispatched to a wrong CPU. If this ever occurs due to
> a bug in resctrl the user space read will return "success" but the data
> reported will be invalid.
>
> Ensure accurate error reporting so that if there may be an issue with
> how resctrl picks a CPU it could be learned with an error to user space
> instead of silent failure.
Looks good to me. mon_event_count() won't discard the error as the same
cpu and domain choice is used for each __mon_event_count() call.
Reviewed-by: Ben Horgan <ben.horgan@arm.com>
>
> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
> ---
> fs/resctrl/monitor.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
> index 421c70f96426..f1a08fdbdd61 100644
> --- a/fs/resctrl/monitor.c
> +++ b/fs/resctrl/monitor.c
> @@ -453,8 +453,10 @@ static int __l3_mon_event_count(struct rdtgroup *rdtgrp, struct rmid_read *rr)
> }
>
> /* Reading a single domain, must be on a CPU in that domain. */
> - if (!cpumask_test_cpu(cpu, &d->hdr.cpu_mask))
> + if (!cpumask_test_cpu(cpu, &d->hdr.cpu_mask)) {
> + rr->err = -EIO;
> return -EINVAL;
> + }
> if (rr->is_mbm_cntr)
> rr->err = resctrl_arch_cntr_read(rr->r, d, closid, rmid, cntr_id,
> rr->evt->evtid, &tval);
> @@ -491,8 +493,10 @@ static int __l3_mon_event_count_sum(struct rdtgroup *rdtgrp, struct rmid_read *r
> }
>
> /* Summing domains that share a cache, must be on a CPU for that cache. */
> - if (!cpumask_test_cpu(cpu, &rr->ci->shared_cpu_map))
> + if (!cpumask_test_cpu(cpu, &rr->ci->shared_cpu_map)) {
> + rr->err = -EIO;
> return -EINVAL;
> + }
>
> /*
> * Legacy files must report the sum of an event across all
next prev parent reply other threads:[~2026-03-17 17:09 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 18:46 [PATCH 00/11] x86,fs/resctrl: Improve resctrl quality and consistency Reinette Chatre
2026-03-02 18:46 ` [PATCH 01/11] fs/resctrl: Add missing return value descriptions Reinette Chatre
2026-03-02 18:46 ` [PATCH 02/11] fs/resctrl: Avoid "may be used uninitialized" warning Reinette Chatre
2026-03-02 18:46 ` [PATCH 03/11] fs/resctrl: Use correct format specifier for printing error pointers Reinette Chatre
2026-03-02 18:46 ` [PATCH 04/11] x86/resctrl: Protect against bad shift Reinette Chatre
2026-03-02 18:46 ` [PATCH 05/11] fs/resctrl: Use accurate type for rdt_resource::rid Reinette Chatre
2026-03-03 18:20 ` Luck, Tony
2026-03-03 19:06 ` Reinette Chatre
2026-03-03 19:54 ` Luck, Tony
2026-03-03 22:29 ` Reinette Chatre
2026-03-03 23:26 ` Luck, Tony
2026-03-17 11:23 ` Ben Horgan
2026-03-17 17:34 ` Reinette Chatre
2026-03-02 18:46 ` [PATCH 06/11] fs/resctrl: Pass error reading event through to user space Reinette Chatre
2026-03-17 17:08 ` Ben Horgan [this message]
2026-03-02 18:46 ` [PATCH 07/11] fs/resctrl: Add last_cmd_status support for writes to max_threshold_occupancy Reinette Chatre
2026-03-17 17:13 ` Ben Horgan
2026-03-02 18:46 ` [PATCH 08/11] fs/resctrl: Use accurate and symmetric exit flows Reinette Chatre
2026-03-02 18:46 ` [PATCH 09/11] fs/resctrl: Use stricter checks on input to cpus/cpus_list file Reinette Chatre
2026-03-02 18:46 ` [PATCH 10/11] fs/resctrl: Change last_cmd_status custom during input parsing Reinette Chatre
2026-03-17 17:20 ` Ben Horgan
2026-03-02 18:46 ` [PATCH 11/11] fs/resctrl: Communicate resource group deleted error via last_cmd_status Reinette Chatre
2026-03-02 23:37 ` [PATCH 00/11] x86,fs/resctrl: Improve resctrl quality and consistency Luck, Tony
2026-03-03 2:18 ` Reinette Chatre
2026-03-04 11:48 ` Ben Horgan
2026-03-16 22:28 ` Reinette Chatre
2026-03-16 17:44 ` Ben Horgan
2026-03-16 18:18 ` Reinette Chatre
2026-03-17 10:25 ` Ben Horgan
2026-03-17 18:09 ` Reinette Chatre
2026-03-18 11:59 ` Ben Horgan
2026-03-18 16:35 ` Reinette Chatre
2026-03-18 17:10 ` Ben Horgan
2026-03-18 20:12 ` Reinette Chatre
2026-03-19 9:53 ` Ben Horgan
2026-03-19 16:18 ` Reinette Chatre
2026-03-19 17:18 ` Ben Horgan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bf676288-5404-4c63-bf9f-ce2382f7ae91@arm.com \
--to=ben.horgan@arm.com \
--cc=Dave.Martin@arm.com \
--cc=babu.moger@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=fenghuay@nvidia.com \
--cc=fustini@kernel.org \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=peternewman@google.com \
--cc=reinette.chatre@intel.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox