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: <7aad2648-6adb-ebfc-a7b7-db959c2e85c4@intel.com>
Date:   Fri, 21 Apr 2023 17:20:57 -0700
From:   Reinette Chatre <reinette.chatre@...el.com>
To:     Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
        <linux-kselftest@...r.kernel.org>,
        Fenghua Yu <fenghua.yu@...el.com>,
        "Shuah Khan" <shuah@...nel.org>, <linux-kernel@...r.kernel.org>
CC:     Shaopeng Tan <tan.shaopeng@...fujitsu.com>
Subject: Re: [PATCH v2 20/24] selftests/resctrl: Move CAT/CMT test global vars
 to func they are used

Hi Ilpo,

On 4/18/2023 4:45 AM, Ilpo Järvinen wrote:
> CAT and CMT tests have count_of_bits, long_mask, and cache_size global
> variables that can be moved into the sole using function.
> 
> Make the global variables local variables of the relevant function to
> scope them better.
> 

Could you please move this patch earlier, before usage of long_mask in
earlier patch.

> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
> ---
>  tools/testing/selftests/resctrl/cat_test.c | 7 +++----
>  tools/testing/selftests/resctrl/cmt_test.c | 7 +++----
>  2 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c
> index ae21e656cf6e..ef3ba22bdde5 100644
> --- a/tools/testing/selftests/resctrl/cat_test.c
> +++ b/tools/testing/selftests/resctrl/cat_test.c
> @@ -17,10 +17,6 @@
>  #define MAX_DIFF_PERCENT	4
>  #define MAX_DIFF		1000000
>  
> -static int count_of_bits;
> -static unsigned long long_mask;
> -static unsigned long cache_size;
> -
>  /*
>   * Change schemata. Write schemata to specified
>   * con_mon grp, mon_grp in resctrl FS.
> @@ -95,6 +91,9 @@ int cat_perf_miss_val(int cpu_no, int n, char *cache_type)
>  {
>  	unsigned long l_mask, l_mask_1;
>  	int ret, pipefd[2], sibling_cpu_no;
> +	unsigned long cache_size;
> +	unsigned long long_mask;
> +	int count_of_bits;
>  	char pipe_message;
>  
>  	cache_size = 0;

Seems like this initialization can be moved to the definition?

> diff --git a/tools/testing/selftests/resctrl/cmt_test.c b/tools/testing/selftests/resctrl/cmt_test.c
> index 087378a775ee..6adee08661e7 100644
> --- a/tools/testing/selftests/resctrl/cmt_test.c
> +++ b/tools/testing/selftests/resctrl/cmt_test.c
> @@ -16,10 +16,6 @@
>  #define MAX_DIFF		2000000
>  #define MAX_DIFF_PERCENT	15
>  
> -static int count_of_bits;
> -static unsigned long long_mask;
> -static unsigned long cache_size;
> -
>  static int cmt_setup(struct resctrl_val_param *p)
>  {
>  	/* Run NUM_OF_RUNS times */
> @@ -74,6 +70,9 @@ void cmt_test_cleanup(void)
>  
>  int cmt_resctrl_val(int cpu_no, int n, char **benchmark_cmd)
>  {
> +	unsigned long cache_size;
> +	unsigned long long_mask;
> +	int count_of_bits;
>  	int ret;
>  
>  	cache_size = 0;

Same here.

Reinette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ