public inbox for linux-kselftest@vger.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	Reinette Chatre <reinette.chatre@intel.com>,
	Shuah Khan <shuah@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH v3] selftests/resctrl: Print a message if the result of MBM&CMT tests is failed on Intel cpu
Date: Tue, 8 Mar 2022 14:38:22 -0700	[thread overview]
Message-ID: <9647f7ed-6a02-8603-0de4-3292d4d13157@linuxfoundation.org> (raw)
In-Reply-To: <20220304103957.487660-1-tan.shaopeng@jp.fujitsu.com>

On 3/4/22 3:39 AM, Shaopeng Tan wrote:
> According to "Intel Resource Director Technology (Intel RDT) on
> 2nd Generation Intel Xeon Scalable Processors Reference Manual",
> When the Intel Sub-NUMA Clustering(SNC) feature is enabled,
> Intel CMT and MBM counters may not be accurate.
> 
> However, there does not seem to be an architectural way to detect
> if SNC is enabled.
> 
> If the result of MBM&CMT test fails on Intel CPU,
> print a message to let users know a possible cause of failure.
> 
> Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
> ---
> Hello,
> 
> In PATCH V2, I tried to detect whether SNC is enabled by NUMA info and
> cpuinfo(socket_num), but it is not reliable and no future-proof.
> 
> I just print a message to let users know a possible cause of "not ok",
> When CMT or MBM test runs on Intel CPU, and the result is "not ok".
> 
> This patch is based on v5.16.

Also need to be rebased on mainline latest

> 
>   tools/testing/selftests/resctrl/resctrl_tests.c | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c
> index 973f09a66e1e..ec2bdce7b85f 100644
> --- a/tools/testing/selftests/resctrl/resctrl_tests.c
> +++ b/tools/testing/selftests/resctrl/resctrl_tests.c
> @@ -14,8 +14,9 @@
>   #define BENCHMARK_ARG_SIZE	64
>   
>   bool is_amd;
> +bool is_intel;
>   

Why is this a global? I am not seeing a reason. These detect_*()s
could be moved to resctrl.h and get rid of globals.

Instead of adding intel check to detect_amd() add detect_intel()
or is_intel() and have ut return true of it detects intel.


> -void detect_amd(void)
> +void detect_vendor(void)
>   {
>   	FILE *inf = fopen("/proc/cpuinfo", "r");
>   	char *res;
> @@ -29,6 +30,7 @@ void detect_amd(void)
>   		char *s = strchr(res, ':');
>   
>   		is_amd = s && !strcmp(s, ": AuthenticAMD\n");
> +		is_intel = s && !strcmp(s, ": GenuineIntel\n");
>   		free(res);
>   	}
>   	fclose(inf);
> @@ -70,6 +72,8 @@ static void run_mbm_test(bool has_ben, char **benchmark_cmd, int span,
>   		sprintf(benchmark_cmd[5], "%s", MBA_STR);
>   	res = mbm_bw_change(span, cpu_no, bw_report, benchmark_cmd);
>   	ksft_test_result(!res, "MBM: bw change\n");
> +	if (is_intel && res)
> +		ksft_print_msg("Intel CMT and MBM counters may be inaccurate when Sub-NUMA Clustering (SNC) is enabled. Ensure SNC is disabled in the BIOS if this system supports SNC.\n");

This message is rather long. Please make it concise.

>   	mbm_test_cleanup();
>   }
>   
> @@ -106,6 +110,8 @@ static void run_cmt_test(bool has_ben, char **benchmark_cmd, int cpu_no)
>   		sprintf(benchmark_cmd[5], "%s", CMT_STR);
>   	res = cmt_resctrl_val(cpu_no, 5, benchmark_cmd);
>   	ksft_test_result(!res, "CMT: test\n");
> +	if (is_intel && res)
> +		ksft_print_msg("Intel CMT and MBM counters may be inaccurate when Sub-NUMA Clustering (SNC) is enabled. Ensure SNC is disabled in the BIOS if this system supports SNC.\n");

This message is rather long. Please make it concise.

>   	cmt_test_cleanup();
>   }
>   
> @@ -207,8 +213,8 @@ int main(int argc, char **argv)
>   	if (geteuid() != 0)
>   		return ksft_exit_fail_msg("Not running as root, abort testing.\n");
>   
> -	/* Detect AMD vendor */
> -	detect_amd();
> +	/* Detect AMD/INTEL vendor */
> +	detect_vendor();
>   
>   	if (has_ben) {
>   		/* Extract benchmark command from command line. */
> 

thanks,
-- Shuah

  reply	other threads:[~2022-03-08 21:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04 10:39 [PATCH v3] selftests/resctrl: Print a message if the result of MBM&CMT tests is failed on Intel cpu Shaopeng Tan
2022-03-08 21:38 ` Shuah Khan [this message]
2022-03-10  8:18   ` tan.shaopeng
2022-03-10 20:32     ` Shuah Khan

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=9647f7ed-6a02-8603-0de4-3292d4d13157@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox