public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Reinette Chatre <reinette.chatre@intel.com>
Cc: fenghua.yu@intel.com, shuah@kernel.org, tony.luck@intel.com,
	peternewman@google.com, babu.moger@amd.com,
	"Maciej Wieczór-Retman" <maciej.wieczor-retman@intel.com>,
	linux-kselftest@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V4 02/15] selftests/resctrl: Print accurate buffer size as part of MBM results
Date: Fri, 25 Oct 2024 16:52:48 +0300 (EEST)	[thread overview]
Message-ID: <f2d1c465-a76f-b356-9389-91aefa03ddda@linux.intel.com> (raw)
In-Reply-To: <e48adb71c8213ff80833201c0cfe2cdfb041e39a.1729804024.git.reinette.chatre@intel.com>

[-- Attachment #1: Type: text/plain, Size: 3576 bytes --]

On Thu, 24 Oct 2024, Reinette Chatre wrote:

> By default the MBM test uses the "fill_buf" benchmark to keep reading
> from a buffer with size DEFAULT_SPAN while measuring memory bandwidth.
> User space can provide an alternate benchmark or amend the size of
> the buffer "fill_buf" should use.
> 
> Analysis of the MBM measurements do not require that a buffer be used
> and thus do not require knowing the size of the buffer if it was used
> during testing. Even so, the buffer size is printed as informational
> as part of the MBM test results. What is printed as buffer size is
> hardcoded as DEFAULT_SPAN, even if the test relied on another benchmark
> (that may or may not use a buffer) or if user space amended the buffer
> size.
> 
> Ensure that accurate buffer size is printed when using "fill_buf"
> benchmark and omit the buffer size information if another benchmark
> is used.
> 
> Fixes: ecdbb911f22d ("selftests/resctrl: Add MBM test")
> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

--
 i.

> ---
> Backporting is not recommended. Backporting this fix will be
> a challenge with all the refactoring done since then. This issue
> does not impact default tests and there is no sign that
> folks run these tests with anything but the defaults. This issue is
> also minor since it does not impact actual test runs or results,
> just the information printed during a test run.
> 
> Changes since V3:
> - Ensure string parsing handles case when user provides "". (Ilpo)
> - Fix error returned. (Ilpo)
> 
> Changes since V2:
> - Make user input checks more robust. (Ilpo)
> 
> Changes since V1:
> - New patch.
> ---
>  tools/testing/selftests/resctrl/mbm_test.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/resctrl/mbm_test.c b/tools/testing/selftests/resctrl/mbm_test.c
> index 6b5a3b52d861..cf08ba5e314e 100644
> --- a/tools/testing/selftests/resctrl/mbm_test.c
> +++ b/tools/testing/selftests/resctrl/mbm_test.c
> @@ -40,7 +40,8 @@ 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 / MB);
> +	if (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);
>  
> @@ -138,15 +139,26 @@ static int mbm_run_test(const struct resctrl_test *test, const struct user_param
>  		.setup		= mbm_setup,
>  		.measure	= mbm_measure,
>  	};
> +	char *endptr = NULL;
> +	size_t span = 0;
>  	int ret;
>  
>  	remove(RESULT_FILE_NAME);
>  
> +	if (uparams->benchmark_cmd[0] && strcmp(uparams->benchmark_cmd[0], "fill_buf") == 0) {
> +		if (uparams->benchmark_cmd[1] && *uparams->benchmark_cmd[1] != '\0') {
> +			errno = 0;
> +			span = strtoul(uparams->benchmark_cmd[1], &endptr, 10);
> +			if (errno || *endptr != '\0')
> +				return -EINVAL;
> +		}
> +	}
> +
>  	ret = resctrl_val(test, uparams, uparams->benchmark_cmd, &param);
>  	if (ret)
>  		return ret;
>  
> -	ret = check_results(DEFAULT_SPAN);
> +	ret = check_results(span);
>  	if (ret && (get_vendor() == ARCH_INTEL))
>  		ksft_print_msg("Intel MBM may be inaccurate when Sub-NUMA Clustering is enabled. Check BIOS configuration.\n");
>  
> 

  reply	other threads:[~2024-10-25 13:52 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24 21:18 [PATCH V4 00/15] selftests/resctrl: Support diverse platforms with MBM and MBA tests Reinette Chatre
2024-10-24 21:18 ` [PATCH V4 01/15] selftests/resctrl: Make functions only used in same file static Reinette Chatre
2024-10-24 21:18 ` [PATCH V4 02/15] selftests/resctrl: Print accurate buffer size as part of MBM results Reinette Chatre
2024-10-25 13:52   ` Ilpo Järvinen [this message]
2024-10-24 21:18 ` [PATCH V4 03/15] selftests/resctrl: Fix memory overflow due to unhandled wraparound Reinette Chatre
2024-10-24 21:18 ` [PATCH V4 04/15] selftests/resctrl: Protect against array overrun during iMC config parsing Reinette Chatre
2024-10-24 21:18 ` [PATCH V4 05/15] selftests/resctrl: Protect against array overflow when reading strings Reinette Chatre
2024-10-24 21:18 ` [PATCH V4 06/15] selftests/resctrl: Make wraparound handling obvious Reinette Chatre
2024-10-24 21:18 ` [PATCH V4 07/15] selftests/resctrl: Remove "once" parameter required to be false Reinette Chatre
2024-10-24 21:18 ` [PATCH V4 08/15] selftests/resctrl: Only support measured read operation Reinette Chatre
2024-10-24 21:18 ` [PATCH V4 09/15] selftests/resctrl: Remove unused measurement code Reinette Chatre
2024-10-24 21:18 ` [PATCH V4 10/15] selftests/resctrl: Make benchmark parameter passing robust Reinette Chatre
2024-10-25 13:52   ` Ilpo Järvinen
2024-10-24 21:18 ` [PATCH V4 11/15] selftests/resctrl: Ensure measurements skip initialization of default benchmark Reinette Chatre
2024-10-24 21:18 ` [PATCH V4 12/15] selftests/resctrl: Use cache size to determine "fill_buf" buffer size Reinette Chatre
2024-10-24 21:18 ` [PATCH V4 13/15] selftests/resctrl: Do not compare performance counters and resctrl at low bandwidth Reinette Chatre
2024-10-24 21:18 ` [PATCH V4 14/15] selftests/resctrl: Keep results from first test run Reinette Chatre
2024-10-24 21:18 ` [PATCH V4 15/15] selftests/resctrl: Replace magic constants used as array size Reinette Chatre
2024-10-24 22:36 ` [PATCH V4 00/15] selftests/resctrl: Support diverse platforms with MBM and MBA tests Shuah Khan
2024-10-24 22:51   ` Reinette Chatre
2024-10-25 13:54     ` Ilpo Järvinen
2024-10-25 14:45       ` Reinette Chatre
2024-11-04 22:16   ` Reinette Chatre
2024-11-04 22:28     ` Shuah Khan
2024-11-04 23:14       ` Reinette Chatre
2024-11-05  0:07         ` Shuah Khan
2024-11-05  0:55           ` 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=f2d1c465-a76f-b356-9389-91aefa03ddda@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=babu.moger@amd.com \
    --cc=fenghua.yu@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 \
    --cc=tony.luck@intel.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