lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ae46c7fb-dbc4-4f62-89b9-0cb003e65547@intel.com>
Date: Wed, 11 Feb 2026 15:37:21 -0800
From: "Chen, Zide" <zide.chen@...el.com>
To: Reinette Chatre <reinette.chatre@...el.com>, shuah@...nel.org,
 Dave.Martin@....com, james.morse@....com, tony.luck@...el.com,
 peternewman@...gle.com, babu.moger@....com, ilpo.jarvinen@...ux.intel.com
Cc: dapeng1.mi@...ux.intel.com, fenghuay@...dia.com,
 linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
 patches@...ts.linux.dev
Subject: Re: [PATCH 2/8] selftests/resctrl: Prepare for parsing multiple
 events per iMC



On 2/10/2026 8:50 AM, Reinette Chatre wrote:
> The events needed to read memory bandwidth are discovered by iterating
> over every memory controller (iMC) within /sys/bus/event_source/devices.
> Each iMC's PMU is assumed to have one event to measure read memory
> bandwidth that is represented by the sysfs cas_count_read file. The event's
> configuration is read from "cas_count_read" and stored as an element of
> imc_counters_config[] by read_from_imc_dir() that receives the
> index of the array where to store the configuration as argument.
> 
> It is possible that an iMC's PMU may have more than one event that should
> be used to measure memory bandwidth.
> 
> Change semantics to not provide the index of the array to
> read_from_imc_dir() but instead a pointer to the index. This enables
> read_from_imc_dir() to store configurations for more than one event by
> incrementing the index to imc_counters_config[] itself.
> 
> Ensure that the same type is consistently used for the index as it is
> passed around during counter configuration.
> 
> Signed-off-by: Reinette Chatre <reinette.chatre@...el.com>

Reviewed-by: Zide Chen <zide.chen@...el.com>


> ---
>  tools/testing/selftests/resctrl/resctrl_val.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c
> index 2cc22f61a1f8..25c8101631e0 100644
> --- a/tools/testing/selftests/resctrl/resctrl_val.c
> +++ b/tools/testing/selftests/resctrl/resctrl_val.c
> @@ -73,7 +73,7 @@ static void read_mem_bw_ioctl_perf_event_ioc_disable(int i)
>   * @cas_count_cfg:	Config
>   * @count:		iMC number
>   */
> -static void get_read_event_and_umask(char *cas_count_cfg, int count)
> +static void get_read_event_and_umask(char *cas_count_cfg, unsigned int count)
>  {
>  	char *token[MAX_TOKENS];
>  	int i = 0;
> @@ -110,7 +110,7 @@ static int open_perf_read_event(int i, int cpu_no)
>  }
>  
>  /* Get type and config of an iMC counter's read event. */
> -static int read_from_imc_dir(char *imc_dir, int count)
> +static int read_from_imc_dir(char *imc_dir, unsigned int *count)
>  {
>  	char cas_count_cfg[1024], imc_counter_cfg[1024], imc_counter_type[1024];
>  	FILE *fp;
> @@ -123,7 +123,7 @@ static int read_from_imc_dir(char *imc_dir, int count)
>  
>  		return -1;
>  	}
> -	if (fscanf(fp, "%u", &imc_counters_config[count].type) <= 0) {
> +	if (fscanf(fp, "%u", &imc_counters_config[*count].type) <= 0) {
>  		ksft_perror("Could not get iMC type");
>  		fclose(fp);
>  
> @@ -147,7 +147,8 @@ static int read_from_imc_dir(char *imc_dir, int count)
>  	}
>  	fclose(fp);
>  
> -	get_read_event_and_umask(cas_count_cfg, count);
> +	get_read_event_and_umask(cas_count_cfg, *count);
> +	*count += 1;
>  
>  	return 0;
>  }
> @@ -196,13 +197,12 @@ static int num_of_imcs(void)
>  			if (temp[0] >= '0' && temp[0] <= '9') {
>  				sprintf(imc_dir, "%s/%s/", DYN_PMU_PATH,
>  					ep->d_name);
> -				ret = read_from_imc_dir(imc_dir, count);
> +				ret = read_from_imc_dir(imc_dir, &count);
>  				if (ret) {
>  					closedir(dp);
>  
>  					return ret;
>  				}
> -				count++;
>  			}
>  		}
>  		closedir(dp);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ