From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3E0D32C64; Tue, 9 Jan 2024 09:13:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TxY/97xm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704791611; x=1736327611; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=uRc08WL/Z62WFKu9VzFTDF/ddI774vRvo3ktSDnU+38=; b=TxY/97xmPkB+ZeZDxf3Mj660KDqTkZZL2mj7ocl5zsyvBGCWTOzowL7h 1wTNKkRsOLL68RaHLV4KUek1FqnCOxZZQ86bd0eouYS6R3/8XzWUB+A9G IAk8ix1VAHhMeqbi9l9J1foQ8/LoKaSL35+MYchLcwQAhKUoF9UW6A2Ym 82hcpp4O8AA0TCiAzCe8dtcc4cMTNL5wCXEPm+P03iFx63fi4bnYfEMfO jW1HBpG0KuWjMqWl4vMY/rieuKkjdCY7LBOJFdwl8cGV/kzUNdE6grdd3 bD2qPqHTUSBZDDDIwVkx8rlzH3wUseOf1AE2wbJ5wWQGwTuAKixdB0Xs0 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10947"; a="395298030" X-IronPort-AV: E=Sophos;i="6.04,182,1695711600"; d="scan'208";a="395298030" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2024 01:13:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10947"; a="774778938" X-IronPort-AV: E=Sophos;i="6.04,182,1695711600"; d="scan'208";a="774778938" Received: from bhaddad-mobl.amr.corp.intel.com ([10.251.212.73]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2024 01:13:27 -0800 Date: Tue, 9 Jan 2024 11:13:16 +0200 (EET) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Reinette Chatre cc: Maciej Wieczor-Retman , Fenghua Yu , Shuah Khan , LKML , linux-kselftest@vger.kernel.org Subject: Re: [PATCH v2 4/4] selftests/resctrl: Add non-contiguous CBMs CAT test In-Reply-To: Message-ID: <33787043-5823-6de4-4e5c-a24a136ba541@linux.intel.com> References: <10c3afd7f62c63db31a3d4af86529144a5d7bbf9.1702392177.git.maciej.wieczor-retman@intel.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Mon, 8 Jan 2024, Reinette Chatre wrote: > Hi Maciej, > > On 12/12/2023 6:52 AM, Maciej Wieczor-Retman wrote: > > Add tests for both L2 and L3 CAT to verify the return values > > generated by writing non-contiguous CBMs don't contradict the > > reported non-contiguous support information. > > > > Use a logical XOR to confirm return value of write_schemata() and > > non-contiguous CBMs support information match. > > > > Signed-off-by: Maciej Wieczor-Retman > > --- > > Changelog v2: > > - Redo the patch message. (Ilpo) > > - Tidy up __cpuid_count calls. (Ilpo) > > - Remove redundant AND in noncont_mask calculations (Ilpo) > > - Fix bit_center offset. > > - Add newline before function return. (Ilpo) > > - Group non-contiguous tests with CAT tests. (Ilpo) > > - Use a helper for reading sparse_masks file. (Ilpo) > > - Make get_cache_level() available in other source files. (Ilpo) > > > > tools/testing/selftests/resctrl/cat_test.c | 75 +++++++++++++++++++ > > tools/testing/selftests/resctrl/resctrl.h | 3 + > > .../testing/selftests/resctrl/resctrl_tests.c | 2 + > > tools/testing/selftests/resctrl/resctrlfs.c | 2 +- > > 4 files changed, 81 insertions(+), 1 deletion(-) > > > > diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c > > index 7dc7206b3b99..ecf553a89aae 100644 > > --- a/tools/testing/selftests/resctrl/cat_test.c > > +++ b/tools/testing/selftests/resctrl/cat_test.c > > @@ -292,6 +292,65 @@ static int cat_run_test(const struct resctrl_test *test, const struct user_param > > return ret; > > } > > > > +static int noncont_cat_run_test(const struct resctrl_test *test, > > + const struct user_params *uparams) > > +{ > > + unsigned long full_cache_mask, cont_mask, noncont_mask; > > + unsigned int eax, ebx, ecx, edx, ret; > > + int level, bit_center, sparse_masks; > > + char schemata[64]; > > + > > + /* Check to compare sparse_masks content to cpuid output. */ > > "cpuid" -> "CPUID" (to note it is an instruction) > > > + sparse_masks = read_info_res_file(test->resource, "sparse_masks"); > > + if (sparse_masks < 0) > > + return sparse_masks; > > + > > + level = get_cache_level(test->resource); > > + if (level < 0) > > + return -EINVAL; > > + __cpuid_count(0x10, 4 - level, eax, ebx, ecx, edx); > > Please do not invent relationships. Please replace the "4 - level" with > specific index used that depends on particular cache. The cache level > may not even be needed, just use the resource to determine the correct > index. This is actually my fault, I suggested Maciej could use arithmetics there. > > + > > + return !ret == !sparse_masks; > > Please return negative on error. Ilpo just did a big cleanup to address this. Test failure is not same as an error. So tests should return negative for errors which prevent even running test at all, and 0/1 for test success/fail. -- i.