Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2139825rdb; Mon, 20 Nov 2023 03:14:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGKaGwRswZv1RMNe+WDNiZ+JSAvXDFRCHCxI4dD0AZR+80vs9rAWIWxIeJw1EwCEtMr59jj X-Received: by 2002:a92:ad09:0:b0:35a:fbe8:ab03 with SMTP id w9-20020a92ad09000000b0035afbe8ab03mr5300101ilh.19.1700478868337; Mon, 20 Nov 2023 03:14:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700478868; cv=none; d=google.com; s=arc-20160816; b=ujtsho+TdWucaelgaXVhn1Yd14RF1AfiGjKFhtXARpg/m4WrhoC3ucVHlnRWKgxBUG jpjRa76dasputWn5h7pb/TF4EzJYqu/tsT+/tIGn6Sje56mcNBlz8RsnFNVVbuvaPNec dQM7nlIwzBruo4AOPnrZz94Daxin9iqZAK34TpCbxUUNrJZElV0VdwbEs08wOVvl5ISh wdrLn0MGBVSnRfHjAA9chkX1M7jaFlYGQJXDmmPEjsHl7Lhi9VZ8gv0mNj6zDCxajHGG JZ7Tr9lD0q+3EBlvzxK9Dujp+XjxlcIrfRZib3XwGsh1y9lF/LSVa/hQl0IZq3SXhT21 l4+A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=bi8vXXCcrW/U3+gJQHWE0gbsGFCnxVzVYTqFTXHs7TU=; fh=gPQ6jqLSfsDb5bE3yrtO+AlT5R4d75RXkjC5xckz7Dk=; b=g/Gj3GXMOel+dL8s2XJGC6yPM83GrldF1uzMIs8BlXP2uoXWOQ8TefEFgJMSXW8Ta6 NQX3kPYTzhtG6IfKJsb7T1OBkxO2f/9t63YSEYkWpemNYtPQZGhB9YcE2r1RGPyhRaZR pbA0Nicu+GKeOSjujICFGCVG9J0yYWfhSWlvv/tN2BBXqF9bmaL9rIrAJ1E7ph72Dqis tSx3rEJnt4tcKGKwUGL/aiPFcAUMNMfYVvbOFjIpceuNI6BAIm5ajSPRLdffRqX/yRQ1 tuh0pdUTHs1qzZHok26DpJ2dSjWRXVdf4NwGKYUu9frUrZECZglCDPkWm7Bd5XZkoifV 8QoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dgN3vGtd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id t25-20020a056a00139900b006cbab77d0easi1286845pfg.162.2023.11.20.03.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 03:14:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dgN3vGtd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 190FF807C6FF; Mon, 20 Nov 2023 03:14:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232767AbjKTLN5 (ORCPT + 99 others); Mon, 20 Nov 2023 06:13:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232711AbjKTLN4 (ORCPT ); Mon, 20 Nov 2023 06:13:56 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDE6E90; Mon, 20 Nov 2023 03:13:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700478832; x=1732014832; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=/an/gutTC3ca3FRZlF33LyscB+3U/rmMAnTwlNyxgdY=; b=dgN3vGtds25OIQ0ywsKS8L4R9oXaDElSk7ZMtZF5ZMIRVta5tlbCEPyq bQ+kGgWaIgl+NfwbvOYMs1l2R/zgvABw55qQudNzhowADzSX6DYOPg9r8 1Tif8Kv1EciPkaTuoErV/aWhPhbCp4JAQ/ESSXxx8cpzanJrex0hz+ILQ xtja9zk6NzGGJlyma19YyMBhbnZIczQqRpp+t9TQHiC7aI39Ou66TzNUp rAcm8zCQQm04qxBuMvkFohcS0TmjTyh/Mvv2/k70KokDDxMNnVRkzPfbi Fs6s472HjEQVSgxuqUc3+D/UJhZlrtibNX2a8bhA80LM+xExq987AEbjt w==; X-IronPort-AV: E=McAfee;i="6600,9927,10899"; a="458095741" X-IronPort-AV: E=Sophos;i="6.04,213,1695711600"; d="scan'208";a="458095741" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 03:13:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10899"; a="716179188" X-IronPort-AV: E=Sophos;i="6.04,213,1695711600"; d="scan'208";a="716179188" Received: from sc9itsct4906.amr.corp.intel.com (HELO localhost) ([10.249.46.107]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 03:13:49 -0800 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-kselftest@vger.kernel.org, Reinette Chatre , Shuah Khan , Shaopeng Tan , =?UTF-8?q?Maciej=20Wiecz=C3=B3r-Retman?= , Fenghua Yu Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH v2 00/26] selftests/resctrl: CAT test improvements & generalized test framework Date: Mon, 20 Nov 2023 13:13:14 +0200 Message-Id: <20231120111340.7805-1-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 20 Nov 2023 03:14:25 -0800 (PST) Hi all, Here's v2 series to improve resctrl selftests with generalized test framework and rewritten CAT test. In contrast to v1, this version does not include L2 CAT test because it needs further work. In general, I feel that v2 is in much better shape than v1 because I ended up addressing a few small things beyond what came up during v1 review. The series contains following improvements: - Excludes shareable bits from CAT test allocation to avoid interference - Replaces file "sink" with a volatile variable - Alters read pattern to defeat HW prefetcher optimizations - Rewrites CAT test to make the CAT test reliable and truly measure if CAT is working or not - Introduces generalized test framework making easier to add new tests - Lots of other cleanups & refactoring This series have been tested across a large number of systems from different generations. v2: - Postpone adding L2 CAT test as more investigations are necessary - Add patch to remove ctrlc_handler() from wrong place - Improvements to changelogs - Function comments improvements & comment cleanups - Move some parts of the changes into more logical patch - If checks: buf == NULL -> !buf - Variable naming: - p -> buf - cbm_mask_path -> cbm_path - Function naming: - get_cbm_mask() -> get_full_cbm() - cache_size() -> cache_portion_size() - Use PATH_MAX - Improved cache_portion_size() parameter names - int count -> unsigned int - Pass filename to measurement taking functions instead of resctrl_val_param - !lines ? : reversal - Removed bogus static from function local variable - Open perf fd only once, reset & enable in the innermost test loop - Add perf fd ioctl() error handling - Add patch to change compiler optimization prevention "sink" from file to volatile variable - Remove cpu_no and resource (the latter was added in v1) members from resctrl_val_param (pass uparams and test where those are needed) - Removed ARRAY_SIZE() macro - Add patch to rename "resource_id" to "domain_id" Ilpo Järvinen (26): selftests/resctrl: Don't use ctrlc_handler() outside signal handling selftests/resctrl: Split fill_buf to allow tests finer-grained control selftests/resctrl: Refactor fill_buf functions selftests/resctrl: Refactor get_cbm_mask() and rename to get_full_cbm() selftests/resctrl: Mark get_cache_size() cache_type const selftests/resctrl: Create cache_portion_size() helper selftests/resctrl: Exclude shareable bits from schemata in CAT test selftests/resctrl: Split measure_cache_vals() selftests/resctrl: Split show_cache_info() to test specific and generic parts selftests/resctrl: Remove unnecessary __u64 -> unsigned long conversion selftests/resctrl: Remove nested calls in perf event handling selftests/resctrl: Consolidate naming of perf event related things selftests/resctrl: Improve perf init selftests/resctrl: Convert perf related globals to locals selftests/resctrl: Move cat_val() to cat_test.c and rename to cat_test() selftests/resctrl: Open perf fd before start & add error handling selftests/resctrl: Replace file write with volatile variable selftests/resctrl: Read in less obvious order to defeat prefetch optimizations selftests/resctrl: Rewrite Cache Allocation Technology (CAT) test selftests/resctrl: Create struct for input parameters selftests/resctrl: Introduce generalized test framework selftests/resctrl: Pass write_schemata() resource instead of test name selftests/resctrl: Add helper to convert L2/3 to integer selftests/resctrl: Rename resource ID to domain ID selftests/resctrl: Get domain id from cache id selftests/resctrl: Add test groups and name L3 CAT test L3_CAT tools/testing/selftests/resctrl/cache.c | 274 +++++---------- tools/testing/selftests/resctrl/cat_test.c | 328 +++++++++++------- tools/testing/selftests/resctrl/cmt_test.c | 76 +++- tools/testing/selftests/resctrl/fill_buf.c | 132 ++++--- tools/testing/selftests/resctrl/mba_test.c | 26 +- tools/testing/selftests/resctrl/mbm_test.c | 28 +- tools/testing/selftests/resctrl/resctrl.h | 117 +++++-- .../testing/selftests/resctrl/resctrl_tests.c | 205 +++++------ tools/testing/selftests/resctrl/resctrl_val.c | 56 +-- tools/testing/selftests/resctrl/resctrlfs.c | 246 ++++++++----- 10 files changed, 821 insertions(+), 667 deletions(-) -- 2.30.2