All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Reinette Chatre <reinette.chatre@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>, Shuah Khan <shuah@kernel.org>
Cc: "Shaopeng Tan" <tan.shaopeng@jp.fujitsu.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: [PATCH 03/22] selftests/resctrl: Make span unsigned long everywhere
Date: Wed, 12 Apr 2023 16:21:03 +0300	[thread overview]
Message-ID: <20230412132122.29452-4-ilpo.jarvinen@linux.intel.com> (raw)
In-Reply-To: <20230412132122.29452-1-ilpo.jarvinen@linux.intel.com>

fill_buf(), show_bw_info(), and resctrl_val_param.span define span as
unsigned long.

Consistently use unsigned long elsewhere too for span parameters.

Co-developed-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 tools/testing/selftests/resctrl/mbm_test.c      |  8 ++++----
 tools/testing/selftests/resctrl/resctrl.h       |  2 +-
 tools/testing/selftests/resctrl/resctrl_tests.c | 11 ++++++-----
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/tools/testing/selftests/resctrl/mbm_test.c b/tools/testing/selftests/resctrl/mbm_test.c
index c9dfa54af42f..b28e68ac5fea 100644
--- a/tools/testing/selftests/resctrl/mbm_test.c
+++ b/tools/testing/selftests/resctrl/mbm_test.c
@@ -15,7 +15,7 @@
 #define NUM_OF_RUNS		5
 
 static int
-show_bw_info(unsigned long *bw_imc, unsigned long *bw_resc, int span)
+show_bw_info(unsigned long *bw_imc, unsigned long *bw_resc, unsigned long span)
 {
 	unsigned long avg_bw_imc = 0, avg_bw_resc = 0;
 	unsigned long sum_bw_imc = 0, sum_bw_resc = 0;
@@ -40,14 +40,14 @@ show_bw_info(unsigned long *bw_imc, unsigned long *bw_resc, int span)
 	ksft_print_msg("%s Check MBM diff within %d%%\n",
 		       ret ? "Fail:" : "Pass:", MAX_DIFF_PERCENT);
 	ksft_print_msg("avg_diff_per: %d%%\n", avg_diff_per);
-	ksft_print_msg("Span (MB): %d\n", span);
+	ksft_print_msg("Span (MB): %lu\n", span);
 	ksft_print_msg("avg_bw_imc: %lu\n", avg_bw_imc);
 	ksft_print_msg("avg_bw_resc: %lu\n", avg_bw_resc);
 
 	return ret;
 }
 
-static int check_results(int span)
+static int check_results(unsigned long span)
 {
 	unsigned long bw_imc[NUM_OF_RUNS], bw_resc[NUM_OF_RUNS];
 	char temp[1024], *token_array[8];
@@ -114,7 +114,7 @@ void mbm_test_cleanup(void)
 	remove(RESULT_FILE_NAME);
 }
 
-int mbm_bw_change(int span, int cpu_no, char *bw_report, char **benchmark_cmd)
+int mbm_bw_change(unsigned long span, int cpu_no, char *bw_report, char **benchmark_cmd)
 {
 	struct resctrl_val_param param = {
 		.resctrl_val	= MBM_STR,
diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h
index 9555a6f683f7..ffa2d1e51c67 100644
--- a/tools/testing/selftests/resctrl/resctrl.h
+++ b/tools/testing/selftests/resctrl/resctrl.h
@@ -101,7 +101,7 @@ int perf_event_open(struct perf_event_attr *hw_event, pid_t pid, int cpu,
 int run_fill_buf(unsigned long span, int malloc_and_init_memory, int memflush,
 		 int op, char *resctrl_va);
 int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param);
-int mbm_bw_change(int span, int cpu_no, char *bw_report, char **benchmark_cmd);
+int mbm_bw_change(unsigned long span, int cpu_no, char *bw_report, char **benchmark_cmd);
 void tests_cleanup(void);
 void mbm_test_cleanup(void);
 int mba_schemata_change(int cpu_no, char *bw_report, char **benchmark_cmd);
diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c
index df0d8d8526fc..60b225e15cff 100644
--- a/tools/testing/selftests/resctrl/resctrl_tests.c
+++ b/tools/testing/selftests/resctrl/resctrl_tests.c
@@ -70,7 +70,7 @@ void tests_cleanup(void)
 	cat_test_cleanup();
 }
 
-static void run_mbm_test(bool has_ben, char **benchmark_cmd, int span,
+static void run_mbm_test(bool has_ben, char **benchmark_cmd, unsigned long span,
 			 int cpu_no, char *bw_report)
 {
 	int res;
@@ -91,7 +91,7 @@ static void run_mbm_test(bool has_ben, char **benchmark_cmd, int span,
 	mbm_test_cleanup();
 }
 
-static void run_mba_test(bool has_ben, char **benchmark_cmd, int span,
+static void run_mba_test(bool has_ben, char **benchmark_cmd, unsigned long span,
 			 int cpu_no, char *bw_report)
 {
 	int res;
@@ -104,7 +104,7 @@ static void run_mba_test(bool has_ben, char **benchmark_cmd, int span,
 	}
 
 	if (!has_ben)
-		sprintf(benchmark_cmd[1], "%d", span);
+		sprintf(benchmark_cmd[1], "%lu", span);
 	res = mba_schemata_change(cpu_no, bw_report, benchmark_cmd);
 	ksft_test_result(!res, "MBA: schemata change\n");
 	mba_test_cleanup();
@@ -148,9 +148,10 @@ static void run_cat_test(int cpu_no, int no_of_bits)
 int main(int argc, char **argv)
 {
 	bool has_ben = false, mbm_test = true, mba_test = true, cmt_test = true;
-	int c, cpu_no = 1, span = 250, argc_new = argc, i, no_of_bits = 0;
 	char *benchmark_cmd[BENCHMARK_ARGS], bw_report[64], bm_type[64];
 	char benchmark_cmd_area[BENCHMARK_ARGS][BENCHMARK_ARG_SIZE];
+	int c, cpu_no = 1, argc_new = argc, i, no_of_bits = 0;
+	unsigned long span = 250;
 	int ben_ind, ben_count, tests = 0;
 	bool cat_test = true;
 
@@ -240,7 +241,7 @@ int main(int argc, char **argv)
 			benchmark_cmd[i] = benchmark_cmd_area[i];
 
 		strcpy(benchmark_cmd[0], "fill_buf");
-		sprintf(benchmark_cmd[1], "%d", span);
+		sprintf(benchmark_cmd[1], "%lu", span);
 		strcpy(benchmark_cmd[2], "1");
 		strcpy(benchmark_cmd[3], "1");
 		strcpy(benchmark_cmd[4], "0");
-- 
2.30.2


  parent reply	other threads:[~2023-04-12 13:22 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12 13:21 [PATCH 00/22] selftests/resctrl: Fixes, cleanups, and rewritten CAT test Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 01/22] selftests/resctrl: Add resctrl.h into build deps Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 02/22] selftests/resctrl: Check also too low values for CBM bits Ilpo Järvinen
2023-04-12 13:21 ` Ilpo Järvinen [this message]
2023-04-12 13:21 ` [PATCH 04/22] selftests/resctrl: Express span in bytes Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 05/22] selftests/resctrl: Remove duplicated preparation for span arg Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 06/22] selftests/resctrl: Don't use variable argument list for ->setup() Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 07/22] selftests/resctrl: Remove "malloc_and_init_memory" param from run_fill_buf() Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 08/22] selftests/resctrl: Split run_fill_buf() to alloc, work, and dealloc helpers Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 09/22] selftests/resctrl: Remove start_buf local variable from buffer alloc func Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 10/22] selftests/resctrl: Don't pass test name to fill_buf Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 11/22] selftests/resctrl: Add flush_buffer() " Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 12/22] selftests/resctrl: Remove test type checks from cat_val() Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 13/22] selftests/resctrl: Refactor get_cbm_mask() Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 14/22] selftests/resctrl: Create cache_alloc_size() helper Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 15/22] selftests/resctrl: Replace count_bits with count_consecutive_bits() Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 16/22] selftests/resctrl: Exclude shareable bits from schemata in CAT test Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 17/22] selftests/resctrl: Pass the real number of tests to show_cache_info() Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 18/22] selftests/resctrl: Move CAT/CMT test global vars to func they are used Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 19/22] selftests/resctrl: Read in less obvious order to defeat prefetch optimizations Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 20/22] selftests/resctrl: Split measure_cache_vals() function Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 21/22] selftests/resctrl: Split show_cache_info() to test specific and generic parts Ilpo Järvinen
2023-04-12 13:21 ` [PATCH 22/22] selftests/resctrl: Rewrite Cache Allocation Technology (CAT) test Ilpo Järvinen
2023-04-13 10:12   ` Ilpo Järvinen

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=20230412132122.29452-4-ilpo.jarvinen@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=shuah@kernel.org \
    --cc=tan.shaopeng@jp.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.