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 V3 07/15] selftests/resctrl: Remove "once" parameter required to be false
Date: Fri, 18 Oct 2024 11:54:20 +0300 (EEST) [thread overview]
Message-ID: <2502fa49-edba-e01e-78b7-00e2f2ccfa92@linux.intel.com> (raw)
In-Reply-To: <8749a13135c7e66bd9d463d94b15a9214b8c4b69.1729218182.git.reinette.chatre@intel.com>
[-- Attachment #1: Type: text/plain, Size: 5358 bytes --]
On Thu, 17 Oct 2024, Reinette Chatre wrote:
> The CMT, MBM, and MBA tests rely on a benchmark that runs while
> the test makes changes to needed configuration (for example memory
> bandwidth allocation) and takes needed measurements. By default
> the "fill_buf" benchmark is used and by default (via its
> "once = false" setting) "fill_buf" is configured to run until
> terminated after the test completes.
>
> An unintended consequence of enabling the user to override the
> benchmark also enables the user to change parameters to the
> "fill_buf" benchmark. This enables the user to set "fill_buf" to
> only cycle through the buffer once (by setting "once = true")
> and thus breaking the CMT, MBA, and MBM tests that expect
> workload/interference to be reflected by their measurements.
>
> Prevent user space from changing the "once" parameter and ensure
> that it is always false for the CMT, MBA, and MBM tests.
>
> Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
--
i.
> ---
> Changes since V2:
> - Remove unnecessary assignment to benchmark_cmd[5]. (Ilpo)
>
> Changes since V1:
> - New patch
> ---
> tools/testing/selftests/resctrl/fill_buf.c | 7 ++++---
> tools/testing/selftests/resctrl/resctrl.h | 2 +-
> tools/testing/selftests/resctrl/resctrl_tests.c | 9 +++++++--
> tools/testing/selftests/resctrl/resctrl_val.c | 11 +----------
> 4 files changed, 13 insertions(+), 16 deletions(-)
>
> diff --git a/tools/testing/selftests/resctrl/fill_buf.c b/tools/testing/selftests/resctrl/fill_buf.c
> index 34e5df721430..854f0108d8e6 100644
> --- a/tools/testing/selftests/resctrl/fill_buf.c
> +++ b/tools/testing/selftests/resctrl/fill_buf.c
> @@ -151,7 +151,7 @@ unsigned char *alloc_buffer(size_t buf_size, int memflush)
> return buf;
> }
>
> -int run_fill_buf(size_t buf_size, int memflush, int op, bool once)
> +int run_fill_buf(size_t buf_size, int memflush, int op)
> {
> unsigned char *buf;
>
> @@ -160,9 +160,10 @@ int run_fill_buf(size_t buf_size, int memflush, int op, bool once)
> return -1;
>
> if (op == 0)
> - fill_cache_read(buf, buf_size, once);
> + fill_cache_read(buf, buf_size, false);
> else
> - fill_cache_write(buf, buf_size, once);
> + fill_cache_write(buf, buf_size, false);
> +
> free(buf);
>
> return 0;
> diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h
> index 2dda56084588..51f5f4b25e06 100644
> --- a/tools/testing/selftests/resctrl/resctrl.h
> +++ b/tools/testing/selftests/resctrl/resctrl.h
> @@ -142,7 +142,7 @@ int perf_event_open(struct perf_event_attr *hw_event, pid_t pid, int cpu,
> unsigned char *alloc_buffer(size_t buf_size, int memflush);
> void mem_flush(unsigned char *buf, size_t buf_size);
> void fill_cache_read(unsigned char *buf, size_t buf_size, bool once);
> -int run_fill_buf(size_t buf_size, int memflush, int op, bool once);
> +int run_fill_buf(size_t buf_size, int memflush, int op);
> int initialize_mem_bw_imc(void);
> int measure_mem_bw(const struct user_params *uparams,
> struct resctrl_val_param *param, pid_t bm_pid,
> diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c
> index ecbb7605a981..e7878077883f 100644
> --- a/tools/testing/selftests/resctrl/resctrl_tests.c
> +++ b/tools/testing/selftests/resctrl/resctrl_tests.c
> @@ -266,8 +266,13 @@ int main(int argc, char **argv)
> uparams.benchmark_cmd[1] = span_str;
> uparams.benchmark_cmd[2] = "1";
> uparams.benchmark_cmd[3] = "0";
> - uparams.benchmark_cmd[4] = "false";
> - uparams.benchmark_cmd[5] = NULL;
> + /*
> + * Fourth parameter was previously used to indicate
> + * how long "fill_buf" should run for, with "false"
> + * ("fill_buf" will keep running until terminated)
> + * the only option that works.
> + */
> + uparams.benchmark_cmd[4] = NULL;
> }
>
> ksft_set_plan(tests);
> diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c
> index c9dd70ce3ea8..b0f3c594c4da 100644
> --- a/tools/testing/selftests/resctrl/resctrl_val.c
> +++ b/tools/testing/selftests/resctrl/resctrl_val.c
> @@ -625,7 +625,6 @@ static void run_benchmark(int signum, siginfo_t *info, void *ucontext)
> int operation, ret, memflush;
> char **benchmark_cmd;
> size_t span;
> - bool once;
> FILE *fp;
>
> benchmark_cmd = info->si_ptr;
> @@ -645,16 +644,8 @@ static void run_benchmark(int signum, siginfo_t *info, void *ucontext)
> span = strtoul(benchmark_cmd[1], NULL, 10);
> memflush = atoi(benchmark_cmd[2]);
> operation = atoi(benchmark_cmd[3]);
> - if (!strcmp(benchmark_cmd[4], "true")) {
> - once = true;
> - } else if (!strcmp(benchmark_cmd[4], "false")) {
> - once = false;
> - } else {
> - ksft_print_msg("Invalid once parameter\n");
> - parent_exit(ppid);
> - }
>
> - if (run_fill_buf(span, memflush, operation, once))
> + if (run_fill_buf(span, memflush, operation))
> fprintf(stderr, "Error in running fill buffer\n");
> } else {
> /* Execute specified benchmark */
>
next prev parent reply other threads:[~2024-10-18 8:54 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 2:33 [PATCH V3 00/15] selftests/resctrl: Support diverse platforms with MBM and MBA tests Reinette Chatre
2024-10-18 2:33 ` [PATCH V3 01/15] selftests/resctrl: Make functions only used in same file static Reinette Chatre
2024-10-18 2:33 ` [PATCH V3 02/15] selftests/resctrl: Print accurate buffer size as part of MBM results Reinette Chatre
2024-10-18 8:46 ` Ilpo Järvinen
2024-10-18 17:34 ` Reinette Chatre
2024-10-18 2:33 ` [PATCH V3 03/15] selftests/resctrl: Fix memory overflow due to unhandled wraparound Reinette Chatre
2024-10-18 2:33 ` [PATCH V3 04/15] selftests/resctrl: Protect against array overrun during iMC config parsing Reinette Chatre
2024-10-18 2:33 ` [PATCH V3 05/15] selftests/resctrl: Protect against array overflow when reading strings Reinette Chatre
2024-10-18 8:53 ` Ilpo Järvinen
2024-10-18 2:33 ` [PATCH V3 06/15] selftests/resctrl: Make wraparound handling obvious Reinette Chatre
2024-10-18 2:33 ` [PATCH V3 07/15] selftests/resctrl: Remove "once" parameter required to be false Reinette Chatre
2024-10-18 8:54 ` Ilpo Järvinen [this message]
2024-10-18 2:33 ` [PATCH V3 08/15] selftests/resctrl: Only support measured read operation Reinette Chatre
2024-10-18 8:55 ` Ilpo Järvinen
2024-10-18 2:33 ` [PATCH V3 09/15] selftests/resctrl: Remove unused measurement code Reinette Chatre
2024-10-18 2:33 ` [PATCH V3 10/15] selftests/resctrl: Make benchmark parameter passing robust Reinette Chatre
2024-10-18 9:03 ` Ilpo Järvinen
2024-10-18 17:34 ` Reinette Chatre
2024-10-18 2:33 ` [PATCH V3 11/15] selftests/resctrl: Ensure measurements skip initialization of default benchmark Reinette Chatre
2024-10-18 2:33 ` [PATCH V3 12/15] selftests/resctrl: Use cache size to determine "fill_buf" buffer size Reinette Chatre
2024-10-18 9:06 ` Ilpo Järvinen
2024-10-18 2:33 ` [PATCH V3 13/15] selftests/resctrl: Do not compare performance counters and resctrl at low bandwidth Reinette Chatre
2024-10-18 2:33 ` [PATCH V3 14/15] selftests/resctrl: Keep results from first test run Reinette Chatre
2024-10-18 2:33 ` [PATCH V3 15/15] selftests/resctrl: Replace magic constants used as array size Reinette Chatre
2024-10-18 9:08 ` Ilpo Järvinen
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=2502fa49-edba-e01e-78b7-00e2f2ccfa92@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