Message ID | 20230418114506.46788-3-ilpo.jarvinen@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2781249vqo; Tue, 18 Apr 2023 04:50:15 -0700 (PDT) X-Google-Smtp-Source: AKy350ZXnzWEJqxZ9tPlfi6s8teja1gL9y2f/lR1rg10shz6064R6O9Ees4ferTE49q652Jt611p X-Received: by 2002:a05:6a20:4403:b0:f0:a6a0:3c0e with SMTP id ce3-20020a056a20440300b000f0a6a03c0emr2173488pzb.29.1681818615093; Tue, 18 Apr 2023 04:50:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681818615; cv=none; d=google.com; s=arc-20160816; b=XHwNXDoobIqUx5XznyGom6k1QnWdgqmc2/urw+K2CJ/mrEsIPbVB4zryS2yseQ+OyE yk1e+qgSzku295bTgr84ZvKz68nSJSTQjeojimaJFc/5sQubnjsB7DErNsQXeM0TCp4a J+0MBwA+1fq6uVbelfKcnwzm7/hyy/daE1lUBWolLjIFo4V4tHD/4hdr2EUKnEup17Tp ftok/12rruwe2/G1etJCdDjFabsiCBW+1BjrjJ+dzcsMmoSwHhthfRjkmf4i62llXHc1 qMQ964jzSWqlpelHQEzG2m/BaY2GpbgPQYnYoLvUNM+cK3iGsBFbQTr4qbZkDN7txAfq HmOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zUiTWm1zCTVDhTrgJrqIIuNPok2zL77LTwzVXwgCdEc=; b=hh71PYLkqh9veeYxgHQ8Vc+R7bY1Ip+Ol0nJmECUMKUsnTrjBJ2P+DptO/mdR6PDv7 Q5IeShB5UQ+jr9OgEZNnJkn554LSkFIZjQmD82T8cE/2K1NuE463NSW4/8MrKzh0IlF6 8Qt926d1LrHjoxFJQByNah4D5CAe1HNfpOGr4mPhkOwTXfUc92bv1aMCkgJYR6yNJ8a0 uksPvp28ualLLYp8ex9zCpBxHoNvbn81isXsHG8s9dLJF+teGkEPmlP5eel5Rl7U66QW 0bjcJBnpbjRAMqKHUqe2ohLaKUic6LFwLBaC5WG7h0gMa1V1xtOVE+r3J2JMhceHTOGU deMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Mjl366wT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i191-20020a6387c8000000b0051f3c811e2csi1499070pge.98.2023.04.18.04.50.02; Tue, 18 Apr 2023 04:50:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Mjl366wT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231526AbjDRLpi (ORCPT <rfc822;leviz.kernel.dev@gmail.com> + 99 others); Tue, 18 Apr 2023 07:45:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231398AbjDRLpf (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 18 Apr 2023 07:45:35 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 852686588; Tue, 18 Apr 2023 04:45:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681818333; x=1713354333; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GJB674v5NrvIZOn3jfZ46l+HF/VsfpsEZVPcKvhkSv8=; b=Mjl366wT9jjlusq9UztVP+XJC/5WTxjV3dZSQOe3I60eCVpb3EUa0rzr BoIEQpPg67It6DdHW/99X7rwj2JmNPEqQCfhwbkqq9iDVDCKFqkz7ASbr MANXL65AylIvlrO1Ijw5IldOZcGEe8NDDj1FECEVub1qUa462OJEowKts +qXk28pZMhT4oBKHjzw/8r8QW8lzLgIKtd7KlfxlSkWvS0VCIe7G6+F54 ur4eaTTWMjfGO75FwMsmjAsElBqhKpgRdQgcQSnl+iwRZ61VIBBDvFjC1 WhChfRjDqylCGNg/dJ8wzb0bbSGjcrqhBD+xrCXWWhDWszsDfFMPSuqFR w==; X-IronPort-AV: E=McAfee;i="6600,9927,10683"; a="346994286" X-IronPort-AV: E=Sophos;i="5.99,207,1677571200"; d="scan'208";a="346994286" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2023 04:45:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10683"; a="723601532" X-IronPort-AV: E=Sophos;i="5.99,207,1677571200"; d="scan'208";a="723601532" Received: from yvolokit-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.251.213.103]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2023 04:45:30 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com> To: linux-kselftest@vger.kernel.org, Reinette Chatre <reinette.chatre@intel.com>, Fenghua Yu <fenghua.yu@intel.com>, Shuah Khan <shuah@kernel.org>, linux-kernel@vger.kernel.org Cc: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>, =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com> Subject: [PATCH v2 02/24] selftests/resctrl: Check also too low values for CBM bits Date: Tue, 18 Apr 2023 14:44:44 +0300 Message-Id: <20230418114506.46788-3-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230418114506.46788-1-ilpo.jarvinen@linux.intel.com> References: <20230418114506.46788-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763514636248264722?= X-GMAIL-MSGID: =?utf-8?q?1763514636248264722?= |
Series |
selftests/resctrl: Fixes, cleanups, and rewritten CAT test
|
|
Commit Message
Ilpo Järvinen
April 18, 2023, 11:44 a.m. UTC
CAT test only validates that the number of CBM bits is not too large
but it could be too small too.
Check and return error before starting the CAT test if the number of
CBM bits is too small.
Fixes: 09a67934625a ("selftests/resctrl: Don't hard code value of "no_of_bits" variable")
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
tools/testing/selftests/resctrl/cat_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi Ilpo, On 4/18/2023 4:44 AM, Ilpo Järvinen wrote: > CAT test only validates that the number of CBM bits is not too large > but it could be too small too. Could you please elaborate how this scenario could occur? > Check and return error before starting the CAT test if the number of > CBM bits is too small. > > Fixes: 09a67934625a ("selftests/resctrl: Don't hard code value of "no_of_bits" variable") This fix is not clear to me. This commit being fixed already contains an explicit test that will bail out of no_of_bits <= 0. It is not clear to me why it is necessary to adding a test for < 1 as a fix for this commit. > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> > --- > tools/testing/selftests/resctrl/cat_test.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c > index fb1443f888c4..722c9cd4120d 100644 > --- a/tools/testing/selftests/resctrl/cat_test.c > +++ b/tools/testing/selftests/resctrl/cat_test.c > @@ -129,7 +129,7 @@ int cat_perf_miss_val(int cpu_no, int n, char *cache_type) > if (!n) > n = count_of_bits / 2; > > - if (n > count_of_bits - 1) { > + if (n < 1 || n > count_of_bits - 1) { > ksft_print_msg("Invalid input value for no_of_bits n!\n"); > ksft_print_msg("Please enter value in range 1 to %d\n", > count_of_bits - 1); Reinette
On Fri, 21 Apr 2023, Reinette Chatre wrote: > Hi Ilpo, > > On 4/18/2023 4:44 AM, Ilpo Järvinen wrote: > > CAT test only validates that the number of CBM bits is not too large > > but it could be too small too. > > Could you please elaborate how this scenario could occur? > > > Check and return error before starting the CAT test if the number of > > CBM bits is too small. > > > > Fixes: 09a67934625a ("selftests/resctrl: Don't hard code value of "no_of_bits" variable") > > This fix is not clear to me. This commit being fixed already contains > an explicit test that will bail out of no_of_bits <= 0. It is not clear to me > why it is necessary to adding a test for < 1 as a fix for this commit. Ah, indeed, it's checked on the higher level so this fix is unnecessary. I missed it entirely while taking this change out from a more complex change and even failed to make the connection when I stared at the very if <= 0 check not so many days ago.
diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c index fb1443f888c4..722c9cd4120d 100644 --- a/tools/testing/selftests/resctrl/cat_test.c +++ b/tools/testing/selftests/resctrl/cat_test.c @@ -129,7 +129,7 @@ int cat_perf_miss_val(int cpu_no, int n, char *cache_type) if (!n) n = count_of_bits / 2; - if (n > count_of_bits - 1) { + if (n < 1 || n > count_of_bits - 1) { ksft_print_msg("Invalid input value for no_of_bits n!\n"); ksft_print_msg("Please enter value in range 1 to %d\n", count_of_bits - 1);