From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Reinette Chatre <reinette.chatre@intel.com>
Cc: shuah@kernel.org, Dave.Martin@arm.com, james.morse@arm.com,
tony.luck@intel.com, babu.moger@amd.com, fenghuay@nvidia.com,
peternewman@google.com, zide.chen@intel.com,
dapeng1.mi@linux.intel.com, ben.horgan@arm.com,
yu.c.chen@intel.com, linux-kselftest@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
patches@lists.linux.dev
Subject: Re: [PATCH v2 2/9] selftests/resctrl: Do not store iMC counter value in counter config structure
Date: Fri, 6 Mar 2026 11:51:59 +0200 (EET) [thread overview]
Message-ID: <ac42462a-d244-855f-7bf5-dce91d6d730b@linux.intel.com> (raw)
In-Reply-To: <aaaeaa9b1dfe0694a1c6659193ab5b736aceb090.1772582958.git.reinette.chatre@intel.com>
[-- Attachment #1: Type: text/plain, Size: 2847 bytes --]
On Tue, 3 Mar 2026, Reinette Chatre wrote:
> The MBM and MBA tests compare MBM memory bandwidth measurements against
> the memory bandwidth event values obtained from each memory controller's
> PMU. The memory bandwidth event settings are discovered from the memory
> controller details found in /sys/bus/event_source/devices/uncore_imc_N and
> stored in struct imc_counter_config.
>
> In addition to event settings struct imc_counter_config contains
> imc_counter_config::return_value in which the associated event value is
> stored on every read.
>
> The event value is consumed and immediately recorded at regular intervals.
> The stored value is never consumed afterwards, making its storage as part
> of event configuration unnecessary.
>
> Remove the return_value member from struct imc_counter_config. Instead
> just use a local variable for use during event reading.
>
> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
> ---
> tools/testing/selftests/resctrl/resctrl_val.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c
> index a5a8badb83d4..2cc22f61a1f8 100644
> --- a/tools/testing/selftests/resctrl/resctrl_val.c
> +++ b/tools/testing/selftests/resctrl/resctrl_val.c
> @@ -32,7 +32,6 @@ struct imc_counter_config {
> __u64 event;
> __u64 umask;
> struct perf_event_attr pe;
> - struct membw_read_format return_value;
> int fd;
> };
>
> @@ -312,23 +311,23 @@ static int get_read_mem_bw_imc(float *bw_imc)
> * Take overflow into consideration before calculating total bandwidth.
> */
> for (imc = 0; imc < imcs; imc++) {
> + struct membw_read_format return_value;
> struct imc_counter_config *r =
> &imc_counters_config[imc];
>
> - if (read(r->fd, &r->return_value,
> - sizeof(struct membw_read_format)) == -1) {
> + if (read(r->fd, &return_value, sizeof(return_value)) == -1) {
> ksft_perror("Couldn't get read bandwidth through iMC");
> return -1;
> }
>
> - __u64 r_time_enabled = r->return_value.time_enabled;
> - __u64 r_time_running = r->return_value.time_running;
> + __u64 r_time_enabled = return_value.time_enabled;
> + __u64 r_time_running = return_value.time_running;
>
> if (r_time_enabled != r_time_running)
> of_mul_read = (float)r_time_enabled /
> (float)r_time_running;
>
> - reads += r->return_value.value * of_mul_read * SCALE;
> + reads += return_value.value * of_mul_read * SCALE;
> }
This looks mostly okay though here too I don't like the variable name.
Something like "measurement" would tell what it is much better than overly
vague "return_value".
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
--
i.
next prev parent reply other threads:[~2026-03-06 9:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 0:19 [PATCH v2 0/9] selftests/resctrl: Fixes and improvements focused on Intel platforms Reinette Chatre
2026-03-04 0:19 ` [PATCH v2 1/9] selftests/resctrl: Improve accuracy of cache occupancy test Reinette Chatre
2026-03-06 9:47 ` Ilpo Järvinen
2026-03-06 19:24 ` Reinette Chatre
2026-03-09 7:44 ` Ilpo Järvinen
2026-03-04 0:19 ` [PATCH v2 2/9] selftests/resctrl: Do not store iMC counter value in counter config structure Reinette Chatre
2026-03-06 9:51 ` Ilpo Järvinen [this message]
2026-03-06 19:25 ` Reinette Chatre
2026-03-04 0:19 ` [PATCH v2 3/9] selftests/resctrl: Prepare for parsing multiple events per iMC Reinette Chatre
2026-03-04 0:19 ` [PATCH v2 4/9] selftests/resctrl: Support multiple events associated with iMC Reinette Chatre
2026-03-06 10:18 ` Ilpo Järvinen
2026-03-06 19:25 ` Reinette Chatre
2026-03-04 0:19 ` [PATCH v2 5/9] selftests/resctrl: Increase size of buffer used in MBM and MBA tests Reinette Chatre
2026-03-04 0:19 ` [PATCH v2 6/9] selftests/resctrl: Raise threshold at which MBM and PMU values are compared Reinette Chatre
2026-03-04 0:19 ` [PATCH v2 7/9] selftests/resctrl: Remove requirement on cache miss rate Reinette Chatre
2026-03-04 0:19 ` [PATCH v2 8/9] selftests/resctrl: Simplify perf usage in CAT test Reinette Chatre
2026-03-04 0:19 ` [PATCH v2 9/9] selftests/resctrl: Reduce L2 impact on " Reinette Chatre
2026-03-06 10:35 ` Ilpo Järvinen
2026-03-06 19:26 ` Reinette Chatre
2026-03-04 15:18 ` [PATCH v2 0/9] selftests/resctrl: Fixes and improvements focused on Intel platforms Chen, Yu C
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=ac42462a-d244-855f-7bf5-dce91d6d730b@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=Dave.Martin@arm.com \
--cc=babu.moger@amd.com \
--cc=ben.horgan@arm.com \
--cc=dapeng1.mi@linux.intel.com \
--cc=fenghuay@nvidia.com \
--cc=james.morse@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=peternewman@google.com \
--cc=reinette.chatre@intel.com \
--cc=shuah@kernel.org \
--cc=tony.luck@intel.com \
--cc=yu.c.chen@intel.com \
--cc=zide.chen@intel.com \
/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