From patchwork Thu Aug 31 11:08:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 719303 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C38F3C83F10 for ; Thu, 31 Aug 2023 11:09:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229953AbjHaLJP (ORCPT ); Thu, 31 Aug 2023 07:09:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345587AbjHaLJJ (ORCPT ); Thu, 31 Aug 2023 07:09:09 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53318E4A; Thu, 31 Aug 2023 04:09:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693480145; x=1725016145; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=U/UjLrLdF/w2JAhXlOzdnTJkUUmhjjjjXaMulIhkOKw=; b=bnCutRwXuSrI7FDLnObzdP2MVc6v6JcQv2NO4tLogZer9XpD36wp6uXJ 8eECQNOenVbvWeBzUgWBXZHLcVVXcP69EFC+aQBeK7dO2hUtZIPkVIov1 Tub8+gjElOVoTBR37cjEG4a7yyO1HB3ohP8xFmTsUvgc0fq4mn3g2Efhu 3suOY7lNsZd4WzOrOETqjEO33oBT1CKjyb/BLgkfjL0LyDCOdgCzpDusm zb4DiF+WNVrIx2kP1nb/Z0v3ezUCMnbbGk59SnhBDkeXr2PUmL2Wa78/b 2TJpPheN+/DgZN3KUjk7uVLM+K6fPvURTyOaFtKxG4da2WoDY4vGLjkCK Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10818"; a="439852223" X-IronPort-AV: E=Sophos;i="6.02,216,1688454000"; d="scan'208";a="439852223" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2023 04:09:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10818"; a="863020963" X-IronPort-AV: E=Sophos;i="6.02,216,1688454000"; d="scan'208";a="863020963" Received: from pshishpo-mobl1.ger.corp.intel.com (HELO ijarvine-mobl2.ger.corp.intel.com) ([10.251.214.20]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2023 04:09:01 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: Reinette Chatre , Shuah Khan , linux-kselftest@vger.kernel.org, Shuah Khan , Maciej Wieczor-Retman , Shaopeng Tan Cc: Fenghua Yu , Babu Moger , LKML , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v4 2/8] selftests/resctrl: Correct benchmark command help Date: Thu, 31 Aug 2023 14:08:37 +0300 Message-Id: <20230831110843.26719-3-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230831110843.26719-1-ilpo.jarvinen@linux.intel.com> References: <20230831110843.26719-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Benchmark command must be the last argument because it consumes all the remaining arguments but help misleadingly shows it as the first argument. The benchmark command is also shown in quotes but it does not match with the code. Correct -b argument place in the help message and remove the quotes. Tweak also how the options are presented by using ... notation. Signed-off-by: Ilpo Järvinen Tested-by: Shaopeng Tan Reviewed-by: Shaopeng Tan Reviewed-by: Reinette Chatre --- tools/testing/selftests/resctrl/resctrl_tests.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index a9331b31c32d..ca973532e8e6 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -52,8 +52,8 @@ int get_vendor(void) static void cmd_help(void) { - printf("usage: resctrl_tests [-h] [-b \"benchmark_cmd [options]\"] [-t test list] [-n no_of_bits]\n"); - printf("\t-b benchmark_cmd [options]: run specified benchmark for MBM, MBA and CMT\n"); + printf("usage: resctrl_tests [-h] [-t test list] [-n no_of_bits] [-b benchmark_cmd [option]...]\n"); + printf("\t-b benchmark_cmd [option]...: run specified benchmark for MBM, MBA and CMT\n"); printf("\t default benchmark is builtin fill_buf\n"); printf("\t-t test list: run tests specified in the test list, "); printf("e.g. -t mbm,mba,cmt,cat\n"); From patchwork Thu Aug 31 11:08:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 719300 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E400AC83F10 for ; Thu, 31 Aug 2023 11:32:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245546AbjHaLc7 (ORCPT ); Thu, 31 Aug 2023 07:32:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345819AbjHaLJN (ORCPT ); Thu, 31 Aug 2023 07:09:13 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6422CF4; Thu, 31 Aug 2023 04:09:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693480148; x=1725016148; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dXDTVUiX/h0fdGvLLgkltFDc8ikvcI1oMV8K1LuXl4E=; b=n9lpOMy61y+8i73Fk46n93Wd2yjE3K+aNmxMrZxSBT8609fqgBOFSWfr g37lPifcQstieswjbmtCRCgZuMhVNffT9O96sDxx73lUYQ9dNHZSH2u6p v+us5/u9NA+wu0V75FkpUx0k+bbCLESnFJvHRj03DEnBR6Skj8Gj/BxEo NvDPItBPGavIqCFusuU1FKFMMAAnmcc+cJTArVpVUiuYkYYBfvirc5mh+ uSL3B5x8gRl0+oxHUloH5cC3V12GN+3qFoOT1eaNqzVPeWs6pG9L3EZyH hyEiY2lb3yRGmoZnl5qRQUqNtRrMihV66wQ0+USpBplO1vhE7NR1UlLC5 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10818"; a="439852233" X-IronPort-AV: E=Sophos;i="6.02,216,1688454000"; d="scan'208";a="439852233" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2023 04:09:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10818"; a="863020990" X-IronPort-AV: E=Sophos;i="6.02,216,1688454000"; d="scan'208";a="863020990" Received: from pshishpo-mobl1.ger.corp.intel.com (HELO ijarvine-mobl2.ger.corp.intel.com) ([10.251.214.20]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2023 04:09:05 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: Reinette Chatre , Shuah Khan , linux-kselftest@vger.kernel.org, Shuah Khan , Maciej Wieczor-Retman , Shaopeng Tan Cc: Fenghua Yu , Babu Moger , LKML , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v4 3/8] selftests/resctrl: Remove bw_report and bm_type from main() Date: Thu, 31 Aug 2023 14:08:38 +0300 Message-Id: <20230831110843.26719-4-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230831110843.26719-1-ilpo.jarvinen@linux.intel.com> References: <20230831110843.26719-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org bw_report is always set to "reads" and bm_type is set to "fill_buf" but is never used. Set bw_report directly to "reads" in MBA/MBM test and remove bm_type. Signed-off-by: Ilpo Järvinen Tested-by: Shaopeng Tan Reviewed-by: Reinette Chatre Reviewed-by: Shaopeng Tan --- tools/testing/selftests/resctrl/mba_test.c | 4 ++-- tools/testing/selftests/resctrl/mbm_test.c | 4 ++-- tools/testing/selftests/resctrl/resctrl.h | 4 ++-- .../testing/selftests/resctrl/resctrl_tests.c | 18 +++++++----------- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/tools/testing/selftests/resctrl/mba_test.c b/tools/testing/selftests/resctrl/mba_test.c index 4d2f145804b8..094424d835d0 100644 --- a/tools/testing/selftests/resctrl/mba_test.c +++ b/tools/testing/selftests/resctrl/mba_test.c @@ -141,7 +141,7 @@ void mba_test_cleanup(void) remove(RESULT_FILE_NAME); } -int mba_schemata_change(int cpu_no, char *bw_report, char **benchmark_cmd) +int mba_schemata_change(int cpu_no, char **benchmark_cmd) { struct resctrl_val_param param = { .resctrl_val = MBA_STR, @@ -149,7 +149,7 @@ int mba_schemata_change(int cpu_no, char *bw_report, char **benchmark_cmd) .mongrp = "m1", .cpu_no = cpu_no, .filename = RESULT_FILE_NAME, - .bw_report = bw_report, + .bw_report = "reads", .setup = mba_setup }; int ret; diff --git a/tools/testing/selftests/resctrl/mbm_test.c b/tools/testing/selftests/resctrl/mbm_test.c index c7de6f5977f6..3e4a800e0e40 100644 --- a/tools/testing/selftests/resctrl/mbm_test.c +++ b/tools/testing/selftests/resctrl/mbm_test.c @@ -109,7 +109,7 @@ void mbm_test_cleanup(void) remove(RESULT_FILE_NAME); } -int mbm_bw_change(size_t span, int cpu_no, char *bw_report, char **benchmark_cmd) +int mbm_bw_change(size_t span, int cpu_no, char **benchmark_cmd) { struct resctrl_val_param param = { .resctrl_val = MBM_STR, @@ -118,7 +118,7 @@ int mbm_bw_change(size_t span, int cpu_no, char *bw_report, char **benchmark_cmd .span = span, .cpu_no = cpu_no, .filename = RESULT_FILE_NAME, - .bw_report = bw_report, + .bw_report = "reads", .setup = mbm_setup }; int ret; diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h index 838d1a438f33..f3446ac664c2 100644 --- a/tools/testing/selftests/resctrl/resctrl.h +++ b/tools/testing/selftests/resctrl/resctrl.h @@ -98,10 +98,10 @@ int perf_event_open(struct perf_event_attr *hw_event, pid_t pid, int cpu, int group_fd, unsigned long flags); int run_fill_buf(size_t span, int memflush, int op, bool once); int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param); -int mbm_bw_change(size_t span, int cpu_no, char *bw_report, char **benchmark_cmd); +int mbm_bw_change(size_t span, int cpu_no, char **benchmark_cmd); void tests_cleanup(void); void mbm_test_cleanup(void); -int mba_schemata_change(int cpu_no, char *bw_report, char **benchmark_cmd); +int mba_schemata_change(int cpu_no, char **benchmark_cmd); void mba_test_cleanup(void); int get_cbm_mask(char *cache_type, char *cbm_mask); int get_cache_size(int cpu_no, char *cache_type, unsigned long *cache_size); diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index ca973532e8e6..7028ff1b8f41 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -70,8 +70,7 @@ void tests_cleanup(void) cat_test_cleanup(); } -static void run_mbm_test(char **benchmark_cmd, size_t span, - int cpu_no, char *bw_report) +static void run_mbm_test(char **benchmark_cmd, size_t span, int cpu_no) { int res; @@ -88,7 +87,7 @@ static void run_mbm_test(char **benchmark_cmd, size_t span, goto umount; } - res = mbm_bw_change(span, cpu_no, bw_report, benchmark_cmd); + res = mbm_bw_change(span, cpu_no, benchmark_cmd); ksft_test_result(!res, "MBM: bw change\n"); if ((get_vendor() == ARCH_INTEL) && res) ksft_print_msg("Intel MBM may be inaccurate when Sub-NUMA Clustering is enabled. Check BIOS configuration.\n"); @@ -97,7 +96,7 @@ static void run_mbm_test(char **benchmark_cmd, size_t span, umount_resctrlfs(); } -static void run_mba_test(char **benchmark_cmd, int cpu_no, char *bw_report) +static void run_mba_test(char **benchmark_cmd, int cpu_no) { int res; @@ -114,7 +113,7 @@ static void run_mba_test(char **benchmark_cmd, int cpu_no, char *bw_report) goto umount; } - res = mba_schemata_change(cpu_no, bw_report, benchmark_cmd); + res = mba_schemata_change(cpu_no, benchmark_cmd); ksft_test_result(!res, "MBA: schemata change\n"); umount: @@ -174,9 +173,9 @@ static void run_cat_test(int cpu_no, int no_of_bits) int main(int argc, char **argv) { bool has_ben = false, mbm_test = true, mba_test = true, cmt_test = true; - char *benchmark_cmd[BENCHMARK_ARGS], bw_report[64], bm_type[64]; char benchmark_cmd_area[BENCHMARK_ARGS][BENCHMARK_ARG_SIZE]; int c, cpu_no = 1, argc_new = argc, i, no_of_bits = 0; + char *benchmark_cmd[BENCHMARK_ARGS]; int ben_ind, ben_count, tests = 0; size_t span = 250 * MB; bool cat_test = true; @@ -279,9 +278,6 @@ int main(int argc, char **argv) benchmark_cmd[5] = NULL; } - sprintf(bw_report, "reads"); - sprintf(bm_type, "fill_buf"); - if (!check_resctrlfs_support()) return ksft_exit_skip("resctrl FS does not exist. Enable X86_CPU_RESCTRL config option.\n"); @@ -293,10 +289,10 @@ int main(int argc, char **argv) ksft_set_plan(tests ? : 4); if (mbm_test) - run_mbm_test(benchmark_cmd, span, cpu_no, bw_report); + run_mbm_test(benchmark_cmd, span, cpu_no); if (mba_test) - run_mba_test(benchmark_cmd, cpu_no, bw_report); + run_mba_test(benchmark_cmd, cpu_no); if (cmt_test) run_cmt_test(benchmark_cmd, cpu_no); From patchwork Thu Aug 31 11:08:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 719302 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B598BC83F01 for ; Thu, 31 Aug 2023 11:09:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345486AbjHaLJY (ORCPT ); Thu, 31 Aug 2023 07:09:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345692AbjHaLJX (ORCPT ); Thu, 31 Aug 2023 07:09:23 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B06DE47; Thu, 31 Aug 2023 04:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693480156; x=1725016156; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ozvRGDwAe0Z03AYp0LDWXSaCRHlbnr2jOWAp594etfc=; b=Hg0y1h9inV7Qi4VDr4TdefZ4QbOxg38fkbXlL6oP8koMP/uGMvh0oIie If2LQGleXs9Ny74+OpKkAnUwE3/SRFvuvM3sE6YV1vJ1/byE+PygqslOV qgP95cJ4guqH8PkzL0HVkIF07+WjQqbtcH/evTSX1jAyK2Oo+eznvJ0ZT yLCRFvNgameXGdCrcwQ+jIBeSbh4k3z/Mu0o7oliwoJGOJtiJycRAm9h9 /DComV9jJTPerSay2C8uaKvXIaHVr6ttX7/pvAcpE3BhBN7ItDednirUt OMaA32e3Jlz6pv9DL/HMpgLB5Cd2MO54jRuTxFTnGTB8djEE78LSTLgXB w==; X-IronPort-AV: E=McAfee;i="6600,9927,10818"; a="439852267" X-IronPort-AV: E=Sophos;i="6.02,216,1688454000"; d="scan'208";a="439852267" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2023 04:09:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10818"; a="863021036" X-IronPort-AV: E=Sophos;i="6.02,216,1688454000"; d="scan'208";a="863021036" Received: from pshishpo-mobl1.ger.corp.intel.com (HELO ijarvine-mobl2.ger.corp.intel.com) ([10.251.214.20]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2023 04:09:13 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: Reinette Chatre , Shuah Khan , linux-kselftest@vger.kernel.org, Shuah Khan , Maciej Wieczor-Retman , Shaopeng Tan Cc: Fenghua Yu , Babu Moger , LKML , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v4 5/8] selftests/resctrl: Reorder resctrl FS prep code and benchmark_cmd init Date: Thu, 31 Aug 2023 14:08:40 +0300 Message-Id: <20230831110843.26719-6-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230831110843.26719-1-ilpo.jarvinen@linux.intel.com> References: <20230831110843.26719-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Benchmark command is initialized before resctrl FS check and preparation code that can call ksft_exit_skip(). There is no strong reason why the resctrl FS support check and unmounting it (if already mounted), has to be done after the benchmark command initialization. Move benchmark command initialization such that it is done not until right before the tests commence. This simplifies rollback handling when benchmark command initialization starts to use dynamic allocation (in a change following this). Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/resctrl_tests.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index 89decda09487..a1b292d5636b 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -252,6 +252,14 @@ int main(int argc, char **argv) if (geteuid() != 0) return ksft_exit_skip("Not running as root. Skipping...\n"); + if (!check_resctrlfs_support()) + return ksft_exit_skip("resctrl FS does not exist. Enable X86_CPU_RESCTRL config option.\n"); + + if (umount_resctrlfs()) + return ksft_exit_skip("resctrl FS unmount failed.\n"); + + filter_dmesg(); + if (has_ben) { if (argc - ben_ind >= BENCHMARK_ARGS) ksft_exit_fail_msg("Too long benchmark command.\n"); @@ -277,14 +285,6 @@ int main(int argc, char **argv) benchmark_cmd[5] = NULL; } - if (!check_resctrlfs_support()) - return ksft_exit_skip("resctrl FS does not exist. Enable X86_CPU_RESCTRL config option.\n"); - - if (umount_resctrlfs()) - return ksft_exit_skip("resctrl FS unmount failed.\n"); - - filter_dmesg(); - ksft_set_plan(tests ? : 4); if (mbm_test) From patchwork Thu Aug 31 11:08:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 719301 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B986C83F10 for ; Thu, 31 Aug 2023 11:09:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245229AbjHaLJf (ORCPT ); Thu, 31 Aug 2023 07:09:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244885AbjHaLJe (ORCPT ); Thu, 31 Aug 2023 07:09:34 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00C8EE5E; Thu, 31 Aug 2023 04:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693480163; x=1725016163; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Lr1Q+utxphrLwiDGzulyb5nFkK7bfs2IKt+N1lBvsHw=; b=WBoNvDZAfSz7Nendt0MSGEEKdNjfHKIBJ5+r5jJrXON3fKHMFMAjb4d0 dC9+kgTdyG/QlRDob40Qv3vt7plRJJKQnAFrPrizUd6PU7CXSir2FGdQN 0B6D+IP2rhTGx649iPZlO1OHS4ZDXq5M4OCbXPaeZz0WN5tzu3kHhNwjP u2vv5SS+DDAKlhX7iaXtcqTht2GLTV+oP7RXpxy/mQSZUJoRYwm+PRbBc 6lwI6N4QCHi/y3TRwW7elDWcOyetrukDhTwgM+rm7ZH5fFUBJri3859RD BLKk/KG6UmWWLRwD40rrSsoOiBKc33GgNmtFAGSSQJxm9AN0u+hg7AS46 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10818"; a="439852295" X-IronPort-AV: E=Sophos;i="6.02,216,1688454000"; d="scan'208";a="439852295" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2023 04:09:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10818"; a="863021070" X-IronPort-AV: E=Sophos;i="6.02,216,1688454000"; d="scan'208";a="863021070" Received: from pshishpo-mobl1.ger.corp.intel.com (HELO ijarvine-mobl2.ger.corp.intel.com) ([10.251.214.20]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2023 04:09:20 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: Reinette Chatre , Shuah Khan , linux-kselftest@vger.kernel.org, Shuah Khan , Maciej Wieczor-Retman , Shaopeng Tan Cc: Fenghua Yu , Babu Moger , LKML , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v4 7/8] selftests/resctrl: Remove ben_count variable Date: Thu, 31 Aug 2023 14:08:42 +0300 Message-Id: <20230831110843.26719-8-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230831110843.26719-1-ilpo.jarvinen@linux.intel.com> References: <20230831110843.26719-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org ben_count is only used to write the terminator for the list. It is enough to use i from the loop so no need for another variable. Remove ben_count variable as it is not needed. Signed-off-by: Ilpo Järvinen Tested-by: Shaopeng Tan Reviewed-by: Reinette Chatre Reviewed-by: Shaopeng Tan --- tools/testing/selftests/resctrl/resctrl_tests.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index 89edde416f07..48e5afb1530c 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -172,7 +172,7 @@ int main(int argc, char **argv) bool has_ben = false, mbm_test = true, mba_test = true, cmt_test = true; int c, cpu_no = 1, argc_new = argc, i, no_of_bits = 0; const char *benchmark_cmd[BENCHMARK_ARGS]; - int ben_ind, ben_count, tests = 0; + int ben_ind, tests = 0; char *span_str = NULL; bool cat_test = true; int ret; @@ -180,7 +180,6 @@ int main(int argc, char **argv) for (i = 0; i < argc; i++) { if (strcmp(argv[i], "-b") == 0) { ben_ind = i + 1; - ben_count = argc - ben_ind; argc_new = ben_ind - 1; has_ben = true; break; @@ -265,7 +264,7 @@ int main(int argc, char **argv) /* Extract benchmark command from command line. */ for (i = 0; i < argc - ben_ind; i++) benchmark_cmd[i] = argv[i + ben_ind]; - benchmark_cmd[ben_count] = NULL; + benchmark_cmd[i] = NULL; } else { /* If no benchmark is given by "-b" argument, use fill_buf. */ benchmark_cmd[0] = "fill_buf";