Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp2311919rwp; Fri, 14 Jul 2023 04:23:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlEPUFmSAFFzG+cOXInINJPoLd9WjaqgptxmtH//AKOSFA8ynMf76Q+DnKOHpF4jNjVYoqDK X-Received: by 2002:a17:907:3da3:b0:98e:738c:6d39 with SMTP id he35-20020a1709073da300b0098e738c6d39mr2971567ejc.36.1689333826590; Fri, 14 Jul 2023 04:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689333826; cv=none; d=google.com; s=arc-20160816; b=uXXXOPW3QrIRfuCgdbaZ/kAbbf4uley3LUUhBapgTxrgHDUqw+k4VM+KmLeXRRBVR/ A5q83R/8nKBgFMl8S8P/e6q5eFcGG1QbaiNzIhzDQB9TR7ckBhdIOGLuvhH6IvLtX18E ZvEc0Lxl1pmu9KtUcY47iHQarTW1WcqZQiBH4dgdurGyz+ZQqf6L7UMiDUmBUeeqCCKh 8Vb8z5pRnA+XNl3KLTiZVrAOWm7BIM5pWdxtRDpsypPMNx4Ess0It7KU3fo7SLzvGsaW x+cW0CovQ0KMtQFJAHXIT6DTu01odkNmkMQ3Y/NkXSakuX2u9t7dzrPQfDWrMB5b6kF3 IO/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-id:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=ldirRcTEwtOQs62Mysjkcdwof6yu/Fofs/yeHHuXIEA=; fh=tlLtlqHEcDqGuk8b0er87PfjbhXHnhluxDdVqega7rc=; b=YmwbO+jhdqBJwNKU8m3GsnvT92hMLf0Ls2LN5gc0XOorV7skXl3l0aEPmWu6L/ZrOZ zXtIJIxOG+sLtongneRKdgJD32oTbFxRdRmDRtZrRlpgXuP3uuBu+KDhKWcj/wa2DKc5 0AWXYBqRlxIfWjtYGQ+PEcJo9Gqo/3QoyVZqEuRfNNkKMe67hcX4P8C3YQLo3ZZEr0Pi QkYfTbc2uZ45mypuxOmHG4U4Jh5ZyuEhSwAuLh6NAfMIyvGco5HP5Jcs9h3tTJp1aUMC 33eVCok2EEqrlT5ggEKkCbRuMKUCaFZqrN9oYhTj2TZXXS86SVXo0bVOLHEKUwLHf92o AFig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WmTsU0Um; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t7-20020a1709064f0700b009924806cd02si8652797eju.392.2023.07.14.04.23.22; Fri, 14 Jul 2023 04:23:46 -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=WmTsU0Um; 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 S236012AbjGNKdh (ORCPT + 99 others); Fri, 14 Jul 2023 06:33:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235140AbjGNKdg (ORCPT ); Fri, 14 Jul 2023 06:33:36 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3118430C6; Fri, 14 Jul 2023 03:33:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689330812; x=1720866812; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version:content-id; bh=thbBZkxQUOn7Q+OWCjpYAJ4zB0wuhOmBAj2580NuCJQ=; b=WmTsU0Um50rvHaYgIhPH0tLDQ39n8eeaIIZsoK6/huPoKM0ZoSxpoF4L fX6QWbTKnzO0WXZOVLPt9T/9R7r7VSw1bVLY+XAutkZiu5wldTeJi9zzn ZqyJ1rN/ZUxcO7d90VfNp/5MT807woObd9T0O4QrudcXCMSbYVQH9z99k QIGOwpBU0iu+o0DNGnheW24/1p8fUoWNzjBl36M0kcffE+zFiNJ+HA3IW ou4nxODNwEjlm5H2Z1LwwbWUPDXlZcVpT67kee9qSFQys0UjLevOCP61T UT/QtflxA3xTob4hS5/DfRJpDatmj041gd5cZl3c4pKEvAVG4YENUl5NS Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="429206795" X-IronPort-AV: E=Sophos;i="6.01,205,1684825200"; d="scan'208";a="429206795" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2023 03:33:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="835987464" X-IronPort-AV: E=Sophos;i="6.01,205,1684825200"; d="scan'208";a="835987464" Received: from rchauhax-mobl1.gar.corp.intel.com ([10.249.35.123]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2023 03:33:28 -0700 Date: Fri, 14 Jul 2023 13:33:25 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Reinette Chatre cc: linux-kselftest@vger.kernel.org, Shuah Khan , Shaopeng Tan , Fenghua Yu , LKML Subject: Re: [PATCH v4 09/19] selftests/resctrl: Convert span to size_t In-Reply-To: <92b3ef73-6347-b52a-69ed-c1b489b11d55@intel.com> Message-ID: <4969cf83-f070-f29-5489-1cc6a248c6a7@linux.intel.com> References: <20230713131932.133258-1-ilpo.jarvinen@linux.intel.com> <20230713131932.133258-10-ilpo.jarvinen@linux.intel.com> <92b3ef73-6347-b52a-69ed-c1b489b11d55@intel.com> MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-1953778464-1689329730=:1695" Content-ID: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1953778464-1689329730=:1695 Content-Type: text/plain; CHARSET=ISO-8859-15 Content-Transfer-Encoding: 8BIT Content-ID: <92a9314-13ff-8d2b-8649-b666807b483d@linux.intel.com> On Thu, 13 Jul 2023, Reinette Chatre wrote: > Hi Ilpo, > > On 7/13/2023 6:19 AM, Ilpo J?rvinen wrote: > > ... > > > @@ -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, > > Any idea what the purpose being run_fill_buf() is? From what I can tell it is > an unnecessary level of indirection. You already mentioned it, fill_cache() could be included into run_fill_buf() but it's not part of this series. > > 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; > > Do we now need a cast in the initialization of span? I don't see any warning w/o cast, unsigned long -> size_t seems pretty safe anyway. For internally provided values, overflow does not seem possible even if the type sizes would disagree. There's no existing error checking for the command in the case where "fill_buf" is used with -b (an orthogonal issue). -- i. --8323329-1953778464-1689329730=:1695--