All of lore.kernel.org
 help / color / mirror / Atom feed
From: Babu Moger <babu.moger@amd.com>
To: <fenghua.yu@intel.com>, <reinette.chatre@intel.com>, <shuah@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-kselftest@vger.kernel.org>,
	<ilpo.jarvinen@linux.intel.com>, <babu.moger@amd.com>,
	<maciej.wieczor-retman@intel.com>, <peternewman@google.com>,
	<eranian@google.com>
Subject: [PATCH 4/4] selftests/resctrl: Skip the tests if iMC/UMC counters are unavailable
Date: Thu, 22 Feb 2024 15:35:48 -0600	[thread overview]
Message-ID: <f5c74072d96b57b10a66c01381139de453187327.1708637563.git.babu.moger@amd.com> (raw)
In-Reply-To: <cover.1708637563.git.babu.moger@amd.com>

Older systems do not support UMC (Unified Memory Controller) perf counters.
Skip the tests if the system does not support UMC counters.

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
 tools/testing/selftests/resctrl/resctrl.h       |  1 +
 tools/testing/selftests/resctrl/resctrl_tests.c | 10 ++++++++++
 tools/testing/selftests/resctrl/resctrl_val.c   |  4 ++--
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h
index a33f414f6019..5c2556af0649 100644
--- a/tools/testing/selftests/resctrl/resctrl.h
+++ b/tools/testing/selftests/resctrl/resctrl.h
@@ -116,5 +116,6 @@ int show_cache_info(unsigned long sum_llc_val, int no_of_bits,
 		    size_t cache_span, unsigned long max_diff,
 		    unsigned long max_diff_percent, unsigned long num_of_runs,
 		    bool platform, bool cmt);
+int get_number_of_mem_ctrls(void);
 
 #endif /* RESCTRL_H */
diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c
index 231233b8d354..5423882529ec 100644
--- a/tools/testing/selftests/resctrl/resctrl_tests.c
+++ b/tools/testing/selftests/resctrl/resctrl_tests.c
@@ -98,6 +98,11 @@ static void run_mbm_test(const char * const *benchmark_cmd, int cpu_no)
 
 	ksft_print_msg("Starting MBM BW change ...\n");
 
+	if (get_number_of_mem_ctrls() < 0) {
+		ksft_test_result_skip("Unable find iMC/UMC counters!\n");
+		return;
+	}
+
 	if (test_prepare()) {
 		ksft_exit_fail_msg("Abnormal failure when preparing for the test\n");
 		return;
@@ -124,6 +129,11 @@ static void run_mba_test(const char * const *benchmark_cmd, int cpu_no)
 
 	ksft_print_msg("Starting MBA Schemata change ...\n");
 
+	if (get_number_of_mem_ctrls() < 0) {
+		ksft_test_result_skip("Unable find iMC/UMC counters!\n");
+		return;
+	}
+
 	if (test_prepare()) {
 		ksft_exit_fail_msg("Abnormal failure when preparing for the test\n");
 		return;
diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c
index c5a4607aa9d9..68cee87c26ef 100644
--- a/tools/testing/selftests/resctrl/resctrl_val.c
+++ b/tools/testing/selftests/resctrl/resctrl_val.c
@@ -262,7 +262,7 @@ static int read_from_imc_dir(char *imc_dir, int count)
  *
  * Return: >= 0 on success. < 0 on failure.
  */
-static int get_number_of_mem_ctrls(void)
+int get_number_of_mem_ctrls(void)
 {
 	char imc_dir[512], *temp;
 	unsigned int count = 0;
@@ -323,7 +323,7 @@ static int get_number_of_mem_ctrls(void)
 		}
 		closedir(dp);
 		if (count == 0) {
-			perror("Unable find iMC counters!\n");
+			perror("Unable find iMC/UMC counters!\n");
 
 			return -1;
 		}
-- 
2.34.1


  parent reply	other threads:[~2024-02-22 21:36 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22 21:35 [PATCH 0/4] selftests/resctrl: Enable MBM and MBA tests on AMD Babu Moger
2024-02-22 21:35 ` [PATCH 1/4] selftests/resctrl: Rename variable imcs and num_of_imcs() to generic names Babu Moger
2024-02-23 10:38   ` Ilpo Järvinen
2024-02-23 18:11     ` Moger, Babu
2024-02-22 21:35 ` [PATCH 2/4] selftests/resctrl: Pass sysfs controller name of the vendor Babu Moger
2024-02-22 21:35 ` [PATCH 3/4] selftests/resctrl: Add support for MBM and MBA tests on AMD Babu Moger
2024-02-23 10:53   ` Ilpo Järvinen
2024-02-23 19:30     ` Moger, Babu
2024-02-23 19:47       ` Moger, Babu
2024-02-23 22:39         ` Reinette Chatre
2024-02-26 18:02           ` Moger, Babu
2024-02-22 21:35 ` Babu Moger [this message]
2024-02-23 10:56   ` [PATCH 4/4] selftests/resctrl: Skip the tests if iMC/UMC counters are unavailable Ilpo Järvinen
2024-02-23 19:39     ` Moger, Babu
2024-04-25 20:16 ` [PATCH v2 0/4] selftests/resctrl: Enable MBM and MBA tests on AMD Babu Moger
2024-04-25 20:16   ` [PATCH v2 1/4] selftests/resctrl: Rename variable imcs and num_of_imcs() to generic names Babu Moger
2024-05-09 21:10     ` Reinette Chatre
2024-04-25 20:17   ` [PATCH v2 2/4] selftests/resctrl: Pass sysfs controller name of the vendor Babu Moger
2024-05-09 21:11     ` Reinette Chatre
2024-04-25 20:17   ` [PATCH v2 3/4] selftests/resctrl: Add support for MBM and MBA tests on AMD Babu Moger
2024-05-09 21:11     ` Reinette Chatre
2024-04-25 20:17   ` [PATCH v2 4/4] selftests/resctrl: Enable MBA/MBA " Babu Moger
2024-04-26  7:06     ` Ilpo Järvinen
2024-04-26 14:56       ` Moger, Babu
2024-05-09 21:11       ` Reinette Chatre
2024-05-09 21:10   ` [PATCH v2 0/4] selftests/resctrl: Enable MBM and MBA " 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=f5c74072d96b57b10a66c01381139de453187327.1708637563.git.babu.moger@amd.com \
    --to=babu.moger@amd.com \
    --cc=eranian@google.com \
    --cc=fenghua.yu@intel.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=peternewman@google.com \
    --cc=reinette.chatre@intel.com \
    --cc=shuah@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.