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,
	Reinette Chatre <reinette.chatre@intel.com>,
	Shuah Khan <shuah@kernel.org>,
	Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	linux-kernel@vger.kernel.org
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: [PATCH v4 10/19] selftests/resctrl: Express span internally in bytes
Date: Thu, 13 Jul 2023 16:19:23 +0300	[thread overview]
Message-ID: <20230713131932.133258-11-ilpo.jarvinen@linux.intel.com> (raw)
In-Reply-To: <20230713131932.133258-1-ilpo.jarvinen@linux.intel.com>

MBA and MBM tests to use megabytes to represent span. CMT test uses
bytes. The difference requires run_benchmark() to size the buffer
differently based on the test name, which in turn requires passing the
test name into run_benchmark().

Convert MBA and MBM tests to use internally bytes like CMT test to
remove the internal inconsistency between the tests. Remove the test
dependent buffer sizing from run_benchmark().

This change eliminates one of the reasons why the test name has to be
passed around but there are still other users too so the test name
passing cannot yet be removed.

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      | 2 +-
 tools/testing/selftests/resctrl/resctrl_tests.c | 2 +-
 tools/testing/selftests/resctrl/resctrlfs.c     | 9 ++-------
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/tools/testing/selftests/resctrl/mbm_test.c b/tools/testing/selftests/resctrl/mbm_test.c
index fd116158d008..2d58d4b8a918 100644
--- a/tools/testing/selftests/resctrl/mbm_test.c
+++ b/tools/testing/selftests/resctrl/mbm_test.c
@@ -40,7 +40,7 @@ show_bw_info(unsigned long *bw_imc, unsigned long *bw_resc, size_t 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): %zu\n", span);
+	ksft_print_msg("Span (MB): %zu\n", span / MB);
 	ksft_print_msg("avg_bw_imc: %lu\n", avg_bw_imc);
 	ksft_print_msg("avg_bw_resc: %lu\n", avg_bw_resc);
 
diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c
index 6b2ca1b4744f..5205a13ed250 100644
--- a/tools/testing/selftests/resctrl/resctrl_tests.c
+++ b/tools/testing/selftests/resctrl/resctrl_tests.c
@@ -185,8 +185,8 @@ int main(int argc, char **argv)
 	char benchmark_cmd_area[BENCHMARK_ARGS][BENCHMARK_ARG_SIZE];
 	int c, cpu_no = 1, argc_new = argc, i, no_of_bits = 0;
 	int ben_ind, ben_count, tests = 0;
+	size_t span = 250 * MB;
 	bool cat_test = true;
-	size_t span = 250;
 
 	for (i = 0; i < argc; i++) {
 		if (strcmp(argv[i], "-b") == 0) {
diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c
index 8be5b745226d..847e0a80c6cd 100644
--- a/tools/testing/selftests/resctrl/resctrlfs.c
+++ b/tools/testing/selftests/resctrl/resctrlfs.c
@@ -298,9 +298,9 @@ int taskset_benchmark(pid_t bm_pid, int cpu_no)
 void run_benchmark(int signum, siginfo_t *info, void *ucontext)
 {
 	int operation, ret, malloc_and_init_memory, memflush;
-	size_t span, buffer_span;
 	char **benchmark_cmd;
 	char resctrl_val[64];
+	size_t span;
 	FILE *fp;
 
 	benchmark_cmd = info->si_ptr;
@@ -321,12 +321,7 @@ void run_benchmark(int signum, siginfo_t *info, void *ucontext)
 		operation = atoi(benchmark_cmd[4]);
 		sprintf(resctrl_val, "%s", benchmark_cmd[5]);
 
-		if (strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR)))
-			buffer_span = span * MB;
-		else
-			buffer_span = span;
-
-		if (run_fill_buf(buffer_span, malloc_and_init_memory, memflush,
+		if (run_fill_buf(span, malloc_and_init_memory, memflush,
 				 operation, resctrl_val))
 			fprintf(stderr, "Error in running fill buffer\n");
 	} else {
-- 
2.30.2


  parent reply	other threads:[~2023-07-13 13:21 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-13 13:19 [PATCH v4 00/19] selftests/resctrl: Fixes and cleanups Ilpo Järvinen
2023-07-13 13:19 ` [PATCH v4 01/19] selftests/resctrl: Add resctrl.h into build deps Ilpo Järvinen
2023-07-13 22:43   ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 02/19] selftests/resctrl: Don't leak buffer in fill_cache() Ilpo Järvinen
2023-07-13 22:44   ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 03/19] selftests/resctrl: Unmount resctrl FS if child fails to run benchmark Ilpo Järvinen
2023-07-13 22:51   ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 04/19] selftests/resctrl: Close perf value read fd on errors Ilpo Järvinen
2023-07-13 22:52   ` Reinette Chatre
2023-07-14 10:35     ` Ilpo Järvinen
2023-07-14 17:36       ` Reinette Chatre
2023-07-17 13:05         ` Ilpo Järvinen
2023-07-17 16:09           ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 05/19] selftests/resctrl: Unmount resctrl FS before starting the first test Ilpo Järvinen
2023-07-13 22:53   ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 06/19] selftests/resctrl: Move resctrl FS mount/umount to higher level Ilpo Järvinen
2023-07-13 22:55   ` Reinette Chatre
2023-07-14 11:31     ` Ilpo Järvinen
2023-07-14 17:36       ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 07/19] selftests/resctrl: Refactor remount_resctrl(bool mum_resctrlfs) to mount_resctrl() Ilpo Järvinen
2023-07-13 22:57   ` Reinette Chatre
2023-07-14 11:03     ` Ilpo Järvinen
2023-07-24  7:12       ` Wieczor-Retman, Maciej
2023-08-07 10:26         ` Ilpo Järvinen
2023-07-13 13:19 ` [PATCH v4 08/19] selftests/resctrl: Remove mum_resctrlfs from struct resctrl_val_param Ilpo Järvinen
2023-07-13 22:59   ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 09/19] selftests/resctrl: Convert span to size_t Ilpo Järvinen
2023-07-13 22:59   ` Reinette Chatre
2023-07-14 10:33     ` Ilpo Järvinen
2023-07-13 13:19 ` Ilpo Järvinen [this message]
2023-07-13 23:00   ` [PATCH v4 10/19] selftests/resctrl: Express span internally in bytes Reinette Chatre
2023-07-14  6:43     ` Wieczor-Retman, Maciej
2023-07-14 10:22       ` Ilpo Järvinen
2023-07-14 17:38         ` Reinette Chatre
2023-07-17 12:30           ` Ilpo Järvinen
2023-07-17 16:10             ` Reinette Chatre
2023-07-18 10:10               ` Ilpo Järvinen
2023-07-14 17:38       ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 11/19] selftests/resctrl: Remove duplicated preparation for span arg Ilpo Järvinen
2023-07-13 23:01   ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 12/19] selftests/resctrl: Remove "malloc_and_init_memory" param from run_fill_buf() Ilpo Järvinen
2023-07-13 23:05   ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 13/19] selftests/resctrl: Remove unnecessary startptr global from fill_buf Ilpo Järvinen
2023-07-13 23:06   ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 14/19] selftests/resctrl: Improve parameter consistency in fill_buf Ilpo Järvinen
2023-07-13 23:07   ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 15/19] selftests/resctrl: Don't pass test name to fill_buf Ilpo Järvinen
2023-07-13 23:10   ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 16/19] selftests/resctrl: Don't use variable argument list for ->setup() Ilpo Järvinen
2023-07-13 23:13   ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 17/19] selftests/resctrl: Move CAT/CMT test global vars to function they are used in Ilpo Järvinen
2023-07-14  0:04   ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 18/19] selftests/resctrl: Pass the real number of tests to show_cache_info() Ilpo Järvinen
2023-07-14  0:05   ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 19/19] selftests/resctrl: Remove test type checks from cat_val() Ilpo Järvinen
2023-07-14  0:07   ` Reinette Chatre

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=20230713131932.133258-11-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.