Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp206672rdd; Tue, 9 Jan 2024 01:13:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFsrzp6gTCDnJ2/ekYRO98xHm+qaHD6QFz11Jf/OXkZklsqdW7g57mMxXpFIi0A5mF3DlkE X-Received: by 2002:a17:907:aa2:b0:a28:fab0:a88c with SMTP id bz2-20020a1709070aa200b00a28fab0a88cmr335486ejc.78.1704791622526; Tue, 09 Jan 2024 01:13:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704791622; cv=none; d=google.com; s=arc-20160816; b=dh6kk2pWMMoFPQqNeWEI66STSczzalr48EEBf0HQnsTf3xzGeBeO50PczNtu3VnLJT i319eGDirCkdYzjWPy6lG2DLxqllfQMPBlT6F1G2aBKaRb/kzvKfFaVJ2tr0ynBSdD4r mD2BZtqrHWDaXKJOlLOojp5WPoQ+t+z1+LnqXUeszOrsAT/0px0K7xQCzswM2NcPLyt/ I1XE8PSuijukKks7abNfK2ii7pgwcSpray1jfS3YrtNPxRmCn75H0G0+tNtVSa3teOq8 URLh7s4JMQEyHyqj9ULulizHphx7E/+SwNYljCi78L/pVn/gzTZTXNSz1ZmnIc8nxrWi UgXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=rTBbahPwOoxHY8/1xmED3g0mncXG8oEzX+rJQYG3M3A=; fh=nscwGPZx4545cchlXmUnmwfdNaDnndlCuW0KNca5EsY=; b=a+1E2Sa6n2XKl/BCGOvAdfuEDRrBFp1ru9ZJpsjrmJXsRDrvPM+sRGMsS37ibT/H+W GwL9YZ+CL4U1zn+mYY4nkJjQBxSAmGDDR5m9tQjgUnQdQqvG7+LBosW0acSlQRMlqsty 0v4k/zLu6jW14IvFXzWr7bSW00t5/86s9gJxSOmVeMNdaQ0bPNxI877uBfazqn5DeGt/ 47V27zCysH7MEdMMf+j0GJMZFAW7qTdWiHyrTqus4T3TkhsXVnCctepJqHhq8AcmfW7r BlW7bb0wfMBCNLapL50kL7QDZacu8wFx1hOjjTYApaV7hcft1no44oV3xIv0Q3jtMlMG iSCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="TxY/97xm"; spf=pass (google.com: domain of linux-kernel+bounces-20635-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20635-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h20-20020a170906261400b00a27a3bcd9d1si625978ejc.780.2024.01.09.01.13.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 01:13:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20635-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="TxY/97xm"; spf=pass (google.com: domain of linux-kernel+bounces-20635-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20635-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 188751F23A2D for ; Tue, 9 Jan 2024 09:13:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 33CD62C865; Tue, 9 Jan 2024 09:13:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TxY/97xm" 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 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-kernel@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.