All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
To: shuah@kernel.org, linux-kselftest@vger.kernel.org
Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	tony.luck@intel.com, reinette.chatre@intel.com,
	babu.moger@amd.com, james.morse@arm.com,
	ravi.v.shankar@intel.com, fenghua.yu@intel.com, x86@kernel.org,
	linux-kernel@vger.kernel.org,
	Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
Subject: [PATCH V1 07/13] selftests/resctrl: Don't use variable argument list for setup function
Date: Fri,  6 Mar 2020 19:40:48 -0800	[thread overview]
Message-ID: <4d2f519c9a67d86e71f8fe6fd281f1e39cfe4e49.1583657204.git.sai.praneeth.prakhya@intel.com> (raw)
In-Reply-To: <cover.1583657204.git.sai.praneeth.prakhya@intel.com>

struct resctrl_val_param has setup() function that accepts variable
argument list. But, presently, all the test cases use only 1 argument as
input and it's struct resctrl_val_param *. So, instead of variable argument
list, directly pass struct resctrl_val_param * as parameter.

Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
---
 tools/testing/selftests/resctrl/cache.c       | 2 +-
 tools/testing/selftests/resctrl/cat_test.c    | 8 +-------
 tools/testing/selftests/resctrl/cqm_test.c    | 9 +--------
 tools/testing/selftests/resctrl/mba_test.c    | 8 +-------
 tools/testing/selftests/resctrl/mbm_test.c    | 8 +-------
 tools/testing/selftests/resctrl/resctrl.h     | 2 +-
 tools/testing/selftests/resctrl/resctrl_val.c | 4 ++--
 7 files changed, 8 insertions(+), 33 deletions(-)

diff --git a/tools/testing/selftests/resctrl/cache.c b/tools/testing/selftests/resctrl/cache.c
index 38dbf4962e33..1cbcd7fbe216 100644
--- a/tools/testing/selftests/resctrl/cache.c
+++ b/tools/testing/selftests/resctrl/cache.c
@@ -243,7 +243,7 @@ int cat_val(struct resctrl_val_param *param)
 	/* Test runs until the callback setup() tells the test to stop. */
 	while (1) {
 		if (strcmp(resctrl_val, "cat") == 0) {
-			ret = param->setup(1, param);
+			ret = param->setup(param);
 			if (ret) {
 				ret = 0;
 				break;
diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c
index 5da43767b973..046c7f285e72 100644
--- a/tools/testing/selftests/resctrl/cat_test.c
+++ b/tools/testing/selftests/resctrl/cat_test.c
@@ -27,17 +27,11 @@ unsigned long cache_size;
  * con_mon grp, mon_grp in resctrl FS.
  * Run 5 times in order to get average values.
  */
-static int cat_setup(int num, ...)
+static int cat_setup(struct resctrl_val_param *p)
 {
-	struct resctrl_val_param *p;
 	char schemata[64];
-	va_list param;
 	int ret = 0;
 
-	va_start(param, num);
-	p = va_arg(param, struct resctrl_val_param *);
-	va_end(param);
-
 	/* Run NUM_OF_RUNS times */
 	if (p->num_of_runs >= NUM_OF_RUNS)
 		return -1;
diff --git a/tools/testing/selftests/resctrl/cqm_test.c b/tools/testing/selftests/resctrl/cqm_test.c
index fb4797cfda09..f27b0363e518 100644
--- a/tools/testing/selftests/resctrl/cqm_test.c
+++ b/tools/testing/selftests/resctrl/cqm_test.c
@@ -21,15 +21,8 @@ char cbm_mask[256];
 unsigned long long_mask;
 unsigned long cache_size;
 
-static int cqm_setup(int num, ...)
+static int cqm_setup(struct resctrl_val_param *p)
 {
-	struct resctrl_val_param *p;
-	va_list param;
-
-	va_start(param, num);
-	p = va_arg(param, struct resctrl_val_param *);
-	va_end(param);
-
 	/* Run NUM_OF_RUNS times */
 	if (p->num_of_runs >= NUM_OF_RUNS)
 		return -1;
diff --git a/tools/testing/selftests/resctrl/mba_test.c b/tools/testing/selftests/resctrl/mba_test.c
index 165e5123e040..0f85e5be390d 100644
--- a/tools/testing/selftests/resctrl/mba_test.c
+++ b/tools/testing/selftests/resctrl/mba_test.c
@@ -22,16 +22,10 @@
  * con_mon grp, mon_grp in resctrl FS.
  * For each allocation, run 5 times in order to get average values.
  */
-static int mba_setup(int num, ...)
+static int mba_setup(struct resctrl_val_param *p)
 {
 	static int runs_per_allocation, allocation = 100;
-	struct resctrl_val_param *p;
 	char allocation_str[64];
-	va_list param;
-
-	va_start(param, num);
-	p = va_arg(param, struct resctrl_val_param *);
-	va_end(param);
 
 	if (runs_per_allocation >= NUM_OF_RUNS)
 		runs_per_allocation = 0;
diff --git a/tools/testing/selftests/resctrl/mbm_test.c b/tools/testing/selftests/resctrl/mbm_test.c
index 530ec5bec0b9..9e847641516a 100644
--- a/tools/testing/selftests/resctrl/mbm_test.c
+++ b/tools/testing/selftests/resctrl/mbm_test.c
@@ -84,21 +84,15 @@ static int check_results(int span)
 	return 0;
 }
 
-static int mbm_setup(int num, ...)
+static int mbm_setup(struct resctrl_val_param *p)
 {
-	struct resctrl_val_param *p;
 	static int num_of_runs;
-	va_list param;
 	int ret = 0;
 
 	/* Run NUM_OF_RUNS times */
 	if (num_of_runs++ >= NUM_OF_RUNS)
 		return -1;
 
-	va_start(param, num);
-	p = va_arg(param, struct resctrl_val_param *);
-	va_end(param);
-
 	/* Set up shemata with 100% allocation on the first run. */
 	if (num_of_runs == 0)
 		ret = write_schemata(p->ctrlgrp, "100", p->cpu_no,
diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h
index 39bf59c6b9c5..e320e79bc4d4 100644
--- a/tools/testing/selftests/resctrl/resctrl.h
+++ b/tools/testing/selftests/resctrl/resctrl.h
@@ -59,7 +59,7 @@ struct resctrl_val_param {
 	char		*bw_report;
 	unsigned long	mask;
 	int		num_of_runs;
-	int		(*setup)(int num, ...);
+	int		(*setup)(struct resctrl_val_param *param);
 };
 
 pid_t bm_pid, ppid;
diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c
index 520fea3606d1..271cb5c976f5 100644
--- a/tools/testing/selftests/resctrl/resctrl_val.c
+++ b/tools/testing/selftests/resctrl/resctrl_val.c
@@ -712,7 +712,7 @@ int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param)
 	while (1) {
 		if ((strcmp(resctrl_val, "mbm") == 0) ||
 		    (strcmp(resctrl_val, "mba") == 0)) {
-			ret = param->setup(1, param);
+			ret = param->setup(param);
 			if (ret) {
 				ret = 0;
 				break;
@@ -722,7 +722,7 @@ int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param)
 			if (ret)
 				break;
 		} else if (strcmp(resctrl_val, "cqm") == 0) {
-			ret = param->setup(1, param);
+			ret = param->setup(param);
 			if (ret) {
 				ret = 0;
 				break;
-- 
2.7.4


  parent reply	other threads:[~2020-03-07  3:46 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-07  3:40 [PATCH V1 00/13] Miscellaneous fixes for resctrl selftests Sai Praneeth Prakhya
2020-03-07  3:40 ` [PATCH V1 01/13] selftests/resctrl: Fix feature detection Sai Praneeth Prakhya
2020-03-09 21:44   ` Reinette Chatre
2020-03-09 22:22     ` Prakhya, Sai Praneeth
2020-03-09 22:33       ` Reinette Chatre
2020-03-09 22:51         ` Prakhya, Sai Praneeth
2020-03-11 18:06           ` Reinette Chatre
2020-03-11 18:22             ` Sai Praneeth Prakhya
2020-03-11 18:45               ` Reinette Chatre
2020-03-11 18:54                 ` Sai Praneeth Prakhya
2020-03-07  3:40 ` [PATCH V1 02/13] selftests/resctrl: Fix typo Sai Praneeth Prakhya
2020-03-07  3:40 ` [PATCH V1 03/13] selftests/resctrl: Fix typo in help text Sai Praneeth Prakhya
2020-03-07  3:40 ` [PATCH V1 04/13] selftests/resctrl: Ensure sibling CPU is not same as original CPU Sai Praneeth Prakhya
2020-03-07  3:40 ` [PATCH V1 05/13] selftests/resctrl: Fix missing options "-n" and "-p" Sai Praneeth Prakhya
2020-03-07  3:40 ` [PATCH V1 06/13] selftests/resctrl: Fix MBA/MBM results reporting format Sai Praneeth Prakhya
2020-03-07  3:40 ` Sai Praneeth Prakhya [this message]
2020-03-07  3:40 ` [PATCH V1 08/13] selftests/resctrl: Fix typos Sai Praneeth Prakhya
2020-03-07  3:40 ` [PATCH V1 09/13] selftests/resctrl: Modularize fill_buf for new CAT test case Sai Praneeth Prakhya
2020-03-10 21:59   ` Reinette Chatre
2020-03-11  1:04     ` Sai Praneeth Prakhya
2020-03-11 15:44       ` Reinette Chatre
2020-03-11 17:45         ` Sai Praneeth Prakhya
2020-03-11 18:10           ` Reinette Chatre
2020-03-11 18:14             ` Sai Praneeth Prakhya
2020-03-07  3:40 ` [PATCH V1 10/13] selftests/resctrl: Change Cache Allocation Technology (CAT) test Sai Praneeth Prakhya
2020-03-10 22:14   ` Reinette Chatre
2020-03-11  1:59     ` Sai Praneeth Prakhya
2020-03-11 17:03       ` Reinette Chatre
2020-03-11 19:14         ` Sai Praneeth Prakhya
2020-03-11 20:22           ` Reinette Chatre
2020-03-11 20:55             ` Sai Praneeth Prakhya
2020-03-07  3:40 ` [PATCH V1 11/13] selftests/resctrl: Change Cache Quality Monitoring (CQM) test Sai Praneeth Prakhya
2020-03-10 22:18   ` Reinette Chatre
2020-03-11  2:46     ` Sai Praneeth Prakhya
2020-03-11 17:19       ` Reinette Chatre
2020-03-11 17:33         ` Sai Praneeth Prakhya
2020-03-11 18:03           ` Reinette Chatre
2020-03-11 18:07             ` Sai Praneeth Prakhya
2020-03-07  3:40 ` [PATCH V1 12/13] selftests/resctrl: Dynamically select buffer size for CAT test Sai Praneeth Prakhya
2020-03-10 22:19   ` Reinette Chatre
2020-03-11  2:52     ` Sai Praneeth Prakhya
2020-03-07  3:40 ` [PATCH V1 13/13] selftests/resctrl: Cleanup fill_buff after changing " Sai Praneeth Prakhya

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=4d2f519c9a67d86e71f8fe6fd281f1e39cfe4e49.1583657204.git.sai.praneeth.prakhya@intel.com \
    --to=sai.praneeth.prakhya@intel.com \
    --cc=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=fenghua.yu@intel.com \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=ravi.v.shankar@intel.com \
    --cc=reinette.chatre@intel.com \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /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.