Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp465525lql; Mon, 11 Mar 2024 07:57:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUU+P36gudZI+Ran5GXlwWAFtPAZ6nBGqrrISsvnPrFAGzCv1jgqhuCC1c0lBEwRvWGVFzMxdpmm2qfuOou4nX5vs3Dm/eGlhDNykGv1Q== X-Google-Smtp-Source: AGHT+IGtueSn8whn9x0v85XAZbwVHSNxn2mtI1XgaJAQrVJ4klFJGkvJskU3XDToKwdyUA1G7a8j X-Received: by 2002:a05:6a20:a11a:b0:1a3:16e1:9150 with SMTP id q26-20020a056a20a11a00b001a316e19150mr4485018pzk.15.1710169063304; Mon, 11 Mar 2024 07:57:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710169063; cv=pass; d=google.com; s=arc-20160816; b=0SevSam0a2cfbC100wvKjYdrqgIlT92lJ8atXlDNX/lLEzIcgtqGAHE5OIHJNsH5nD wuB1A2JuCM/MXRFazOqe+jzQdz749W63iQXVMVMaerIsVQBdPH65NpNoYSsBY8w7YIc2 lbvFrK+fk4Px10V2rB2RYMFFQ2Ut0vkcJpVpkE1LEw38Fi0Lou6LOALjJZpF073Q6lDE cV0jZEZCceRdLF2m5V7fD+fAy3v25F4qJfex2E0A2Mx0+Qc5zfdA3KETTzBIP4o7iBSf HKP7TQeIkw3Ze/tEhXqxDPe6SfMtUumj/0tkUkp69jdIaYJ4qEmfHRG6zAriBeRMVoFX PCtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=o4LMd/uV6LgCh2YB6BNAGYXLDz98hQIK4TdnLc76MxU=; fh=G8k5KLlKAeFR9xe9SXCzJ3g7WPs151bJx6zrec4c8hI=; b=ap22bhJP31KYKdMg6EvjKyV5XIoZF1ErHPWB+VnBNLrkEcUww4PHxBGIJLslkygkkN FywTDX6IHWjXH3Xeok7UHJtRIkPjFl9PNLfs3TaaGBtOyKYfKHocuLaM4IwAZ9r20DOE 27ewBV689o+Q0yveaT4F3j/DCSsJOiIzFmlZWIjxTQQEvi6bszem4dkE6rJMIHG3hSY3 ypmy45TlUCulea65TNSfRISq5rzQwb5lUqO6nunrmrEt64ffe4Db7GJKsXGiy3Vxly0o X4FlDkQ2J+Hc9ZlQFaL0CVhHZPT6PM4UAOmbnrwMXHR2GD2guKw5a1oikEDYqfYmYztL +Naw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=U1lCp4+z; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-98912-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98912-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l23-20020a656817000000b005dc957fe10bsi5241276pgt.701.2024.03.11.07.57.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 07:57:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98912-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=U1lCp4+z; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-98912-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98912-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F35D628586F for ; Mon, 11 Mar 2024 13:53:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 96A3E3FB8C; Mon, 11 Mar 2024 13:53:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="U1lCp4+z" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (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 252ED3FB3B; Mon, 11 Mar 2024 13:53:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710165184; cv=none; b=fiuWNDJFiOCR0XITWYV1/yIYWADM04jPCvw0KQgxtoW8QLU9BD/1p6lgcT/7zbn8LxWJ8e76FiRSxKiXHPHIpJew34de2RxWaiApt0owxWo7E+P2zz/jcmyRMM5a2106gkvD3GMDcns2g/W7KjuTj+dVNRO9yA5tNFzsvjRB/Os= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710165184; c=relaxed/simple; bh=bHwKVL1u0+Vdw8KGQFEU4SKrjknuufMsPWFSJoS9tHg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=a7RTux3YyzLKWl3D6TjaDc1n2apFP4YecbhtXel77rkW4RpQPOQcTZ2EzKDnEEpPsNO/YMR7KzM3A/ooUYpTaSafl7zG1qV8v2+ZukBLhZQ1NwpKSV8K2/KGIYn2KEzl+xGF0XmSKysQtbTSetoxtJ7XKxXdYvA2/uxsKV/9cy0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=U1lCp4+z; arc=none smtp.client-ip=198.175.65.11 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=1710165183; x=1741701183; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bHwKVL1u0+Vdw8KGQFEU4SKrjknuufMsPWFSJoS9tHg=; b=U1lCp4+zeOL6rDQ9jDoTpBLVpT0+zcYbpJc1rOBt54+1FDq/EForBGxw YDbBieWplf0ye3j7KAjWXKqx341g2J+xLum3QQYiuz6iCj/HMTe/qDewW smiEhTotz7UspwZn2s9L+Q9C+6HnP7SbCzKlGBInYYszYrYn1Ll6j7tL+ lE+M3+iab7v9x2ykuleTaV/S2uVHJmhZdj99EnYH4Tb6nZkj50cIm/o8g ZbtK5QvDUTvew2GbsYHcm40ZSWsuLbm5WzuA2nVgMj84u+93VaIS+rwdK CJQQ2FlmOiCiO/SJeKFCj0LiaMdfoW5K6XahHySLlG90NjF3uoviGAkmv A==; X-IronPort-AV: E=McAfee;i="6600,9927,11009"; a="15388715" X-IronPort-AV: E=Sophos;i="6.07,116,1708416000"; d="scan'208";a="15388715" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 06:53:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,116,1708416000"; d="scan'208";a="11166645" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.245.244.201]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 06:53:00 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-kselftest@vger.kernel.org, Reinette Chatre , Shuah Khan , Babu Moger , =?UTF-8?q?Maciej=20Wiecz=C3=B3r-Retman?= Cc: Fenghua Yu , linux-kernel@vger.kernel.org, =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH v2 01/13] selftests/resctrl: Convert get_mem_bw_imc() fd close to for loop Date: Mon, 11 Mar 2024 15:52:18 +0200 Message-Id: <20240311135230.7007-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240311135230.7007-1-ilpo.jarvinen@linux.intel.com> References: <20240311135230.7007-1-ilpo.jarvinen@linux.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=UTF-8 Content-Transfer-Encoding: 8bit The open() side handles fds in a for loop but close() is based on two fixed indexes READ and WRITE. Match the close() side with the open() side by using for loop for consistency. Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/resctrl_val.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c index 5a49f07a6c85..36139cba7be8 100644 --- a/tools/testing/selftests/resctrl/resctrl_val.c +++ b/tools/testing/selftests/resctrl/resctrl_val.c @@ -368,10 +368,9 @@ static int get_mem_bw_imc(int cpu_no, char *bw_report, float *bw_imc) writes += w->return_value.value * of_mul_write * SCALE; } - for (imc = 0; imc < imcs; imc++) { - close(imc_counters_config[imc][READ].fd); - close(imc_counters_config[imc][WRITE].fd); - } + for (imc = 0; imc < imcs; imc++) + for (j = 0; j < 2; j++) + close(imc_counters_config[imc][j].fd); if (strcmp(bw_report, "reads") == 0) { *bw_imc = reads; -- 2.39.2