Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1122248rwp; Thu, 13 Jul 2023 06:31:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlEiuIzJEQlVKwaBxH1i9SahQV41rCMnpJiF35yaR8VwgZW5rUAyh+p+MpQjef/d/YZgg6zp X-Received: by 2002:a17:902:d508:b0:1b8:17e8:547e with SMTP id b8-20020a170902d50800b001b817e8547emr2175990plg.1.1689255092358; Thu, 13 Jul 2023 06:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689255092; cv=none; d=google.com; s=arc-20160816; b=lZ6pPp8U3dTWXnybDTBexQkpVOqMDkGHFzXCAexP+rIyUGeckAhG27LpNtAYfr1W7Y 6DidEe/4cQK1l/6FJ/qzQdAKmxrhQznKXoY1RjzHBIXBwYdrVBpIWfG5BrbErbK1QZ98 pNNiJWoWAzMFq9lK8Lx8oU4+dZDNJa5U99vsnf0GO6IbwCzwdfGMeyydhCUed/YfFT8D fNjbsjD4QThfDcxuyZOckz9aEDm1koz9gyZXVk90gVI4P4lb6R+5dyEHguh/YmNdwFPq 8xVICaYBowq0TOuDbPyWa8lAHP2GI7rhOM+PKu3CsTj01eS0P4oqa8IG5qBuOskyr/iC lKZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=i/5luPuweSVMtU4S24E0kGYCGaVM66ojrWX39iTjvF8=; fh=yQZVCT9uasVczKlazciVDh1mdZVasudsfBJLxIYHjUw=; b=R3BDDdj8bXZI+QZk6R4nFH9WJCwOnMG2lRJb0Z0INR7/6VNKZJx+EP+Gi/aqA8X3aS ZgUxW0e3ZgXUbqZK3lL4deg/QjTS/fD1ePeSIQZetZ5QQMcQwKBQXrPZ4qUH8e0dfKaM WbcgFQY7liuDr6w2nnNsUNZXbKn7buVVoOlMIyw3lsyJA//vX0wc074q37P6SLx1VzLf 90DyB0/jF3MgsuOnVyP/UfR1/ojTqTY9wjn8ujGLLaTpywBnO6byYiRS6yb68+Ym9xRe NpA9tF7Af91O+HvjNrJHelJgz0V4swIvODe8ihgOX25omDYkVw+wU5SKQPlDg2PK2KR5 mSHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Pqlk6al1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kx14-20020a170902f94e00b001b892a54d89si4912985plb.629.2023.07.13.06.31.19; Thu, 13 Jul 2023 06:31:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Pqlk6al1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234999AbjGMNVs (ORCPT + 99 others); Thu, 13 Jul 2023 09:21:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234894AbjGMNVS (ORCPT ); Thu, 13 Jul 2023 09:21:18 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD5B13588; Thu, 13 Jul 2023 06:20:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689254454; x=1720790454; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1Z6XtgfnkLNnOa77rczS1AMCmK7GDgGUepg6zaFzaNk=; b=Pqlk6al1iqtG4Ow/6f9hOBV8Dac7GyFkXb785AiKPKzmmgL07vEuoBmv 1ffLIonQCyrE2NqBeUd0QSuGeuSsKfrDxfFrBvyJ1GkNcPYgrhfjjpW93 WHvMZslJ0wYS+Jk2/8/fWls/rFWCNxuW509WcpBy8/OMewXMhJZ1BCuy6 TXU+chg3ZO5PuracCywOYNWO5lT8UJiyxfcJ/E2GIDCBvuRvevZ6L3nI8 W6wYAHcAoJHUqZGOaceua0J3OHPSwV+bghphzYg1SZ5gG6+MNVk9sRG22 oh53BjuNF1FnGLz8RlfS986wQRkFLsDhD0JdRg4QRnkDR/OIWT8A16c9O A==; X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="345496756" X-IronPort-AV: E=Sophos;i="6.01,202,1684825200"; d="scan'208";a="345496756" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2023 06:20:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="968615862" X-IronPort-AV: E=Sophos;i="6.01,202,1684825200"; d="scan'208";a="968615862" Received: from ijarvine-mobl2.ger.corp.intel.com ([10.251.222.39]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2023 06:20:49 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-kselftest@vger.kernel.org, Reinette Chatre , Shuah Khan , Shaopeng Tan , Fenghua Yu , linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH v4 10/19] selftests/resctrl: Express span internally in bytes Date: Thu, 13 Jul 2023 16:19:23 +0300 Message-Id: <20230713131932.133258-11-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230713131932.133258-1-ilpo.jarvinen@linux.intel.com> References: <20230713131932.133258-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org MBA and MBM tests to use megabytes to represent span. CMT test uses bytes. The difference requires run_benchmark() to size the buffer differently based on the test name, which in turn requires passing the test name into run_benchmark(). Convert MBA and MBM tests to use internally bytes like CMT test to remove the internal inconsistency between the tests. Remove the test dependent buffer sizing from run_benchmark(). This change eliminates one of the reasons why the test name has to be passed around but there are still other users too so the test name passing cannot yet be removed. Co-developed-by: Fenghua Yu Signed-off-by: Fenghua Yu Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/mbm_test.c | 2 +- tools/testing/selftests/resctrl/resctrl_tests.c | 2 +- tools/testing/selftests/resctrl/resctrlfs.c | 9 ++------- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/resctrl/mbm_test.c b/tools/testing/selftests/resctrl/mbm_test.c index fd116158d008..2d58d4b8a918 100644 --- a/tools/testing/selftests/resctrl/mbm_test.c +++ b/tools/testing/selftests/resctrl/mbm_test.c @@ -40,7 +40,7 @@ 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); + 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); diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index 6b2ca1b4744f..5205a13ed250 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -185,8 +185,8 @@ int main(int argc, char **argv) char benchmark_cmd_area[BENCHMARK_ARGS][BENCHMARK_ARG_SIZE]; int c, cpu_no = 1, argc_new = argc, i, no_of_bits = 0; int ben_ind, ben_count, tests = 0; + size_t span = 250 * MB; bool cat_test = true; - size_t span = 250; for (i = 0; i < argc; i++) { if (strcmp(argv[i], "-b") == 0) { diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c index 8be5b745226d..847e0a80c6cd 100644 --- a/tools/testing/selftests/resctrl/resctrlfs.c +++ b/tools/testing/selftests/resctrl/resctrlfs.c @@ -298,9 +298,9 @@ int taskset_benchmark(pid_t bm_pid, int cpu_no) void run_benchmark(int signum, siginfo_t *info, void *ucontext) { int operation, ret, malloc_and_init_memory, memflush; - size_t span, buffer_span; char **benchmark_cmd; char resctrl_val[64]; + size_t span; FILE *fp; benchmark_cmd = info->si_ptr; @@ -321,12 +321,7 @@ void run_benchmark(int signum, siginfo_t *info, void *ucontext) operation = atoi(benchmark_cmd[4]); sprintf(resctrl_val, "%s", benchmark_cmd[5]); - if (strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR))) - buffer_span = span * MB; - else - buffer_span = span; - - if (run_fill_buf(buffer_span, malloc_and_init_memory, memflush, + if (run_fill_buf(span, malloc_and_init_memory, memflush, operation, resctrl_val)) fprintf(stderr, "Error in running fill buffer\n"); } else { -- 2.30.2