From patchwork Mon Jun 5 18:01:27 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: 690408 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 D681AC7EE23 for ; Mon, 5 Jun 2023 18:02:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234018AbjFESCT (ORCPT ); Mon, 5 Jun 2023 14:02:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232036AbjFESCQ (ORCPT ); Mon, 5 Jun 2023 14:02:16 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35A73C7; Mon, 5 Jun 2023 11:02:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685988135; x=1717524135; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GfdCAOh9DszUxeIi/d59C0n2Wm3we7mqJ8T1ceHWh+Q=; b=NKNgKZYDW4EIiYKeWX3g0OplolZJOk05m/fRqX8phFFixYDt6Q6arWQU 87E5Mvf9ZnZdOz/es4ZEqsRAd9lu22I0hHAx2sEPlwwGen6kSLn6zn+OA hNhPLWjINl5+fuaFmmB6VGu7ZwdCvMil3mE9QCFt9oJcVIr/OVWQNh6io WEGPkTRg3YyDO/hBAX668haTvK4iuixO+oy8+eyP3LkWQfoXTu1zNhN+w WhUu6FzdMrm7bmMTPwxFiYUWmzBtvFDoro/1eCSLJam2xjY8zH2C1sD8N zu1nTkV0Xp++xd3lzlgfcuDwBjnPinxBYOzM7TPqn7DEgSXnVvQpUGaNS g==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="442814842" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="442814842" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:01:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="821273977" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="821273977" Received: from gfittedx-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.47.115]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:01:55 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-kselftest@vger.kernel.org, Reinette Chatre , Shuah Khan , Shaopeng Tan , Fenghua Yu , Sai Praneeth Prakhya , Babu Moger , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v3 01/19] selftests/resctrl: Add resctrl.h into build deps Date: Mon, 5 Jun 2023 21:01:27 +0300 Message-Id: <20230605180145.112924-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> References: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Makefile only lists *.c as build dependencies for the resctrl_tests executable which excludes resctrl.h. Add *.h to wildcard() to include resctrl.h. Fixes: 591a6e8588fc ("selftests/resctrl: Add basic resctrl file system operations and data") Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/resctrl/Makefile b/tools/testing/selftests/resctrl/Makefile index 73d53257df42..5073dbc96125 100644 --- a/tools/testing/selftests/resctrl/Makefile +++ b/tools/testing/selftests/resctrl/Makefile @@ -7,4 +7,4 @@ TEST_GEN_PROGS := resctrl_tests include ../lib.mk -$(OUTPUT)/resctrl_tests: $(wildcard *.c) +$(OUTPUT)/resctrl_tests: $(wildcard *.[ch]) From patchwork Mon Jun 5 18:01:29 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: 690407 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 2E03FC7EE23 for ; Mon, 5 Jun 2023 18:02:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234525AbjFESCW (ORCPT ); Mon, 5 Jun 2023 14:02:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233449AbjFESCU (ORCPT ); Mon, 5 Jun 2023 14:02:20 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A0ACD2; Mon, 5 Jun 2023 11:02:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685988140; x=1717524140; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8fEVbocJK76OsCYtzLBWGVMQr0k8AvV/EpnfvvAei/8=; b=fiDJOz1FnnWte9MAq/h2k6pZR7oU3vCYpew4zFRta0XmygQWdFN24ggG D8UVOexMGdw/0dN7soz/E/dYqXGbK94VFw2Axub+340OTqKNNUiZ9Xkee +NSqDmAgWSbbo9cUaMgrHivw/l1eCU5EFUDr7iCOi162FrGmXcLqx8fBw W+eWx5XgSo5CuPUxZ0CnAaH/xTbKPaub82AtkMGjHSI7nNY5BSUW2iDdu mbEUtsMfpv47yRgVGZteNd+sYq0v8+GIG7SIYGNhP9cWJP0Vt6ET2Rt8v VhWDlXqkjbTgdsXcUj5ihoSe0UAaxxlXo8hyEGX1ml3I1jhxPASmvKQWf Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="442814885" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="442814885" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:02:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="821274024" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="821274024" Received: from gfittedx-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.47.115]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:02:05 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-kselftest@vger.kernel.org, Reinette Chatre , Shuah Khan , Shaopeng Tan , Fenghua Yu , Sai Praneeth Prakhya , Babu Moger , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v3 03/19] selftests/resctrl: Unmount resctrl FS if child fails to run benchmark Date: Mon, 5 Jun 2023 21:01:29 +0300 Message-Id: <20230605180145.112924-4-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> References: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org A child calls PARENT_EXIT() when it fails to run a benchmark to kill the parent process. PARENT_EXIT() lacks unmount for the resctrl FS and the parent won't be there to unmount it either after it gets killed. Add the resctrl FS unmount also to PARENT_EXIT(). Fixes: 591a6e8588fc ("selftests/resctrl: Add basic resctrl file system operations and data") Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/resctrl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h index 87e39456dee0..f455f0b7e314 100644 --- a/tools/testing/selftests/resctrl/resctrl.h +++ b/tools/testing/selftests/resctrl/resctrl.h @@ -43,6 +43,7 @@ do { \ perror(err_msg); \ kill(ppid, SIGKILL); \ + umount_resctrlfs(); \ exit(EXIT_FAILURE); \ } while (0) From patchwork Mon Jun 5 18:01:31 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: 690406 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 20EF1C7EE23 for ; Mon, 5 Jun 2023 18:02:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235125AbjFESCk (ORCPT ); Mon, 5 Jun 2023 14:02:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234995AbjFESCc (ORCPT ); Mon, 5 Jun 2023 14:02:32 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF104100; Mon, 5 Jun 2023 11:02:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685988145; x=1717524145; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8OshzN+NZ7thIMcFVOb/IWor20ob/nSgjx3NSLzz3Fc=; b=COTaOf5cGOWogRzhFr9ar3dzo0Ettl4SRJlfPKg30rCzCO+LAGUHdqYx 8ZUSIjXhJoDi9OXHJ8EWMNFVBTgxPgJdC9KsFErdKodH4sUmSeBEBvLhg WNgHVCUQQacorHrPG7apTTETJtusuas94FuX2d2I1dU3NO+4CStmnoM2A nmxHk0tIBsv957jFk0yApMiaiJH/Pfr1MvJo/43SS0wOX2Ub2gyWGG61F X1YwhESE5rbshNfBR1myFS7fNzM7SBDTU5syFxcscPAFWCra5sr8Rl7qQ S5aY704d0ILAPWdJGbpvUo4PpTWdeap+9mq/+uiKeMYKlxCm8sefIY54M g==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="442814931" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="442814931" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:02:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="821274046" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="821274046" Received: from gfittedx-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.47.115]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:02:12 -0700 From: =?utf-8?q?Ilpo_J=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_J=C3=A4rvinen?= Subject: [PATCH v3 05/19] selftests/resctrl: Unmount resctrl FS before starting the first test Date: Mon, 5 Jun 2023 21:01:31 +0300 Message-Id: <20230605180145.112924-6-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> References: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Resctrl FS mount/remount/umount code is hard to track. Better approach is to use mount/umount pair for each test but that assumes resctrl FS is not mounted beforehand. Change umount_resctrlfs() so that it can unmount resctrl FS from any path, and enable further simplifications into mount/remount/umount logic by unmounting resctrl FS at the start if a pre-existing mountpoint is found. Suggested-by: Reinette Chatre Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/resctrl_tests.c | 2 ++ tools/testing/selftests/resctrl/resctrlfs.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index 9b9751206e1c..6fcf8fc3cfc0 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -223,6 +223,8 @@ int main(int argc, char **argv) if (geteuid() != 0) return ksft_exit_skip("Not running as root. Skipping...\n"); + umount_resctrlfs(); + if (has_ben) { /* Extract benchmark command from command line. */ for (i = ben_ind; i < argc; i++) { diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c index fb00245dee92..23f75aeaa198 100644 --- a/tools/testing/selftests/resctrl/resctrlfs.c +++ b/tools/testing/selftests/resctrl/resctrlfs.c @@ -82,10 +82,12 @@ int remount_resctrlfs(bool mum_resctrlfs) int umount_resctrlfs(void) { - if (find_resctrl_mount(NULL)) + char mountpoint[256]; + + if (find_resctrl_mount(mountpoint)) return 0; - if (umount(RESCTRL_PATH)) { + if (umount(mountpoint)) { perror("# Unable to umount resctrl"); return errno; From patchwork Mon Jun 5 18:01:33 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: 690405 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 DA4E5C7EE23 for ; Mon, 5 Jun 2023 18:02:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234848AbjFESC5 (ORCPT ); Mon, 5 Jun 2023 14:02:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232040AbjFESCo (ORCPT ); Mon, 5 Jun 2023 14:02:44 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3EE1E44; Mon, 5 Jun 2023 11:02:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685988156; x=1717524156; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RHLCXP5hfTbJ6gU+y68uMeUeAxpYN4g03xl30+9ejJk=; b=Ppw4iyId8ONnJheAOl3+grToJiUy02GnGhtHm9Rr/83hlOXTiNfSnoTD Zk0xh874vZ/mUZOkNvt87qaW1PuXBLH8+ODSGtl2t8FxxzYjGwv6gvOE3 BnLMa+ldFRGyYHZPinanEmwFNcxZYvY6XOXYGzwH0XmxpMHrWbO4fafau OoM57ZgkUB/jBgzrnkB5vAvc3DwLpoyUmQgi08NzzI6GGCpkoGgBZtJlE Uf2PbOtvV7fMM1tVy/xcLxgdwCvjOI8946GqpCFDKlY9171EA0E+ZePO9 f+LdQ9qOi33DFJTktUTGwLyea3K8F77dE6hLZGQpSXVJ/uXf31pCllGxC A==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="442815026" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="442815026" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:02:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="821274061" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="821274061" Received: from gfittedx-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.47.115]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:02:26 -0700 From: =?utf-8?q?Ilpo_J=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_J=C3=A4rvinen?= Subject: [PATCH v3 07/19] selftests/resctrl: Refactor remount_resctrl(bool mum_resctrlfs) to mount_resctrl() Date: Mon, 5 Jun 2023 21:01:33 +0300 Message-Id: <20230605180145.112924-8-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> References: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Mount/umount of the resctrl FS is now paired nicely per test. Rename remount_resctrl(bool mum_resctrlfs) to mount_resctrl(). Make it unconditionally try to mount the resctrl FS and return error if resctrl FS was mounted already. While at it, group the mount/umount prototypes in the header. Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/resctrl.h | 2 +- .../testing/selftests/resctrl/resctrl_tests.c | 8 ++++---- tools/testing/selftests/resctrl/resctrlfs.c | 20 +++++-------------- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h index f455f0b7e314..23af3fb73cb4 100644 --- a/tools/testing/selftests/resctrl/resctrl.h +++ b/tools/testing/selftests/resctrl/resctrl.h @@ -85,8 +85,8 @@ extern char llc_occup_path[1024]; int get_vendor(void); bool check_resctrlfs_support(void); int filter_dmesg(void); -int remount_resctrlfs(bool mum_resctrlfs); int get_resource_id(int cpu_no, int *resource_id); +int mount_resctrlfs(void); int umount_resctrlfs(void); int validate_bw_report_request(char *bw_report); bool validate_resctrl_feature_request(const char *resctrl_val); diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index 0ee73e722acc..048ea8ae1e28 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -77,7 +77,7 @@ static void run_mbm_test(bool has_ben, char **benchmark_cmd, int span, ksft_print_msg("Starting MBM BW change ...\n"); - res = remount_resctrlfs(true); + res = mount_resctrlfs(); if (res) { ksft_exit_fail_msg("Failed to mount resctrl FS\n"); return; @@ -106,7 +106,7 @@ static void run_mba_test(bool has_ben, char **benchmark_cmd, int span, ksft_print_msg("Starting MBA Schemata change ...\n"); - res = remount_resctrlfs(true); + res = mount_resctrlfs(); if (res) { ksft_exit_fail_msg("Failed to mount resctrl FS\n"); return; @@ -132,7 +132,7 @@ static void run_cmt_test(bool has_ben, char **benchmark_cmd, int cpu_no) ksft_print_msg("Starting CMT test ...\n"); - res = remount_resctrlfs(true); + res = mount_resctrlfs(); if (res) { ksft_exit_fail_msg("Failed to mount resctrl FS\n"); return; @@ -160,7 +160,7 @@ static void run_cat_test(int cpu_no, int no_of_bits) ksft_print_msg("Starting CAT test ...\n"); - res = remount_resctrlfs(true); + res = mount_resctrlfs(); if (res) { ksft_exit_fail_msg("Failed to mount resctrl FS\n"); return; diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c index b3a05488d360..f622245adafe 100644 --- a/tools/testing/selftests/resctrl/resctrlfs.c +++ b/tools/testing/selftests/resctrl/resctrlfs.c @@ -48,29 +48,19 @@ static int find_resctrl_mount(char *buffer) } /* - * remount_resctrlfs - Remount resctrl FS at /sys/fs/resctrl - * @mum_resctrlfs: Should the resctrl FS be remounted? + * mount_resctrlfs - Mount resctrl FS at /sys/fs/resctrl * * If not mounted, mount it. - * If mounted and mum_resctrlfs then remount resctrl FS. - * If mounted and !mum_resctrlfs then noop * * Return: 0 on success, non-zero on failure */ -int remount_resctrlfs(bool mum_resctrlfs) +int mount_resctrlfs(void) { - char mountpoint[256]; int ret; - ret = find_resctrl_mount(mountpoint); - if (ret) - strcpy(mountpoint, RESCTRL_PATH); - - if (!ret && mum_resctrlfs && umount(mountpoint)) - ksft_print_msg("Fail: unmounting \"%s\"\n", mountpoint); - - if (!ret && !mum_resctrlfs) - return 0; + ret = find_resctrl_mount(NULL); + if (!ret) + return -1; ksft_print_msg("Mounting resctrl to \"%s\"\n", RESCTRL_PATH); ret = mount("resctrl", RESCTRL_PATH, "resctrl", 0, NULL); From patchwork Mon Jun 5 18:01:35 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: 690404 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 55A15C77B73 for ; Mon, 5 Jun 2023 18:03:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235227AbjFESDU (ORCPT ); Mon, 5 Jun 2023 14:03:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235477AbjFESDG (ORCPT ); Mon, 5 Jun 2023 14:03:06 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 591C918E; Mon, 5 Jun 2023 11:02:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685988167; x=1717524167; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mKWZEta93QNnUWaFZQ8iTZ7+XYFP94leSifdnEXEsLo=; b=J4F4YQq7pV1WeYMMGn+GHbgO7paSIUcWX8qhFyXEnaxOboyoqK7w2vAF qQEbMW7/WtE+ZavvwM15vR0uwNLfsuyyUIawuNmRDTuoQJXcV+p3aTL2m oSjuC2FwNAZ0pI8a24ZqSFjSRajEFB5wZBZnwDbWhcOZ+Lr3bCDdRcPnf NeflqldV96f+LhHIH0RJM5tbzuh4twZ8k6O0695LLLSilaOnaX+E/o06P Snq4ZWBCeYtKF+VCzlKQThIeOIw8Dnwm/bz6q02P0NSZTF0YfAFL5zglZ 1kwDjBsA+WnozWYOZSlPScEJDOQuzMFsjaHKx9GFarCFx8xMTM7o+rix7 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="442815102" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="442815102" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:02:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="821274119" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="821274119" Received: from gfittedx-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.47.115]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:02:35 -0700 From: =?utf-8?q?Ilpo_J=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_J=C3=A4rvinen?= Subject: [PATCH v3 09/19] selftests/resctrl: Convert span to size_t Date: Mon, 5 Jun 2023 21:01:35 +0300 Message-Id: <20230605180145.112924-10-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> References: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Span is defined either as unsigned long or int. Consistently use size_t everywhere for span as it refers to size of the memory block. Co-developed-by: Fenghua Yu Signed-off-by: Fenghua Yu Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/cache.c | 4 ++-- tools/testing/selftests/resctrl/cmt_test.c | 2 +- tools/testing/selftests/resctrl/fill_buf.c | 8 ++++---- tools/testing/selftests/resctrl/mbm_test.c | 8 ++++---- tools/testing/selftests/resctrl/resctrl.h | 10 +++++----- tools/testing/selftests/resctrl/resctrl_tests.c | 11 ++++++----- tools/testing/selftests/resctrl/resctrlfs.c | 2 +- 7 files changed, 23 insertions(+), 22 deletions(-) diff --git a/tools/testing/selftests/resctrl/cache.c b/tools/testing/selftests/resctrl/cache.c index ced47b445d1e..f2c7d322bd76 100644 --- a/tools/testing/selftests/resctrl/cache.c +++ b/tools/testing/selftests/resctrl/cache.c @@ -282,7 +282,7 @@ int cat_val(struct resctrl_val_param *param) * Return: 0 on success. non-zero on failure. */ int show_cache_info(unsigned long sum_llc_val, int no_of_bits, - unsigned long cache_span, unsigned long max_diff, + size_t cache_span, unsigned long max_diff, unsigned long max_diff_percent, unsigned long num_of_runs, bool platform, bool cmt) { @@ -304,7 +304,7 @@ int show_cache_info(unsigned long sum_llc_val, int no_of_bits, ksft_print_msg("Percent diff=%d\n", abs((int)diff_percent)); ksft_print_msg("Number of bits: %d\n", no_of_bits); ksft_print_msg("Average LLC val: %lu\n", avg_llc_val); - ksft_print_msg("Cache span (%s): %lu\n", cmt ? "bytes" : "lines", + ksft_print_msg("Cache span (%s): %zu\n", cmt ? "bytes" : "lines", cache_span); return ret; diff --git a/tools/testing/selftests/resctrl/cmt_test.c b/tools/testing/selftests/resctrl/cmt_test.c index d31e28416bb7..beb0f0687c6d 100644 --- a/tools/testing/selftests/resctrl/cmt_test.c +++ b/tools/testing/selftests/resctrl/cmt_test.c @@ -121,7 +121,7 @@ int cmt_resctrl_val(int cpu_no, int n, char **benchmark_cmd) }; if (strcmp(benchmark_cmd[0], "fill_buf") == 0) - sprintf(benchmark_cmd[1], "%lu", param.span); + sprintf(benchmark_cmd[1], "%zu", param.span); remove(RESULT_FILE_NAME); diff --git a/tools/testing/selftests/resctrl/fill_buf.c b/tools/testing/selftests/resctrl/fill_buf.c index 3b328c844896..785cbd8d0148 100644 --- a/tools/testing/selftests/resctrl/fill_buf.c +++ b/tools/testing/selftests/resctrl/fill_buf.c @@ -139,7 +139,7 @@ static int fill_cache_write(unsigned char *start_ptr, unsigned char *end_ptr, } static int -fill_cache(unsigned long long buf_size, int malloc_and_init, int memflush, +fill_cache(size_t buf_size, int malloc_and_init, int memflush, int op, char *resctrl_val) { unsigned char *start_ptr, *end_ptr; @@ -188,10 +188,10 @@ fill_cache(unsigned long long buf_size, int malloc_and_init, int memflush, return 0; } -int run_fill_buf(unsigned long span, int malloc_and_init_memory, - int memflush, int op, char *resctrl_val) +int run_fill_buf(size_t span, int malloc_and_init_memory, int memflush, int op, + char *resctrl_val) { - unsigned long long cache_size = span; + size_t cache_size = span; int ret; ret = fill_cache(cache_size, malloc_and_init_memory, memflush, op, diff --git a/tools/testing/selftests/resctrl/mbm_test.c b/tools/testing/selftests/resctrl/mbm_test.c index 24326cb7bc21..fd116158d008 100644 --- a/tools/testing/selftests/resctrl/mbm_test.c +++ b/tools/testing/selftests/resctrl/mbm_test.c @@ -15,7 +15,7 @@ #define NUM_OF_RUNS 5 static int -show_bw_info(unsigned long *bw_imc, unsigned long *bw_resc, int span) +show_bw_info(unsigned long *bw_imc, unsigned long *bw_resc, size_t span) { unsigned long avg_bw_imc = 0, avg_bw_resc = 0; unsigned long sum_bw_imc = 0, sum_bw_resc = 0; @@ -40,14 +40,14 @@ show_bw_info(unsigned long *bw_imc, unsigned long *bw_resc, int 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): %d\n", span); + ksft_print_msg("Span (MB): %zu\n", span); ksft_print_msg("avg_bw_imc: %lu\n", avg_bw_imc); ksft_print_msg("avg_bw_resc: %lu\n", avg_bw_resc); return ret; } -static int check_results(int span) +static int check_results(size_t span) { unsigned long bw_imc[NUM_OF_RUNS], bw_resc[NUM_OF_RUNS]; char temp[1024], *token_array[8]; @@ -115,7 +115,7 @@ void mbm_test_cleanup(void) remove(RESULT_FILE_NAME); } -int mbm_bw_change(int span, int cpu_no, char *bw_report, char **benchmark_cmd) +int mbm_bw_change(size_t span, int cpu_no, char *bw_report, char **benchmark_cmd) { struct resctrl_val_param param = { .resctrl_val = MBM_STR, diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h index 99678d688a80..52068ceea956 100644 --- a/tools/testing/selftests/resctrl/resctrl.h +++ b/tools/testing/selftests/resctrl/resctrl.h @@ -63,7 +63,7 @@ struct resctrl_val_param { char ctrlgrp[64]; char mongrp[64]; int cpu_no; - unsigned long span; + size_t span; char filename[64]; char *bw_report; unsigned long mask; @@ -97,10 +97,10 @@ int write_bm_pid_to_resctrl(pid_t bm_pid, char *ctrlgrp, char *mongrp, char *resctrl_val); 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(unsigned long span, int malloc_and_init_memory, int memflush, - int op, char *resctrl_va); +int run_fill_buf(size_t span, int malloc_and_init_memory, int memflush, int op, + char *resctrl_va); int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param); -int mbm_bw_change(int span, int cpu_no, char *bw_report, char **benchmark_cmd); +int mbm_bw_change(size_t span, int cpu_no, char *bw_report, 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); @@ -119,7 +119,7 @@ void cmt_test_cleanup(void); int get_core_sibling(int cpu_no); int measure_cache_vals(struct resctrl_val_param *param, int bm_pid); int show_cache_info(unsigned long sum_llc_val, int no_of_bits, - unsigned long cache_span, unsigned long max_diff, + size_t cache_span, unsigned long max_diff, unsigned long max_diff_percent, unsigned long num_of_runs, bool platform, bool cmt); diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index 048ea8ae1e28..1c1fbcfcd086 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -70,7 +70,7 @@ void tests_cleanup(void) cat_test_cleanup(); } -static void run_mbm_test(bool has_ben, char **benchmark_cmd, int span, +static void run_mbm_test(bool has_ben, char **benchmark_cmd, size_t span, int cpu_no, char *bw_report) { int res; @@ -99,7 +99,7 @@ static void run_mbm_test(bool has_ben, char **benchmark_cmd, int span, umount_resctrlfs(); } -static void run_mba_test(bool has_ben, char **benchmark_cmd, int span, +static void run_mba_test(bool has_ben, char **benchmark_cmd, size_t span, int cpu_no, char *bw_report) { int res; @@ -118,7 +118,7 @@ static void run_mba_test(bool has_ben, char **benchmark_cmd, int span, } if (!has_ben) - sprintf(benchmark_cmd[1], "%d", span); + sprintf(benchmark_cmd[1], "%zu", span); res = mba_schemata_change(cpu_no, bw_report, benchmark_cmd); ksft_test_result(!res, "MBA: schemata change\n"); @@ -181,11 +181,12 @@ 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; - int c, cpu_no = 1, span = 250, argc_new = argc, i, no_of_bits = 0; 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; int ben_ind, ben_count, tests = 0; bool cat_test = true; + size_t span = 250; for (i = 0; i < argc; i++) { if (strcmp(argv[i], "-b") == 0) { @@ -275,7 +276,7 @@ int main(int argc, char **argv) benchmark_cmd[i] = benchmark_cmd_area[i]; strcpy(benchmark_cmd[0], "fill_buf"); - sprintf(benchmark_cmd[1], "%d", span); + sprintf(benchmark_cmd[1], "%zu", span); strcpy(benchmark_cmd[2], "1"); strcpy(benchmark_cmd[3], "1"); strcpy(benchmark_cmd[4], "0"); diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c index f622245adafe..8be5b745226d 100644 --- a/tools/testing/selftests/resctrl/resctrlfs.c +++ b/tools/testing/selftests/resctrl/resctrlfs.c @@ -298,7 +298,7 @@ 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; - unsigned long span, buffer_span; + size_t span, buffer_span; char **benchmark_cmd; char resctrl_val[64]; FILE *fp; From patchwork Mon Jun 5 18:01: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: 690403 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 0BC1EC77B73 for ; Mon, 5 Jun 2023 18:03:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234833AbjFESDt (ORCPT ); Mon, 5 Jun 2023 14:03:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234995AbjFESDd (ORCPT ); Mon, 5 Jun 2023 14:03:33 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEB08E5D; Mon, 5 Jun 2023 11:03:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685988186; x=1717524186; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9EARwlPZfMMlJoAYqZckfPS6SwIENQaRdEYW+Dd8Q3w=; b=RdwM3jU2CHdXK9Hnw16nhav7HrytyinHfeqFCrBF9sUJZ3qLfaxja0MQ J31O4U93K7YLYxb3q989F9T30RsBshDbYU5LWXETv7EnhGfG1N/adhXus R4yP44S4i2LZzKyJwNIWNPEqnSQgXoMzJkGtFJR2iWsbi6t+hm0lzvoDa 6cg2aEFt85ZCRAHBrydEL6QA8s9T02M8SLkxVe+Xedwu5DJ7T120NGRLw oSVoYccC1gbLsyAWf5u24dRJYWldFxzZImHKWcamHe2RPH+RFZjS+j2kH 3L3V+cjIgAiDjkhU6J9tnPNs341D89ih+d7hidfUcd3ysg8Z9wNIZThN5 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="442815201" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="442815201" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:02:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="821274172" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="821274172" Received: from gfittedx-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.47.115]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:02:53 -0700 From: =?utf-8?q?Ilpo_J=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_J=C3=A4rvinen?= Subject: [PATCH v3 11/19] selftests/resctrl: Remove duplicated preparation for span arg Date: Mon, 5 Jun 2023 21:01:37 +0300 Message-Id: <20230605180145.112924-12-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> References: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org When no benchmark_cmd is given, benchmark_cmd[1] is set to span in main(). There's no need to do it again in run_mba_test(). Remove the duplicated preparation for span argument into benchmark_cmd[1] from run_mba_test(). After this, the has_ben and span arguments to run_mba_test() can be removed. Co-developed-by: Fenghua Yu Signed-off-by: Fenghua Yu Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/resctrl_tests.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index 0fe83264e925..d54c5fd2c707 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -99,8 +99,7 @@ static void run_mbm_test(bool has_ben, char **benchmark_cmd, size_t span, umount_resctrlfs(); } -static void run_mba_test(bool has_ben, char **benchmark_cmd, size_t span, - int cpu_no, char *bw_report) +static void run_mba_test(char **benchmark_cmd, int cpu_no, char *bw_report) { int res; @@ -117,8 +116,6 @@ static void run_mba_test(bool has_ben, char **benchmark_cmd, size_t span, goto umount; } - if (!has_ben) - sprintf(benchmark_cmd[1], "%zu", span); res = mba_schemata_change(cpu_no, bw_report, benchmark_cmd); ksft_test_result(!res, "MBA: schemata change\n"); @@ -298,7 +295,7 @@ int main(int argc, char **argv) run_mbm_test(has_ben, benchmark_cmd, span, cpu_no, bw_report); if (mba_test) - run_mba_test(has_ben, benchmark_cmd, span, cpu_no, bw_report); + run_mba_test(benchmark_cmd, cpu_no, bw_report); if (cmt_test) run_cmt_test(has_ben, benchmark_cmd, cpu_no); From patchwork Mon Jun 5 18:01:39 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: 690402 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 2A7D9C7EE23 for ; Mon, 5 Jun 2023 18:04:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235512AbjFESEH (ORCPT ); Mon, 5 Jun 2023 14:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235553AbjFESDr (ORCPT ); Mon, 5 Jun 2023 14:03:47 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDECAE75; Mon, 5 Jun 2023 11:03:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685988205; x=1717524205; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ReRBurQsGT7Fx6kcQMK28MT5AqfN9HI/hJmNwwtabwY=; b=B5rkXrBOtbX4+W8RCw/5xZ9C4h1NbXjTDVxCTJd36qdjLtYNmDRhW08J j4TjGm+j9UhtuHAZ//RUMvuQNiSZ2hriljPISRVdnf1MmJ5Le5tI9EJeC pTAnzHiTE+k65Fuaw46ZL2yFi2RwxNXtwKcW8Ya6I49p+LhzlrogIAPNz BnYo8/4/mJ4y7Lo43OAiA3G/qXw+MTJs43530lAzyq4Bx38KK0hjna5UJ mGzro+JtVWeX4hsJtgNNymSovQwU5tC37DIffagvdkzekC01gsd92V/EH WXI13kD0Wa99XzvwwFpK2GjnzF2axGszMUCif3+LYSijiF35iBMALreUP A==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="442815300" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="442815300" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:03:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="821274223" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="821274223" Received: from gfittedx-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.47.115]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:03:08 -0700 From: =?utf-8?q?Ilpo_J=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_J=C3=A4rvinen?= Subject: [PATCH v3 13/19] selftests/resctrl: Remove unnecessary startptr global from fill_buf Date: Mon, 5 Jun 2023 21:01:39 +0300 Message-Id: <20230605180145.112924-14-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> References: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org fill_buf stores buffer pointer into global variable startptr that is only used in fill_cache(). Remove startptr as global variable, the local variable in fill_cache() is enough to keep the pointer. Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/fill_buf.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/testing/selftests/resctrl/fill_buf.c b/tools/testing/selftests/resctrl/fill_buf.c index d8f5505eb9e6..a5ec9c82a960 100644 --- a/tools/testing/selftests/resctrl/fill_buf.c +++ b/tools/testing/selftests/resctrl/fill_buf.c @@ -22,8 +22,6 @@ #define PAGE_SIZE (4 * 1024) #define MB (1024 * 1024) -static unsigned char *startptr; - static void sb(void) { #if defined(__i386) || defined(__x86_64) @@ -147,7 +145,6 @@ static int fill_cache(size_t buf_size, int memflush, int op, char *resctrl_val) if (!start_ptr) return -1; - startptr = start_ptr; end_ptr = start_ptr + buf_size; /* Flush the memory before using to avoid "cache hot pages" effect */ @@ -159,7 +156,7 @@ static int fill_cache(size_t buf_size, int memflush, int op, char *resctrl_val) else ret = fill_cache_write(start_ptr, end_ptr, resctrl_val); - free(startptr); + free(start_ptr); if (ret) { printf("\n Error in fill cache read/write...\n"); From patchwork Mon Jun 5 18:01:41 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: 690401 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 B4D60C77B73 for ; Mon, 5 Jun 2023 18:04:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235508AbjFESEW (ORCPT ); Mon, 5 Jun 2023 14:04:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235517AbjFESD7 (ORCPT ); Mon, 5 Jun 2023 14:03:59 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F6191B4; Mon, 5 Jun 2023 11:03:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685988219; x=1717524219; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hY82rIdo8vjFErjnPfDyLd5FFpJDqjIjLLuMBf0AKfA=; b=DrcqlBMwTLA+j3VAboRdagVOQHubL552BK3JeDVDYWVzfEyIUUZ47OI4 x/VvD8+nW/5p0I+LAPqGsJTYnTTD3wdjBXQur2yyW/xudGjTJgi7Ea9py M2EZq7L24l5N8rEBevdbmXS4GIo5RmrcCUMF44BpwReW+HbLssojJJOOq kImHzLlQRhlQPZRNeUKa3cw7wuwJ35FLN/TiuzZ4Ugp5GE9xMPbH/xq+q i9bQV9ejJMCWXqNR5+vMhelfo3IDij0JcqvF6irqH5Ia5p7KqRUAkB7P/ +kKfoy7z9g9YqomDjG0jd6DQsoXWdo3qqXYfYWO9rfulIVQuzzBoSum5E Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="442815411" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="442815411" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:03:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="821274279" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="821274279" Received: from gfittedx-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.47.115]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:03:24 -0700 From: =?utf-8?q?Ilpo_J=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_J=C3=A4rvinen?= Subject: [PATCH v3 15/19] selftests/resctrl: Don't pass test name to fill_buf Date: Mon, 5 Jun 2023 21:01:41 +0300 Message-Id: <20230605180145.112924-16-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> References: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Test name is passed to fill_buf functions so that they can loop around buffer only once. This is required for CAT test case. To loop around buffer only once, caller doesn't need to let fill_buf know which test case it is. Instead, pass a boolean argument 'once' which makes fill_buf more generic. As run_benchmark() no longer needs to pass the test name to run_fill_buf(), a few test running functions can be simplified to not write the test name into the default benchmark_cmd. The has_ben argument can also be removed now from those test running functions. Co-developed-by: Fenghua Yu Signed-off-by: Fenghua Yu Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/cache.c | 3 +-- tools/testing/selftests/resctrl/fill_buf.c | 20 +++++++++---------- tools/testing/selftests/resctrl/resctrl.h | 2 +- .../testing/selftests/resctrl/resctrl_tests.c | 14 +++++-------- tools/testing/selftests/resctrl/resctrlfs.c | 11 +++++++--- 5 files changed, 24 insertions(+), 26 deletions(-) diff --git a/tools/testing/selftests/resctrl/cache.c b/tools/testing/selftests/resctrl/cache.c index 0db97b6a542f..bf758f2e5578 100644 --- a/tools/testing/selftests/resctrl/cache.c +++ b/tools/testing/selftests/resctrl/cache.c @@ -248,8 +248,7 @@ int cat_val(struct resctrl_val_param *param) if (ret) break; - if (run_fill_buf(param->span, memflush, operation, - resctrl_val)) { + if (run_fill_buf(param->span, memflush, operation, true)) { fprintf(stderr, "Error-running fill buffer\n"); ret = -1; close(fd_lm); diff --git a/tools/testing/selftests/resctrl/fill_buf.c b/tools/testing/selftests/resctrl/fill_buf.c index 5f16c4f5dfbf..0d425f26583a 100644 --- a/tools/testing/selftests/resctrl/fill_buf.c +++ b/tools/testing/selftests/resctrl/fill_buf.c @@ -101,15 +101,14 @@ static void fill_one_span_write(unsigned char *buf, size_t buf_size) } } -static int fill_cache_read(unsigned char *buf, size_t buf_size, - char *resctrl_val) +static int fill_cache_read(unsigned char *buf, size_t buf_size, bool once) { int ret = 0; FILE *fp; while (1) { ret = fill_one_span_read(buf, buf_size); - if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR))) + if (once) break; } @@ -125,19 +124,18 @@ static int fill_cache_read(unsigned char *buf, size_t buf_size, return 0; } -static int fill_cache_write(unsigned char *buf, size_t buf_size, - char *resctrl_val) +static int fill_cache_write(unsigned char *buf, size_t buf_size, bool once) { while (1) { fill_one_span_write(buf, buf_size); - if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR))) + if (once) break; } return 0; } -static int fill_cache(size_t buf_size, int memflush, int op, char *resctrl_val) +static int fill_cache(size_t buf_size, int memflush, int op, bool once) { unsigned char *buf; int ret; @@ -151,9 +149,9 @@ static int fill_cache(size_t buf_size, int memflush, int op, char *resctrl_val) mem_flush(buf, buf_size); if (op == 0) - ret = fill_cache_read(buf, buf_size, resctrl_val); + ret = fill_cache_read(buf, buf_size, once); else - ret = fill_cache_write(buf, buf_size, resctrl_val); + ret = fill_cache_write(buf, buf_size, once); free(buf); @@ -166,12 +164,12 @@ static int fill_cache(size_t buf_size, int memflush, int op, char *resctrl_val) return 0; } -int run_fill_buf(size_t span, int memflush, int op, char *resctrl_val) +int run_fill_buf(size_t span, int memflush, int op, bool once) { size_t cache_size = span; int ret; - ret = fill_cache(cache_size, memflush, op, resctrl_val); + ret = fill_cache(cache_size, memflush, op, once); if (ret) { printf("\n Error in fill cache\n"); return -1; diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h index 3054cc4ef0e3..645ad407bd8d 100644 --- a/tools/testing/selftests/resctrl/resctrl.h +++ b/tools/testing/selftests/resctrl/resctrl.h @@ -97,7 +97,7 @@ int write_bm_pid_to_resctrl(pid_t bm_pid, char *ctrlgrp, char *mongrp, char *resctrl_val); 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, char *resctrl_val); +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); void tests_cleanup(void); diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index 169e50b89d72..a770b9878d46 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -70,7 +70,7 @@ void tests_cleanup(void) cat_test_cleanup(); } -static void run_mbm_test(bool has_ben, char **benchmark_cmd, size_t span, +static void run_mbm_test(char **benchmark_cmd, size_t span, int cpu_no, char *bw_report) { int res; @@ -88,8 +88,6 @@ static void run_mbm_test(bool has_ben, char **benchmark_cmd, size_t span, goto umount; } - if (!has_ben) - sprintf(benchmark_cmd[4], "%s", MBA_STR); res = mbm_bw_change(span, cpu_no, bw_report, benchmark_cmd); ksft_test_result(!res, "MBM: bw change\n"); if ((get_vendor() == ARCH_INTEL) && res) @@ -123,7 +121,7 @@ static void run_mba_test(char **benchmark_cmd, int cpu_no, char *bw_report) umount_resctrlfs(); } -static void run_cmt_test(bool has_ben, char **benchmark_cmd, int cpu_no) +static void run_cmt_test(char **benchmark_cmd, int cpu_no) { int res; @@ -140,8 +138,6 @@ static void run_cmt_test(bool has_ben, char **benchmark_cmd, int cpu_no) goto umount; } - if (!has_ben) - sprintf(benchmark_cmd[4], "%s", CMT_STR); res = cmt_resctrl_val(cpu_no, 5, benchmark_cmd); ksft_test_result(!res, "CMT: test\n"); if ((get_vendor() == ARCH_INTEL) && res) @@ -276,7 +272,7 @@ int main(int argc, char **argv) sprintf(benchmark_cmd[1], "%zu", span); strcpy(benchmark_cmd[2], "1"); strcpy(benchmark_cmd[3], "0"); - strcpy(benchmark_cmd[4], ""); + strcpy(benchmark_cmd[4], "false"); benchmark_cmd[5] = NULL; } @@ -291,13 +287,13 @@ int main(int argc, char **argv) ksft_set_plan(tests ? : 4); if (mbm_test) - run_mbm_test(has_ben, benchmark_cmd, span, cpu_no, bw_report); + run_mbm_test(benchmark_cmd, span, cpu_no, bw_report); if (mba_test) run_mba_test(benchmark_cmd, cpu_no, bw_report); if (cmt_test) - run_cmt_test(has_ben, benchmark_cmd, cpu_no); + run_cmt_test(benchmark_cmd, cpu_no); if (cat_test) run_cat_test(cpu_no, no_of_bits); diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c index 5f41ce03c470..4373483cc1d6 100644 --- a/tools/testing/selftests/resctrl/resctrlfs.c +++ b/tools/testing/selftests/resctrl/resctrlfs.c @@ -299,8 +299,8 @@ void run_benchmark(int signum, siginfo_t *info, void *ucontext) { int operation, ret, memflush; char **benchmark_cmd; - char resctrl_val[64]; size_t span; + bool once; FILE *fp; benchmark_cmd = info->si_ptr; @@ -318,9 +318,14 @@ 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]); - sprintf(resctrl_val, "%s", benchmark_cmd[4]); + if (!strcmp(benchmark_cmd[4], "true")) + once = true; + else if (!strcmp(benchmark_cmd[4], "false")) + once = false; + else + PARENT_EXIT("Invalid once parameter"); - if (run_fill_buf(span, memflush, operation, resctrl_val)) + if (run_fill_buf(span, memflush, operation, once)) fprintf(stderr, "Error in running fill buffer\n"); } else { /* Execute specified benchmark */ From patchwork Mon Jun 5 18:01: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: 690400 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 0839CC77B73 for ; Mon, 5 Jun 2023 18:04:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235673AbjFESEl (ORCPT ); Mon, 5 Jun 2023 14:04:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235561AbjFESEI (ORCPT ); Mon, 5 Jun 2023 14:04:08 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC41010F2; Mon, 5 Jun 2023 11:03:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685988227; x=1717524227; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=adWz9KGhV5KjAo3m22fwN6bZ55XBth7V+DQufUxY6uk=; b=gZ0jy6VOzfLNlKUKbs4r31Eqg9TiHH4sx184OVSpFQxcJBsOv/nCDAwJ d3RIVvwKUKPbkaTl4OYcv4Bk8pauoiFyfwOjE+rJ7ks5fWyn0w5K906VN XchraR8ZbwKGdsmYIyLya8fFfQJV3yyKc73YxIQXJUii8KHXz2PnSCZWp 1kxRUsx6dy2u0/OnC2WPScvN1LM093Y6xj1zRrVRsNWYg7aVySut15Mlz PI3VFNBHvf1R/ofk0o/ACpQ7HOndkrfIeU2Q8BVmwtQyLKQBXwEaVVjqt T+v7d3zuoH3ZTjPgNRR3VPfPC+UHgEZYWwXgIimmFZsy5ZoR1B+C5hQzM w==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="442815431" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="442815431" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:03:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="821274299" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="821274299" Received: from gfittedx-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.47.115]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:03:29 -0700 From: =?utf-8?q?Ilpo_J=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_J=C3=A4rvinen?= Subject: [PATCH v3 16/19] selftests/resctrl: Don't use variable argument list for ->setup() Date: Mon, 5 Jun 2023 21:01:42 +0300 Message-Id: <20230605180145.112924-17-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> References: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org struct resctrl_val_param has ->setup() function that accepts variable argument list. All test cases use only 1 argument as input and it's the struct resctrl_val_param pointer. Instead of variable argument list, directly pass struct resctrl_val_param pointer as the only parameter to ->setup(). Co-developed-by: Fenghua Yu Signed-off-by: Fenghua Yu Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/cache.c | 2 +- tools/testing/selftests/resctrl/cat_test.c | 8 +------- tools/testing/selftests/resctrl/cmt_test.c | 9 +-------- tools/testing/selftests/resctrl/mba_test.c | 8 +------- tools/testing/selftests/resctrl/mbm_test.c | 8 +------- tools/testing/selftests/resctrl/resctrl.h | 3 +-- tools/testing/selftests/resctrl/resctrl_val.c | 2 +- 7 files changed, 7 insertions(+), 33 deletions(-) diff --git a/tools/testing/selftests/resctrl/cache.c b/tools/testing/selftests/resctrl/cache.c index bf758f2e5578..385c01dd3ec6 100644 --- a/tools/testing/selftests/resctrl/cache.c +++ b/tools/testing/selftests/resctrl/cache.c @@ -237,7 +237,7 @@ int cat_val(struct resctrl_val_param *param) /* Test runs until the callback setup() tells the test to stop. */ while (1) { if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR))) { - ret = param->setup(1, param); + ret = param->setup(param); if (ret == END_OF_TESTS) { ret = 0; break; diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c index 480db0dc4e0e..42e35269d8b6 100644 --- a/tools/testing/selftests/resctrl/cat_test.c +++ b/tools/testing/selftests/resctrl/cat_test.c @@ -27,17 +27,11 @@ static unsigned long cache_size; * con_mon grp, mon_grp in resctrl FS. * Run 5 times in order to get average values. */ -static int cat_setup(int num, ...) +static int cat_setup(struct resctrl_val_param *p) { - struct resctrl_val_param *p; char schemata[64]; - va_list param; int ret = 0; - va_start(param, num); - p = va_arg(param, struct resctrl_val_param *); - va_end(param); - /* Run NUM_OF_RUNS times */ if (p->num_of_runs >= NUM_OF_RUNS) return END_OF_TESTS; diff --git a/tools/testing/selftests/resctrl/cmt_test.c b/tools/testing/selftests/resctrl/cmt_test.c index beb0f0687c6d..7214aefb55ed 100644 --- a/tools/testing/selftests/resctrl/cmt_test.c +++ b/tools/testing/selftests/resctrl/cmt_test.c @@ -21,15 +21,8 @@ static char cbm_mask[256]; static unsigned long long_mask; static unsigned long cache_size; -static int cmt_setup(int num, ...) +static int cmt_setup(struct resctrl_val_param *p) { - struct resctrl_val_param *p; - va_list param; - - va_start(param, num); - p = va_arg(param, struct resctrl_val_param *); - va_end(param); - /* Run NUM_OF_RUNS times */ if (p->num_of_runs >= NUM_OF_RUNS) return END_OF_TESTS; diff --git a/tools/testing/selftests/resctrl/mba_test.c b/tools/testing/selftests/resctrl/mba_test.c index 3d53c6c9b9ce..4d2f145804b8 100644 --- a/tools/testing/selftests/resctrl/mba_test.c +++ b/tools/testing/selftests/resctrl/mba_test.c @@ -22,18 +22,12 @@ * con_mon grp, mon_grp in resctrl FS. * For each allocation, run 5 times in order to get average values. */ -static int mba_setup(int num, ...) +static int mba_setup(struct resctrl_val_param *p) { static int runs_per_allocation, allocation = 100; - struct resctrl_val_param *p; char allocation_str[64]; - va_list param; int ret; - va_start(param, num); - p = va_arg(param, struct resctrl_val_param *); - va_end(param); - if (runs_per_allocation >= NUM_OF_RUNS) runs_per_allocation = 0; diff --git a/tools/testing/selftests/resctrl/mbm_test.c b/tools/testing/selftests/resctrl/mbm_test.c index 2d58d4b8a918..c7de6f5977f6 100644 --- a/tools/testing/selftests/resctrl/mbm_test.c +++ b/tools/testing/selftests/resctrl/mbm_test.c @@ -86,16 +86,10 @@ static int check_results(size_t span) return ret; } -static int mbm_setup(int num, ...) +static int mbm_setup(struct resctrl_val_param *p) { - struct resctrl_val_param *p; - va_list param; int ret = 0; - va_start(param, num); - p = va_arg(param, struct resctrl_val_param *); - va_end(param); - /* Run NUM_OF_RUNS times */ if (p->num_of_runs >= NUM_OF_RUNS) return END_OF_TESTS; diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h index 645ad407bd8d..838d1a438f33 100644 --- a/tools/testing/selftests/resctrl/resctrl.h +++ b/tools/testing/selftests/resctrl/resctrl.h @@ -3,7 +3,6 @@ #ifndef RESCTRL_H #define RESCTRL_H #include -#include #include #include #include @@ -68,7 +67,7 @@ struct resctrl_val_param { char *bw_report; unsigned long mask; int num_of_runs; - int (*setup)(int num, ...); + int (*setup)(struct resctrl_val_param *param); }; #define MBM_STR "mbm" diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c index e8f1e6a59f4a..f0f6c5f6e98b 100644 --- a/tools/testing/selftests/resctrl/resctrl_val.c +++ b/tools/testing/selftests/resctrl/resctrl_val.c @@ -759,7 +759,7 @@ int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param) /* Test runs until the callback setup() tells the test to stop. */ while (1) { - ret = param->setup(1, param); + ret = param->setup(param); if (ret == END_OF_TESTS) { ret = 0; break; From patchwork Mon Jun 5 18:01:43 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: 689602 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 804FAC77B73 for ; Mon, 5 Jun 2023 18:05:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235681AbjFESEr (ORCPT ); Mon, 5 Jun 2023 14:04:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235581AbjFESES (ORCPT ); Mon, 5 Jun 2023 14:04:18 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5CCCFD; Mon, 5 Jun 2023 11:03:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685988233; x=1717524233; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WIWnJB3NculwQZQw1FR80Zi4TS+CrST66ZBC+3Ji4ag=; b=gkUCxu8kGHduqpOaksF+INZPWE6qEIiouRjBMDvc6uTUJ+HR+V83xXuL aDD0P9SMuzpsst7y7cOejGpUybdJVA8J8mvaCOV7dDeMcv4xhDKIUzkmi qZwRvJqgfNQg7kLEuDQhqU0ljB5o+PwvOMfRgVfI2hYsKX+fa43Y0jcWk sTV+td5oLlzQK2g3/e/OArhr6E1VLUABZBzFhAD6piOIbREbDYFXgh6zS 6oHkl1ZJs30r0FAyOIAEJy/KKUJ1UBQRPOYgEuLibR5gdgKJQUGpk3vIF IqGeUjvIDucRHho6adf6ChY4xNTlqsJfAH0yMlJafYzWOZj48+T9ITiqB A==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="442815454" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="442815454" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:03:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="821274321" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="821274321" Received: from gfittedx-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.47.115]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:03:33 -0700 From: =?utf-8?q?Ilpo_J=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_J=C3=A4rvinen?= Subject: [PATCH v3 17/19] selftests/resctrl: Move CAT/CMT test global vars to function they are used in Date: Mon, 5 Jun 2023 21:01:43 +0300 Message-Id: <20230605180145.112924-18-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> References: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org CAT and CMT tests have count_of_bits, long_mask, cbm_mask, and cache_size global variables that can be moved into the sole using function. Make the global variables local variables of the relevant function to scope them better. While at it, move cache_size initialization into the declaration line. Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/cat_test.c | 11 ++++------- tools/testing/selftests/resctrl/cmt_test.c | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c index 42e35269d8b6..ed6c8e64ad11 100644 --- a/tools/testing/selftests/resctrl/cat_test.c +++ b/tools/testing/selftests/resctrl/cat_test.c @@ -17,11 +17,6 @@ #define MAX_DIFF_PERCENT 4 #define MAX_DIFF 1000000 -static int count_of_bits; -static char cbm_mask[256]; -static unsigned long long_mask; -static unsigned long cache_size; - /* * Change schemata. Write schemata to specified * con_mon grp, mon_grp in resctrl FS. @@ -96,10 +91,12 @@ int cat_perf_miss_val(int cpu_no, int n, char *cache_type) { unsigned long l_mask, l_mask_1; int ret, pipefd[2], sibling_cpu_no; + unsigned long cache_size = 0; + unsigned long long_mask; + char cbm_mask[256]; + int count_of_bits; char pipe_message; - cache_size = 0; - /* Get default cbm mask for L3/L2 cache */ ret = get_cbm_mask(cache_type, cbm_mask); if (ret) diff --git a/tools/testing/selftests/resctrl/cmt_test.c b/tools/testing/selftests/resctrl/cmt_test.c index 7214aefb55ed..0ac9d6bbd13d 100644 --- a/tools/testing/selftests/resctrl/cmt_test.c +++ b/tools/testing/selftests/resctrl/cmt_test.c @@ -16,11 +16,6 @@ #define MAX_DIFF 2000000 #define MAX_DIFF_PERCENT 15 -static int count_of_bits; -static char cbm_mask[256]; -static unsigned long long_mask; -static unsigned long cache_size; - static int cmt_setup(struct resctrl_val_param *p) { /* Run NUM_OF_RUNS times */ @@ -75,10 +70,12 @@ void cmt_test_cleanup(void) int cmt_resctrl_val(int cpu_no, int n, char **benchmark_cmd) { + unsigned long cache_size = 0; + unsigned long long_mask; + char cbm_mask[256]; + int count_of_bits; int ret; - cache_size = 0; - if (!validate_resctrl_feature_request(CMT_STR)) return -1; From patchwork Mon Jun 5 18:01:44 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: 689601 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 74E0FC7EE2E for ; Mon, 5 Jun 2023 18:05:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234995AbjFESFK (ORCPT ); Mon, 5 Jun 2023 14:05:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235503AbjFESEW (ORCPT ); Mon, 5 Jun 2023 14:04:22 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB60B10F6; Mon, 5 Jun 2023 11:03:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685988239; x=1717524239; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tlqcBuGsxOSKA74bKjbrp+jQUh7f0hcz1UsL+nprPCM=; b=Wqpt7jOaUP7T6Zma2jkS7N41+GFkGsSzywN/hkT9eH8F1symbnGa7ja+ nP1jxfM/KVuLqgkvxTzVCkcf9KkqQgHoKvuAxi/Tx0N8GQTW4r4RSYj7d 1pM+Tizzia2uo2vcdyYGnkf+uIe1Lw2yk1kDao0qYpprGKjYrNP9MpmBx fYPlRqB6rERAuscFKRJzzLEJ6+GwcAl/vj8VdgdyzX1NyfUInbKw53iTA IMx16CTE+ztTfC+wXLxlyiGv5sWUCy5N9YQ7+bzvRP2opNs5ahMlbL4XK aqV0TRuJEULRu1owJCqEet/VUn+p73PS9nEyxPJ7X5uPeWnfPuLMOs6Jk w==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="442815458" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="442815458" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:03:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="821274326" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="821274326" Received: from gfittedx-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.47.115]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:03:36 -0700 From: =?utf-8?q?Ilpo_J=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_J=C3=A4rvinen?= Subject: [PATCH v3 18/19] selftests/resctrl: Pass the real number of tests to show_cache_info() Date: Mon, 5 Jun 2023 21:01:44 +0300 Message-Id: <20230605180145.112924-19-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> References: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Results include warm-up test which is discarded before passing the sum to show_cache_info(). show_cache_info() handles this by subtracting one from the number of tests in divisor. It is a trappy construct to have sum and number of tests parameters to disagree like this. A more logical place for subtracting the skipped tests is where the sum is calculated so move it there. Pass the correct number of tests to show_cache_info() so it can be used directly as the divisor for calculating the average. Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/cache.c | 2 +- tools/testing/selftests/resctrl/cat_test.c | 2 +- tools/testing/selftests/resctrl/cmt_test.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/resctrl/cache.c b/tools/testing/selftests/resctrl/cache.c index 385c01dd3ec6..5aa112e5fdd3 100644 --- a/tools/testing/selftests/resctrl/cache.c +++ b/tools/testing/selftests/resctrl/cache.c @@ -290,7 +290,7 @@ int show_cache_info(unsigned long sum_llc_val, int no_of_bits, long avg_diff = 0; int ret; - avg_llc_val = sum_llc_val / (num_of_runs - 1); + avg_llc_val = sum_llc_val / num_of_runs; avg_diff = (long)abs(cache_span - avg_llc_val); diff_percent = ((float)cache_span - avg_llc_val) / cache_span * 100; diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c index ed6c8e64ad11..3848dfb46aba 100644 --- a/tools/testing/selftests/resctrl/cat_test.c +++ b/tools/testing/selftests/resctrl/cat_test.c @@ -77,7 +77,7 @@ static int check_results(struct resctrl_val_param *param) no_of_bits = count_bits(param->mask); return show_cache_info(sum_llc_perf_miss, no_of_bits, param->span / 64, - MAX_DIFF, MAX_DIFF_PERCENT, NUM_OF_RUNS, + MAX_DIFF, MAX_DIFF_PERCENT, runs - 1, get_vendor() == ARCH_INTEL, false); } diff --git a/tools/testing/selftests/resctrl/cmt_test.c b/tools/testing/selftests/resctrl/cmt_test.c index 0ac9d6bbd13d..cb2197647c6c 100644 --- a/tools/testing/selftests/resctrl/cmt_test.c +++ b/tools/testing/selftests/resctrl/cmt_test.c @@ -59,7 +59,7 @@ static int check_results(struct resctrl_val_param *param, int no_of_bits) fclose(fp); return show_cache_info(sum_llc_occu_resc, no_of_bits, param->span, - MAX_DIFF, MAX_DIFF_PERCENT, NUM_OF_RUNS, + MAX_DIFF, MAX_DIFF_PERCENT, runs - 1, true, true); } From patchwork Mon Jun 5 18:01:45 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: 690399 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 C7291C7EE2F for ; Mon, 5 Jun 2023 18:05:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235188AbjFESFL (ORCPT ); Mon, 5 Jun 2023 14:05:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235675AbjFESEm (ORCPT ); Mon, 5 Jun 2023 14:04:42 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 486B8171A; Mon, 5 Jun 2023 11:04: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=1685988245; x=1717524245; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=B1zmj95tGIdII2SZaOFKFZ8yIm0cMc8pTOJH7ndgiGQ=; b=dzYxMN3cphfYJDWpZM+cEhM81ybrkF/UufQDDSjivZvNSrZpCEGsZkjb ARUQ+ArnXL4lfrm1TR9FRETctnyfCoojv+Pe9trbggHIKQysGyHKGqB17 tPI7hEoWfMW0/g7LUvcZTvmtzAafTfiBqPs+r0a/bvh2eqSLdYTHDhK3q Zh70GbNOUOY66ug9iFFfYcDxNQ9X4GTwFZmYmNrp0lpd8VjBhUTqQJetd jz5VQEppIZUrj09Bdq0AwEoPy2I80O71HK5l7NikDoKBsJ5zP2zdcSjCq EIM7cILBiVOOkoAnQyMbNtb0Brv62l2k9ntjSKnDRx/DOWf3ECkcWSFuj w==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="442815469" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="442815469" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:03:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="821274331" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="821274331" Received: from gfittedx-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.47.115]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 11:03:39 -0700 From: =?utf-8?q?Ilpo_J=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_J=C3=A4rvinen?= Subject: [PATCH v3 19/19] selftests/resctrl: Remove test type checks from cat_val() Date: Mon, 5 Jun 2023 21:01:45 +0300 Message-Id: <20230605180145.112924-20-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> References: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org cat_val() is only used during CAT test but it checks for test type. Remove test type checks and the unused else branch from cat_val(). Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/cache.c | 47 +++++++++++-------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/tools/testing/selftests/resctrl/cache.c b/tools/testing/selftests/resctrl/cache.c index 5aa112e5fdd3..2758e1a3b255 100644 --- a/tools/testing/selftests/resctrl/cache.c +++ b/tools/testing/selftests/resctrl/cache.c @@ -231,37 +231,32 @@ int cat_val(struct resctrl_val_param *param) if (ret) return ret; - if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR))) - initialize_llc_perf(); + initialize_llc_perf(); /* Test runs until the callback setup() tells the test to stop. */ while (1) { - if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR))) { - ret = param->setup(param); - if (ret == END_OF_TESTS) { - ret = 0; - break; - } - if (ret < 0) - break; - ret = reset_enable_llc_perf(bm_pid, param->cpu_no); - if (ret) - break; - - if (run_fill_buf(param->span, memflush, operation, true)) { - fprintf(stderr, "Error-running fill buffer\n"); - ret = -1; - close(fd_lm); - break; - } - - sleep(1); - ret = measure_cache_vals(param, bm_pid); - if (ret) - break; - } else { + ret = param->setup(param); + if (ret == END_OF_TESTS) { + ret = 0; break; } + if (ret < 0) + break; + ret = reset_enable_llc_perf(bm_pid, param->cpu_no); + if (ret) + break; + + if (run_fill_buf(param->span, memflush, operation, true)) { + fprintf(stderr, "Error-running fill buffer\n"); + ret = -1; + close(fd_lm); + break; + } + + sleep(1); + ret = measure_cache_vals(param, bm_pid); + if (ret) + break; } return ret;