From nobody Mon Jun 15 12:20:22 2026 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 BC88F33A70E; Fri, 10 Apr 2026 09:34:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775813654; cv=none; b=judLi38j5mL2rnCWCfF6+ToElXkeEXre9KNjy1Dg7wkwo7EkBDima3s04kKKwH+njn+it6r9Trr2CymkNY6YMtQPv6hb2BwSA82CTQzDN2gXoF6bVgzd6quoqpUCRxbqIPlx8TByJa6wxjBeNHpj/VHQmJlhJsHo6xGHac4LT/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775813654; c=relaxed/simple; bh=PazdHqLl9tsE/Qdx3VJSTwchfa6Y+GCXHdx7bJuITvM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=knnjqxFnWWqKIhUC33OsnULB0l3jDrTSuQHZv7lFTXFanRWj8a2lOj5TgZ+zaHaYXXs2hJ8pMqLnoGTIIsOzRjOYKWu+oIrDmIGBzZV3FpGdoYP0WAegS076CdNvrZ8wVAnVbcJsAHPryfk6GCBF1oY5uk/xVqL4uEJ+K1A6/B8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=jocgOYpj; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=jocgOYpj; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="jocgOYpj"; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="jocgOYpj" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=8IjqAoeDdVagfBLkiypNJEraYHsPPairzevdGS/Cfvo=; b=jocgOYpjemc0kB90wXgea0j6u3rV4DidOaE9dm94KqDfLxUQgid6UC5yUbdFDq9cc2JK7hN4N qyqOBIHRaQ6Guv7TgHA6IUOBBNRySSlz8t2SZBALwBT06CwmjA7JfSjTu/5jVUAqSb2YYV3dIQd HVRTjaEbXy/OyJS3K1mSgBQ= Received: from canpmsgout05.his.huawei.com (unknown [172.19.92.145]) by szxga01-in.huawei.com (SkyGuard) with ESMTPS id 4fsWnk5Ffvz1BG7B; Fri, 10 Apr 2026 17:33:30 +0800 (CST) dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=8IjqAoeDdVagfBLkiypNJEraYHsPPairzevdGS/Cfvo=; b=jocgOYpjemc0kB90wXgea0j6u3rV4DidOaE9dm94KqDfLxUQgid6UC5yUbdFDq9cc2JK7hN4N qyqOBIHRaQ6Guv7TgHA6IUOBBNRySSlz8t2SZBALwBT06CwmjA7JfSjTu/5jVUAqSb2YYV3dIQd HVRTjaEbXy/OyJS3K1mSgBQ= Received: from mail.maildlp.com (unknown [172.19.163.0]) by canpmsgout05.his.huawei.com (SkyGuard) with ESMTPS id 4fsWfs4W5Jz12LCq; Fri, 10 Apr 2026 17:27:33 +0800 (CST) Received: from kwepemk500005.china.huawei.com (unknown [7.202.194.90]) by mail.maildlp.com (Postfix) with ESMTPS id 7329940561; Fri, 10 Apr 2026 17:33:54 +0800 (CST) Received: from huawei.com (10.50.163.32) by kwepemk500005.china.huawei.com (7.202.194.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 10 Apr 2026 17:33:53 +0800 From: Yifan Wu To: , , , , , , , , , , , , , , , CC: , , , , , Subject: [PATCH v2 1/6] selftests/resctrl: Introduced linked list management for IMC counters Date: Fri, 10 Apr 2026 17:33:47 +0800 Message-ID: <20260410093352.3988125-2-wuyifan50@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260410093352.3988125-1-wuyifan50@huawei.com> References: <20260410093352.3988125-1-wuyifan50@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems500001.china.huawei.com (7.221.188.70) To kwepemk500005.china.huawei.com (7.202.194.90) Content-Type: text/plain; charset="utf-8" Added linked list based management for IMC counter configurations, allowing the system to dynamically allocate and clean up resources based on actual hardware capabilities. Signed-off-by: Yifan Wu --- tools/testing/selftests/resctrl/mba_test.c | 1 + tools/testing/selftests/resctrl/mbm_test.c | 1 + tools/testing/selftests/resctrl/resctrl.h | 2 ++ tools/testing/selftests/resctrl/resctrl_val.c | 20 +++++++++++++++++++ 4 files changed, 24 insertions(+) diff --git a/tools/testing/selftests/resctrl/mba_test.c b/tools/testing/sel= ftests/resctrl/mba_test.c index 39cee9898359..4bb1a82eb195 100644 --- a/tools/testing/selftests/resctrl/mba_test.c +++ b/tools/testing/selftests/resctrl/mba_test.c @@ -166,6 +166,7 @@ static int check_results(void) =20 static void mba_test_cleanup(void) { + cleanup_read_mem_bw_imc(); remove(RESULT_FILE_NAME); } =20 diff --git a/tools/testing/selftests/resctrl/mbm_test.c b/tools/testing/sel= ftests/resctrl/mbm_test.c index 6dbbc3b76003..68c89f50a34a 100644 --- a/tools/testing/selftests/resctrl/mbm_test.c +++ b/tools/testing/selftests/resctrl/mbm_test.c @@ -125,6 +125,7 @@ static int mbm_measure(const struct user_params *uparam= s, =20 static void mbm_test_cleanup(void) { + cleanup_read_mem_bw_imc(); remove(RESULT_FILE_NAME); } =20 diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/self= tests/resctrl/resctrl.h index 175101022bf3..a7556cdae0de 100644 --- a/tools/testing/selftests/resctrl/resctrl.h +++ b/tools/testing/selftests/resctrl/resctrl.h @@ -24,6 +24,7 @@ #include #include #include +#include #include "kselftest.h" =20 #define MB (1024 * 1024) @@ -183,6 +184,7 @@ void mem_flush(unsigned char *buf, size_t buf_size); void fill_cache_read(unsigned char *buf, size_t buf_size, bool once); ssize_t get_fill_buf_size(int cpu_no, const char *cache_type); int initialize_read_mem_bw_imc(void); +void cleanup_read_mem_bw_imc(void); int measure_read_mem_bw(const struct user_params *uparams, struct resctrl_val_param *param, pid_t bm_pid); void initialize_mem_bw_resctrl(const struct resctrl_val_param *param, diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/= selftests/resctrl/resctrl_val.c index f20d2194c35f..d9ae24e9d971 100644 --- a/tools/testing/selftests/resctrl/resctrl_val.c +++ b/tools/testing/selftests/resctrl/resctrl_val.c @@ -28,6 +28,7 @@ struct membw_read_format { }; =20 struct imc_counter_config { + struct list_head entry; __u32 type; __u64 event; __u64 umask; @@ -38,6 +39,7 @@ struct imc_counter_config { static char mbm_total_path[1024]; static int imcs; static struct imc_counter_config imc_counters_config[MAX_IMCS]; +LIST_HEAD(imc_counters_list); static const struct resctrl_test *current_test; =20 static void read_mem_bw_initialize_perf_event_attr(int i) @@ -113,6 +115,7 @@ static int parse_imc_read_bw_events(char *imc_dir, unsi= gned int type, unsigned int *count) { char imc_events_dir[PATH_MAX], imc_counter_cfg[PATH_MAX]; + struct imc_counter_config *imc_counter; unsigned int orig_count =3D *count; char cas_count_cfg[1024]; struct dirent *ep; @@ -167,11 +170,17 @@ static int parse_imc_read_bw_events(char *imc_dir, un= signed int type, ksft_print_msg("Maximum iMC count exceeded\n"); goto out_close; } + imc_counter =3D calloc(1, sizeof(*imc_counter)); + if (!imc_counter) { + ksft_perror("Unable to allocate memory for iMC counters\n"); + goto out_close; + } =20 imc_counters_config[*count].type =3D type; get_read_event_and_umask(cas_count_cfg, *count); /* Do not fail after incrementing *count. */ *count +=3D 1; + list_add(&imc_counter->entry, &imc_counters_list); } if (*count =3D=3D orig_count) { ksft_print_msg("Unable to find events in %s\n", imc_events_dir); @@ -303,6 +312,17 @@ int initialize_read_mem_bw_imc(void) return 0; } =20 +void cleanup_read_mem_bw_imc(void) +{ + struct imc_counter_config *imc_counter, *tmp; + + list_for_each_entry_safe(imc_counter, tmp, + &imc_counters_list, entry) { + list_del(&imc_counter->entry); + free(imc_counter); + } +} + static void perf_close_imc_read_mem_bw(void) { int mc; --=20 2.43.0 From nobody Mon Jun 15 12:20:22 2026 Received: from canpmsgout02.his.huawei.com (canpmsgout02.his.huawei.com [113.46.200.217]) (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 56B1D33D6DD; Fri, 10 Apr 2026 09:33:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.217 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775813640; cv=none; b=rtEEQezTT0E61jft6hUJWwI+Q26TMBEQHiAOkGZZXLoH4Mc8LnzMlKrVGwBozYIPTWOUtmFr8eEnqFdXPFfQQk59s4O2W2shKbkMX3c9E+bs1zfm+A2Ya0IX/Tlr91329e6GSIpNTCwylBjoF1W32oxlyLvEmXZHWQlgLLQmtPk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775813640; c=relaxed/simple; bh=s9zgobcm2CHtlcIS+kopSWTxykc6RfmLS0EoYUXCWqQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pqq4XBTVhhzZYf1s1g4F1/OOxY5SC4jPAwcE+dy4zcw9l+lfi/6LA2qm3/oNt4IL1B4nx8RFeUb7zBvudgnQj2ste3UGXQM3d9fDdbfVX32hIszyAdQ/ABtt5kBoT827oUN+I7gJEYWJX8X1uZHdzTMFNwNLCHyMwXeoPaUp2SM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=Bs1GDTfr; arc=none smtp.client-ip=113.46.200.217 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="Bs1GDTfr" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=KjF6DB/OqPjtMxMksRwOz4b3e0pFo875sZuK+jxuacc=; b=Bs1GDTfrACuTuJ3/3Xk1eb4VOE1cKD93VnXfa+KkGIwLnWHFu5xs+OKXUDqPA/dRrJqy388C/ /XtVhN94MxJBHILBJKr1Ffm8+GmpgzQZXhvRfPxqwpVkBenM18BpHguyaIlLcnjwJgC5ompU+jE KQna3PQ9SctNOx+D9iODqUw= Received: from mail.maildlp.com (unknown [172.19.162.140]) by canpmsgout02.his.huawei.com (SkyGuard) with ESMTPS id 4fsWft1J2Yzcb19; Fri, 10 Apr 2026 17:27:34 +0800 (CST) Received: from kwepemk500005.china.huawei.com (unknown [7.202.194.90]) by mail.maildlp.com (Postfix) with ESMTPS id 2B6EC203C8; Fri, 10 Apr 2026 17:33:55 +0800 (CST) Received: from huawei.com (10.50.163.32) by kwepemk500005.china.huawei.com (7.202.194.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 10 Apr 2026 17:33:54 +0800 From: Yifan Wu To: , , , , , , , , , , , , , , , CC: , , , , , Subject: [PATCH v2 2/6] selftests/resctrl: Refactor the discovery of IMC counters using linked list Date: Fri, 10 Apr 2026 17:33:48 +0800 Message-ID: <20260410093352.3988125-3-wuyifan50@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260410093352.3988125-1-wuyifan50@huawei.com> References: <20260410093352.3988125-1-wuyifan50@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems500001.china.huawei.com (7.221.188.70) To kwepemk500005.china.huawei.com (7.202.194.90) Content-Type: text/plain; charset="utf-8" Use linked list to refactor the discovery of IMC counters. The counting during the discovery and the check on the upper limit of the number of IMC counters are removed. Signed-off-by: Yifan Wu --- tools/testing/selftests/resctrl/resctrl_val.c | 35 ++++++++----------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/= selftests/resctrl/resctrl_val.c index d9ae24e9d971..60cda2214c13 100644 --- a/tools/testing/selftests/resctrl/resctrl_val.c +++ b/tools/testing/selftests/resctrl/resctrl_val.c @@ -75,7 +75,7 @@ static void read_mem_bw_ioctl_perf_event_ioc_disable(int = i) * @cas_count_cfg: Config * @count: iMC number */ -static void get_read_event_and_umask(char *cas_count_cfg, unsigned int cou= nt) +static void get_read_event_and_umask(char *cas_count_cfg, struct imc_count= er_config *imc_counter) { char *token[MAX_TOKENS]; int i =3D 0; @@ -89,9 +89,9 @@ static void get_read_event_and_umask(char *cas_count_cfg,= unsigned int count) if (!token[i]) break; if (strcmp(token[i], "event") =3D=3D 0) - imc_counters_config[count].event =3D strtol(token[i + 1], NULL, 16); + imc_counter->event =3D strtol(token[i + 1], NULL, 16); if (strcmp(token[i], "umask") =3D=3D 0) - imc_counters_config[count].umask =3D strtol(token[i + 1], NULL, 16); + imc_counter->umask =3D strtol(token[i + 1], NULL, 16); } } =20 @@ -111,12 +111,11 @@ static int open_perf_read_event(int i, int cpu_no) return 0; } =20 -static int parse_imc_read_bw_events(char *imc_dir, unsigned int type, - unsigned int *count) +static int parse_imc_read_bw_events(char *imc_dir, unsigned int type) { char imc_events_dir[PATH_MAX], imc_counter_cfg[PATH_MAX]; struct imc_counter_config *imc_counter; - unsigned int orig_count =3D *count; + bool found_event =3D false; char cas_count_cfg[1024]; struct dirent *ep; int path_len; @@ -166,23 +165,18 @@ static int parse_imc_read_bw_events(char *imc_dir, un= signed int type, ksft_perror("Could not get iMC cas count read"); goto out_close; } - if (*count >=3D MAX_IMCS) { - ksft_print_msg("Maximum iMC count exceeded\n"); - goto out_close; - } imc_counter =3D calloc(1, sizeof(*imc_counter)); if (!imc_counter) { ksft_perror("Unable to allocate memory for iMC counters\n"); goto out_close; } =20 - imc_counters_config[*count].type =3D type; - get_read_event_and_umask(cas_count_cfg, *count); - /* Do not fail after incrementing *count. */ - *count +=3D 1; + imc_counter->type =3D type; + get_read_event_and_umask(cas_count_cfg, imc_counter); list_add(&imc_counter->entry, &imc_counters_list); + found_event =3D true; } - if (*count =3D=3D orig_count) { + if (!found_event) { ksft_print_msg("Unable to find events in %s\n", imc_events_dir); goto out_close; } @@ -193,7 +187,7 @@ static int parse_imc_read_bw_events(char *imc_dir, unsi= gned int type, } =20 /* Get type and config of an iMC counter's read event. */ -static int read_from_imc_dir(char *imc_dir, unsigned int *count) +static int read_from_imc_dir(char *imc_dir) { char imc_counter_type[PATH_MAX]; unsigned int type; @@ -221,7 +215,7 @@ static int read_from_imc_dir(char *imc_dir, unsigned in= t *count) ksft_perror("Could not get iMC type"); return -1; } - ret =3D parse_imc_read_bw_events(imc_dir, type, count); + ret =3D parse_imc_read_bw_events(imc_dir, type); if (ret) { ksft_print_msg("Unable to parse bandwidth event and umask\n"); return ret; @@ -245,7 +239,6 @@ static int read_from_imc_dir(char *imc_dir, unsigned in= t *count) static int num_of_imcs(void) { char imc_dir[512], *temp; - unsigned int count =3D 0; struct dirent *ep; int ret; DIR *dp; @@ -274,7 +267,7 @@ static int num_of_imcs(void) if (temp[0] >=3D '0' && temp[0] <=3D '9') { sprintf(imc_dir, "%s/%s/", DYN_PMU_PATH, ep->d_name); - ret =3D read_from_imc_dir(imc_dir, &count); + ret =3D read_from_imc_dir(imc_dir); if (ret) { closedir(dp); =20 @@ -283,7 +276,7 @@ static int num_of_imcs(void) } } closedir(dp); - if (count =3D=3D 0) { + if (list_empty(&imc_counters_list)) { ksft_print_msg("Unable to find iMC counters\n"); =20 return -1; @@ -294,7 +287,7 @@ static int num_of_imcs(void) return -1; } =20 - return count; + return 0; } =20 int initialize_read_mem_bw_imc(void) --=20 2.43.0 From nobody Mon Jun 15 12:20:22 2026 Received: from canpmsgout10.his.huawei.com (canpmsgout10.his.huawei.com [113.46.200.225]) (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 96CB936EA8C; Fri, 10 Apr 2026 09:34:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.225 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775813645; cv=none; b=RpE8wZGbwpUXhWHUwSvEMLM/deDKQ1MhhDHavihzfa9bkpDDySvqR64dI1kJgRhFoNYnjXJREiHC3j6QWg1dOx9OqKFEoUBWqwfPll7x2eVEncDyx1TTuCaUM/duxTqS3o8gFIqoDczd5HyEAQbM2Eij1qJBXmMlJLW7N1o4Djk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775813645; c=relaxed/simple; bh=YciSoPP78WvNT4rqA89UMwvhjBbTCvVJm04GjsbQ+IU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TKm4gbbyrvDhDMzVx6b0bF+n3Y3/H218usHRMoF4lIJnIca9Zxzj1I0XmTSKgJpJ2YpEOduLn13j+Nqw3pr++AYSVCOP6mOMQe7+x5ldaZrWi7H8Z9noLb6v9c2sDZSe2MLptCP2J6eRotHvwcGigEpYCsdKWCn+CQWc2KpsELY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=TH+XxIR0; arc=none smtp.client-ip=113.46.200.225 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="TH+XxIR0" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=ASxunNUXGSJJZD348DA2S3TTm5bdoy8jwQBI6RlCbrQ=; b=TH+XxIR0Dd+KSV7xDZAHZ7tE1N3RKF41oSg8ounYclJ2kN/4kopzACd7U9atyEdqEWt49p+4W W4bngGoD0FExSNqcXTYv/jhmCzFO4pzbg6SgZGFj/AH4l57jj0m08rNAi2LMRtKnBE3nnGbcteM n5CfrsporjQYQ2UHbCOcfSU= Received: from mail.maildlp.com (unknown [172.19.163.163]) by canpmsgout10.his.huawei.com (SkyGuard) with ESMTPS id 4fsWg26FWfz1K99S; Fri, 10 Apr 2026 17:27:42 +0800 (CST) Received: from kwepemk500005.china.huawei.com (unknown [7.202.194.90]) by mail.maildlp.com (Postfix) with ESMTPS id DEAE74056E; Fri, 10 Apr 2026 17:33:55 +0800 (CST) Received: from huawei.com (10.50.163.32) by kwepemk500005.china.huawei.com (7.202.194.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 10 Apr 2026 17:33:55 +0800 From: Yifan Wu To: , , , , , , , , , , , , , , , CC: , , , , , Subject: [PATCH v2 3/6] selftests/resctrl: Refactor the initialization of IMC's perf_event_attr using linked list Date: Fri, 10 Apr 2026 17:33:49 +0800 Message-ID: <20260410093352.3988125-4-wuyifan50@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260410093352.3988125-1-wuyifan50@huawei.com> References: <20260410093352.3988125-1-wuyifan50@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems500001.china.huawei.com (7.221.188.70) To kwepemk500005.china.huawei.com (7.202.194.90) Content-Type: text/plain; charset="utf-8" The initialization of perf_event_attr in iMC is refactord using linked list. Removed the initialization of the global variable imcs. Signed-off-by: Yifan Wu --- tools/testing/selftests/resctrl/resctrl_val.c | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/= selftests/resctrl/resctrl_val.c index 60cda2214c13..ce675d349a6e 100644 --- a/tools/testing/selftests/resctrl/resctrl_val.c +++ b/tools/testing/selftests/resctrl/resctrl_val.c @@ -42,20 +42,18 @@ static struct imc_counter_config imc_counters_config[MA= X_IMCS]; LIST_HEAD(imc_counters_list); static const struct resctrl_test *current_test; =20 -static void read_mem_bw_initialize_perf_event_attr(int i) +static void read_mem_bw_initialize_perf_event_attr(struct imc_counter_conf= ig *imc_counter) { - memset(&imc_counters_config[i].pe, 0, - sizeof(struct perf_event_attr)); - imc_counters_config[i].pe.type =3D imc_counters_config[i].type; - imc_counters_config[i].pe.size =3D sizeof(struct perf_event_attr); - imc_counters_config[i].pe.disabled =3D 1; - imc_counters_config[i].pe.inherit =3D 1; - imc_counters_config[i].pe.exclude_guest =3D 0; - imc_counters_config[i].pe.config =3D - imc_counters_config[i].umask << 8 | - imc_counters_config[i].event; - imc_counters_config[i].pe.sample_type =3D PERF_SAMPLE_IDENTIFIER; - imc_counters_config[i].pe.read_format =3D + imc_counter->pe.type =3D imc_counter->type; + imc_counter->pe.size =3D sizeof(struct perf_event_attr); + imc_counter->pe.disabled =3D 1; + imc_counter->pe.inherit =3D 1; + imc_counter->pe.exclude_guest =3D 0; + imc_counter->pe.config =3D + imc_counter->umask << 8 | + imc_counter->event; + imc_counter->pe.sample_type =3D PERF_SAMPLE_IDENTIFIER; + imc_counter->pe.read_format =3D PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_TOTAL_TIME_RUNNING; } =20 @@ -292,15 +290,17 @@ static int num_of_imcs(void) =20 int initialize_read_mem_bw_imc(void) { - int imc; + struct imc_counter_config *imc_counter; + int ret; =20 - imcs =3D num_of_imcs(); - if (imcs <=3D 0) - return imcs; + ret =3D num_of_imcs(); + if (ret < 0) + return ret; =20 /* Initialize perf_event_attr structures for all iMC's */ - for (imc =3D 0; imc < imcs; imc++) - read_mem_bw_initialize_perf_event_attr(imc); + list_for_each_entry(imc_counter, &imc_counters_list, entry) { + read_mem_bw_initialize_perf_event_attr(imc_counter); + } =20 return 0; } --=20 2.43.0 From nobody Mon Jun 15 12:20:22 2026 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 8A8093B3BF7; Fri, 10 Apr 2026 09:34:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775813655; cv=none; b=H23a1ZQUY7VF7fjXx7fIrIcxBY01BzdBZktcZ+0J89UUyRYGNzYFQ4g70qC+ICm6w1uLCbPkn4KIe0b3UATnNKNzFPEn7uDCU5vgPM0hGQ61+CItt5UWXxL3FH2JkIUesa3rH9j9DKEqxFXN5/ynnECK/pg76PqMUffRzImE4n4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775813655; c=relaxed/simple; bh=RIQj6fOsTEvGroBILPBQfDhdToainaT8wL6PCqlHCPA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SgipaVZzhJDuWNkcQcF4jmGzBwei928sFd5NrJd3EP9ebgNS4jelxLqYAckgIuNBFaQdPDO9z1kxg0Y4Pvdu1Czip4AhIwx2CYv5nlQs1w/CRkdGT1QfCphEY+tO2BTUHZ7Vd0/LpShoHnxHyq8mlpnoHzhRXVHc3UOUJD039Rw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=2kQJBhYc; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=2kQJBhYc; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="2kQJBhYc"; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="2kQJBhYc" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=DLLBswuP5vM3z5lAacgS6ua4SOqTqK53UTCgIoBMBEo=; b=2kQJBhYcCAUSFJz0qMblYLUswiA7EtkYi9er+gxjSkCI4+1m7fgnghStdHTgKu2J5O97d3vLL gTnndwLN2qiMWG0MMXQMoYIhmENHG7WdZC1ujaSHxmzysk515XJCCtYycbqk5g59ZdwQj6Rm4kK zFJM235wAHiQz7pl8ymnHGc= Received: from canpmsgout04.his.huawei.com (unknown [172.19.92.133]) by szxga01-in.huawei.com (SkyGuard) with ESMTPS id 4fsWnm50wKz1BG7B; Fri, 10 Apr 2026 17:33:32 +0800 (CST) dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=DLLBswuP5vM3z5lAacgS6ua4SOqTqK53UTCgIoBMBEo=; b=2kQJBhYcCAUSFJz0qMblYLUswiA7EtkYi9er+gxjSkCI4+1m7fgnghStdHTgKu2J5O97d3vLL gTnndwLN2qiMWG0MMXQMoYIhmENHG7WdZC1ujaSHxmzysk515XJCCtYycbqk5g59ZdwQj6Rm4kK zFJM235wAHiQz7pl8ymnHGc= Received: from mail.maildlp.com (unknown [172.19.162.223]) by canpmsgout04.his.huawei.com (SkyGuard) with ESMTPS id 4fsWfy4J6Pz1prKv; Fri, 10 Apr 2026 17:27:38 +0800 (CST) Received: from kwepemk500005.china.huawei.com (unknown [7.202.194.90]) by mail.maildlp.com (Postfix) with ESMTPS id A8FC440571; Fri, 10 Apr 2026 17:33:56 +0800 (CST) Received: from huawei.com (10.50.163.32) by kwepemk500005.china.huawei.com (7.202.194.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 10 Apr 2026 17:33:55 +0800 From: Yifan Wu To: , , , , , , , , , , , , , , , CC: , , , , , Subject: [PATCH v2 4/6] selftests/resctrl: Refactor perf event open/close using linked list Date: Fri, 10 Apr 2026 17:33:50 +0800 Message-ID: <20260410093352.3988125-5-wuyifan50@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260410093352.3988125-1-wuyifan50@huawei.com> References: <20260410093352.3988125-1-wuyifan50@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems500001.china.huawei.com (7.221.188.70) To kwepemk500005.china.huawei.com (7.202.194.90) Content-Type: text/plain; charset="utf-8" Using linked list when open/close perf event. Signed-off-by: Yifan Wu --- tools/testing/selftests/resctrl/resctrl_val.c | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/= selftests/resctrl/resctrl_val.c index ce675d349a6e..ce5f96d5457c 100644 --- a/tools/testing/selftests/resctrl/resctrl_val.c +++ b/tools/testing/selftests/resctrl/resctrl_val.c @@ -93,15 +93,15 @@ static void get_read_event_and_umask(char *cas_count_cf= g, struct imc_counter_con } } =20 -static int open_perf_read_event(int i, int cpu_no) +static int open_perf_read_event(int cpu_no, struct imc_counter_config *imc= _counter) { - imc_counters_config[i].fd =3D - perf_event_open(&imc_counters_config[i].pe, -1, cpu_no, -1, + imc_counter->fd =3D + perf_event_open(&imc_counter->pe, -1, cpu_no, -1, PERF_FLAG_FD_CLOEXEC); =20 - if (imc_counters_config[i].fd =3D=3D -1) { + if (imc_counter->fd =3D=3D -1) { fprintf(stderr, "Error opening leader %llx\n", - imc_counters_config[i].pe.config); + imc_counter->pe.config); =20 return -1; } @@ -318,11 +318,11 @@ void cleanup_read_mem_bw_imc(void) =20 static void perf_close_imc_read_mem_bw(void) { - int mc; + struct imc_counter_config *imc_counter; =20 - for (mc =3D 0; mc < imcs; mc++) { - if (imc_counters_config[mc].fd !=3D -1) - close(imc_counters_config[mc].fd); + list_for_each_entry(imc_counter, &imc_counters_list, entry) { + if (imc_counter->fd !=3D -1) + close(imc_counter->fd); } } =20 @@ -334,13 +334,14 @@ static void perf_close_imc_read_mem_bw(void) */ static int perf_open_imc_read_mem_bw(int cpu_no) { - int imc, ret; + struct imc_counter_config *imc_counter; + int ret; =20 - for (imc =3D 0; imc < imcs; imc++) - imc_counters_config[imc].fd =3D -1; + list_for_each_entry(imc_counter, &imc_counters_list, entry) + imc_counter->fd =3D -1; =20 - for (imc =3D 0; imc < imcs; imc++) { - ret =3D open_perf_read_event(imc, cpu_no); + list_for_each_entry(imc_counter, &imc_counters_list, entry) { + ret =3D open_perf_read_event(cpu_no, imc_counter); if (ret) goto close_fds; } --=20 2.43.0 From nobody Mon Jun 15 12:20:22 2026 Received: from canpmsgout02.his.huawei.com (canpmsgout02.his.huawei.com [113.46.200.217]) (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 26E6734321A; Fri, 10 Apr 2026 09:33:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.217 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775813641; cv=none; b=sc3buEN6B83IJTTf89ZIhDCBgbmsA3L9l+gB9e/4QdUdpfkFvPS8+6LPFz6msiiYWn0mN1Eufosmwu7WbK6+qEfnUGggpuBbDif4pv+246+9x/UC0QpQkSmrbY5iamaYnem3lD2uIOzXXU/mFtSvWK9b6z/vEprHt/jCX65ebCg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775813641; c=relaxed/simple; bh=wS89Gmr/rThfl6ZdgnOObPR7nag9iM0T4MnaA4sIReA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kI97jKHowQVX0LWZuPm+Ai7YHExitDCxCSiuiQCMaXLA3e4mij+Ep3swadY1MNDWmAYRrwJx3OLZGx/G0lb2H7RSDulpgC5fJWXfG7kzyPFwuEI9oD81BH1qqejhrwlSn9LIgpCVxQOuibW6YENadMJ3AG/QIBCcpDwpVzTXEQc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=i55Kip2z; arc=none smtp.client-ip=113.46.200.217 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="i55Kip2z" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=Un6/5hQDB4O/MEu6q894jg317PijwDr803+Azh9z1Jg=; b=i55Kip2zCvSkxi/dx8mmEUh3mlwyX/Z9rqtPkjLLA+cHvkcvtVguhivXOMcR5QNy9eaYBR6HU bBEzuj6Mi9DYEnw+ol+ckj7uYIEX4BKlqm1+SdmEIzFsYGyILcEHzZ8ZwrRpq3LDZhIjof2/qIN zO/WKxNMtcmialiVAmfX5tA= Received: from mail.maildlp.com (unknown [172.19.163.104]) by canpmsgout02.his.huawei.com (SkyGuard) with ESMTPS id 4fsWfw3JNczcb16; Fri, 10 Apr 2026 17:27:36 +0800 (CST) Received: from kwepemk500005.china.huawei.com (unknown [7.202.194.90]) by mail.maildlp.com (Postfix) with ESMTPS id 6DA0C4048F; Fri, 10 Apr 2026 17:33:57 +0800 (CST) Received: from huawei.com (10.50.163.32) by kwepemk500005.china.huawei.com (7.202.194.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 10 Apr 2026 17:33:56 +0800 From: Yifan Wu To: , , , , , , , , , , , , , , , CC: , , , , , Subject: [PATCH v2 5/6] selftests/resctrl: Refactor reading from IMC using linked list Date: Fri, 10 Apr 2026 17:33:51 +0800 Message-ID: <20260410093352.3988125-6-wuyifan50@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260410093352.3988125-1-wuyifan50@huawei.com> References: <20260410093352.3988125-1-wuyifan50@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems500001.china.huawei.com (7.221.188.70) To kwepemk500005.china.huawei.com (7.202.194.90) Content-Type: text/plain; charset="utf-8" Read the memory bandwidth from the IMC using linked list. Signed-off-by: Yifan Wu --- tools/testing/selftests/resctrl/resctrl_val.c | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/= selftests/resctrl/resctrl_val.c index ce5f96d5457c..65ae93205b38 100644 --- a/tools/testing/selftests/resctrl/resctrl_val.c +++ b/tools/testing/selftests/resctrl/resctrl_val.c @@ -57,15 +57,15 @@ static void read_mem_bw_initialize_perf_event_attr(stru= ct imc_counter_config *im PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_TOTAL_TIME_RUNNING; } =20 -static void read_mem_bw_ioctl_perf_event_ioc_reset_enable(int i) +static void read_mem_bw_ioctl_perf_event_ioc_reset_enable(struct imc_count= er_config *imc_counter) { - ioctl(imc_counters_config[i].fd, PERF_EVENT_IOC_RESET, 0); - ioctl(imc_counters_config[i].fd, PERF_EVENT_IOC_ENABLE, 0); + ioctl(imc_counter->fd, PERF_EVENT_IOC_RESET, 0); + ioctl(imc_counter->fd, PERF_EVENT_IOC_ENABLE, 0); } =20 -static void read_mem_bw_ioctl_perf_event_ioc_disable(int i) +static void read_mem_bw_ioctl_perf_event_ioc_disable(struct imc_counter_co= nfig *imc_counter) { - ioctl(imc_counters_config[i].fd, PERF_EVENT_IOC_DISABLE, 0); + ioctl(imc_counter->fd, PERF_EVENT_IOC_DISABLE, 0); } =20 /* @@ -361,16 +361,16 @@ static int perf_open_imc_read_mem_bw(int cpu_no) */ static void do_imc_read_mem_bw_test(void) { - int imc; + struct imc_counter_config *imc_counter; =20 - for (imc =3D 0; imc < imcs; imc++) - read_mem_bw_ioctl_perf_event_ioc_reset_enable(imc); + list_for_each_entry(imc_counter, &imc_counters_list, entry) + read_mem_bw_ioctl_perf_event_ioc_reset_enable(imc_counter); =20 sleep(1); =20 /* Stop counters after a second to get results. */ - for (imc =3D 0; imc < imcs; imc++) - read_mem_bw_ioctl_perf_event_ioc_disable(imc); + list_for_each_entry(imc_counter, &imc_counters_list, entry) + read_mem_bw_ioctl_perf_event_ioc_disable(imc_counter); } =20 /* @@ -385,17 +385,15 @@ static void do_imc_read_mem_bw_test(void) static int get_read_mem_bw_imc(float *bw_imc) { float reads =3D 0, of_mul_read =3D 1; - int imc; + struct imc_counter_config *r; =20 /* * Log read event values from all iMC counters into * struct imc_counter_config. * Take overflow into consideration before calculating total bandwidth. */ - for (imc =3D 0; imc < imcs; imc++) { + list_for_each_entry(r, &imc_counters_list, entry) { struct membw_read_format measurement; - struct imc_counter_config *r =3D - &imc_counters_config[imc]; =20 if (read(r->fd, &measurement, sizeof(measurement)) =3D=3D -1) { ksft_perror("Couldn't get read bandwidth through iMC"); --=20 2.43.0 From nobody Mon Jun 15 12:20:22 2026 Received: from canpmsgout10.his.huawei.com (canpmsgout10.his.huawei.com [113.46.200.225]) (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 40EA136F42B; Fri, 10 Apr 2026 09:34:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.225 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775813647; cv=none; b=W99pqVJrCEok/b0R/zPVgo1NjEsGw0Z86xVGHu15WxfWlR3D+dsw+VhaijSORrN27LDIYs0T6wlbizTMEoxTyssDtH/ZKEmlnZuqYtx/CNtRorQUgjzt2SXy/BYFfle4i9hQkI9+BRAGuowtIXAvvcJVJavpJNxcG6gZZF4eD5U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775813647; c=relaxed/simple; bh=qFO2QnppJFNf/U34Ko433cweQot+NmWgtmUIfZHmjfQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bxBkBupZkw/ulLH2pc0jCYKLaHPMDU80xBh39TFq8a9imiX7dalNS3uwkGq/5uSMnuzNtB49Ag2vJ3RaCmewk8WyxffnAw2IOZKfOs5aGCE1v4PMc3P/us/8oCPOS7QUG5qyIlINyRKInWJLVITr+Q4NA+McgFCMCV6tKko+imY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=s2kBV0MG; arc=none smtp.client-ip=113.46.200.225 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="s2kBV0MG" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=mVmpCI0HC1/hdt/Oa73YmK5ClzgLJZRC5VBrHWy673M=; b=s2kBV0MGnmH8yHm6y0j5Yfr+rSaIYmuyS62fE13daWSdzDsZOux/XwLXVSGY+vWWJdRGONhV1 TVAyZAwz7iwzwSoBcSMps+BHFf+GAJANqPPnba0u330+FSs7PRJn5cA/ndZHPQLJ9ImIBbm7U24 ZOjoXnCeDeposB7ppFfAkUw= Received: from mail.maildlp.com (unknown [172.19.163.200]) by canpmsgout10.his.huawei.com (SkyGuard) with ESMTPS id 4fsWg51VdYz1K99S; Fri, 10 Apr 2026 17:27:45 +0800 (CST) Received: from kwepemk500005.china.huawei.com (unknown [7.202.194.90]) by mail.maildlp.com (Postfix) with ESMTPS id 32BE240563; Fri, 10 Apr 2026 17:33:58 +0800 (CST) Received: from huawei.com (10.50.163.32) by kwepemk500005.china.huawei.com (7.202.194.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 10 Apr 2026 17:33:57 +0800 From: Yifan Wu To: , , , , , , , , , , , , , , , CC: , , , , , Subject: [PATCH v2 6/6] selftests/resctrl: Remove the definition of the IMC counter config array and imcs. Date: Fri, 10 Apr 2026 17:33:52 +0800 Message-ID: <20260410093352.3988125-7-wuyifan50@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260410093352.3988125-1-wuyifan50@huawei.com> References: <20260410093352.3988125-1-wuyifan50@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems500001.china.huawei.com (7.221.188.70) To kwepemk500005.china.huawei.com (7.202.194.90) Content-Type: text/plain; charset="utf-8" The definitions of the imc counter configuration array, imcs, and MAX_IMCS are removed. Signed-off-by: Yifan Wu --- tools/testing/selftests/resctrl/resctrl_val.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/= selftests/resctrl/resctrl_val.c index 65ae93205b38..acc2a4c19cf4 100644 --- a/tools/testing/selftests/resctrl/resctrl_val.c +++ b/tools/testing/selftests/resctrl/resctrl_val.c @@ -14,7 +14,6 @@ #define READ_FILE_NAME "cas_count_read" #define DYN_PMU_PATH "/sys/bus/event_source/devices" #define SCALE 0.00006103515625 -#define MAX_IMCS 40 #define MAX_TOKENS 5 =20 #define CON_MBM_LOCAL_BYTES_PATH \ @@ -37,8 +36,6 @@ struct imc_counter_config { }; =20 static char mbm_total_path[1024]; -static int imcs; -static struct imc_counter_config imc_counters_config[MAX_IMCS]; LIST_HEAD(imc_counters_list); static const struct resctrl_test *current_test; =20 --=20 2.43.0