From nobody Sun Feb 8 18:48:27 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 142033FB94; Mon, 11 Mar 2024 13:53:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710165202; cv=none; b=N3ULhX51EyWORImNAWTIzSZu/yYGp1osXkYVpEtEN98qFUfshKZSH7y+e4Ic+bDh9lrDzaC9e72o2UiudIonJTBtBIb3jJt3W8tRn1ZC90dVpCah2OcmJY9r9KR/R1umrLGlyTewlzIUaN3XRCl4BQpoNBmr4Oad5XCJo9rq/Rs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710165202; c=relaxed/simple; bh=rwUGKWtRQHCPDzae5+w4LWpcgWjkphzsu2B1RTrQA40=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=N2tFd7/LqVFjXfipHNjksTFzac5ag4EcUqMQHigkf8+HjJPI2Kty/y74YiTbqDlLYUlbRqwGwdYgVcrYsNXE6oZ11FuwJmdZ6dw3rlBdUjhCvDMuCpEOGKXtyBgsQ+iTN3C/0esnGR8xm9UGOMuxZoDvI2yyBpMgCXCvLb0fWgo= 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=fjNHPlqv; arc=none smtp.client-ip=198.175.65.20 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="fjNHPlqv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710165199; x=1741701199; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rwUGKWtRQHCPDzae5+w4LWpcgWjkphzsu2B1RTrQA40=; b=fjNHPlqvsQfE9LM5OYpjuCxhARAcRDZNO0SmOXpe3mOZdgMxSyRlAayv NXvqbf4ACt98YPky8XrFYN82xhztQiDAPKjkkkZUKmUk50zS9m1B/96+f jI82TMK37yqY/BD7hna7M0N5DFmnAOY7CCOuD1QFuOFbztI7u3n1+JuD1 aDxfdRNwlQ7l2UTbqgMZ7Y8GYgJWcxrl9/SEQTZXQXQ1bvfPav9xZ/WGr C2vtSJBwpukRqoAek4SA5f4B+1P/VT8HQlCErtA08QnSGzdTq90anQOQg jiGao8UPE4HnhZfDREaYGUENRrS6L2FbcaurKDGmLpaSYqWQoCzSXizsn Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11009"; a="4705179" X-IronPort-AV: E=Sophos;i="6.07,116,1708416000"; d="scan'208";a="4705179" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 06:53:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,116,1708416000"; d="scan'208";a="11247445" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.245.244.201]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 06:53:15 -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 03/13] selftests/resctrl: Consolidate get_domain_id() into resctrl_val() Date: Mon, 11 Mar 2024 15:52:20 +0200 Message-Id: <20240311135230.7007-4-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: quoted-printable Both initialize_mem_bw_resctrl() and initialize_llc_occu_resctrl() that are called from resctrl_val() need to determine domain ID to construct resctrl fs related paths. Both functions do it by taking CPU ID which neither needs for any other purpose than determining the domain ID. Consolidate determining the domain ID into resctrl_val() and pass the domain ID instead of CPU ID to initialize_mem_bw_resctrl() and initialize_llc_occu_resctrl(). Signed-off-by: Ilpo J=C3=A4rvinen --- tools/testing/selftests/resctrl/resctrl_val.c | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/= selftests/resctrl/resctrl_val.c index 4df2cd738f88..7981589f4db0 100644 --- a/tools/testing/selftests/resctrl/resctrl_val.c +++ b/tools/testing/selftests/resctrl/resctrl_val.c @@ -431,19 +431,12 @@ void set_mbm_path(const char *ctrlgrp, const char *mo= ngrp, int domain_id) * initialize_mem_bw_resctrl: Appropriately populate "mbm_total_path" * @ctrlgrp: Name of the control monitor group (con_mon grp) * @mongrp: Name of the monitor group (mon grp) - * @cpu_no: CPU number that the benchmark PID is binded to + * @domain_id: Domain ID (cache ID; for MB, L3 cache ID) * @resctrl_val: Resctrl feature (Eg: mbm, mba.. etc) */ static void initialize_mem_bw_resctrl(const char *ctrlgrp, const char *mon= grp, - int cpu_no, char *resctrl_val) + int domain_id, char *resctrl_val) { - int domain_id; - - if (get_domain_id("MB", cpu_no, &domain_id) < 0) { - ksft_print_msg("Could not get domain ID\n"); - return; - } - if (!strncmp(resctrl_val, MBM_STR, sizeof(MBM_STR))) set_mbm_path(ctrlgrp, mongrp, domain_id); =20 @@ -600,19 +593,12 @@ static void set_cmt_path(const char *ctrlgrp, const c= har *mongrp, char sock_num) * initialize_llc_occu_resctrl: Appropriately populate "llc_occup_path" * @ctrlgrp: Name of the control monitor group (con_mon grp) * @mongrp: Name of the monitor group (mon grp) - * @cpu_no: CPU number that the benchmark PID is binded to + * @domain_id: Domain ID (cache ID; for MB, L3 cache ID) * @resctrl_val: Resctrl feature (Eg: cat, cmt.. etc) */ static void initialize_llc_occu_resctrl(const char *ctrlgrp, const char *m= ongrp, - int cpu_no, char *resctrl_val) + int domain_id, char *resctrl_val) { - int domain_id; - - if (get_domain_id("L3", cpu_no, &domain_id) < 0) { - ksft_print_msg("Could not get domain ID\n"); - return; - } - if (!strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR))) set_cmt_path(ctrlgrp, mongrp, domain_id); } @@ -729,10 +715,17 @@ int resctrl_val(const struct resctrl_test *test, int ret =3D 0, pipefd[2]; char pipe_message =3D 0; union sigval value; + int domain_id; =20 if (strcmp(param->filename, "") =3D=3D 0) sprintf(param->filename, "stdio"); =20 + ret =3D get_domain_id(test->resource, uparams->cpu, &domain_id); + if (ret < 0) { + ksft_print_msg("Could not get domain ID\n"); + return ret; + } + if (!strncmp(resctrl_val, MBA_STR, sizeof(MBA_STR)) || !strncmp(resctrl_val, MBM_STR, sizeof(MBM_STR))) { ret =3D validate_bw_report_request(param->bw_report); @@ -827,10 +820,10 @@ int resctrl_val(const struct resctrl_test *test, goto out; =20 initialize_mem_bw_resctrl(param->ctrlgrp, param->mongrp, - uparams->cpu, resctrl_val); + domain_id, resctrl_val); } else if (!strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR))) initialize_llc_occu_resctrl(param->ctrlgrp, param->mongrp, - uparams->cpu, resctrl_val); + domain_id, resctrl_val); =20 /* Parent waits for child to be ready. */ close(pipefd[1]); --=20 2.39.2