All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>,
	 Reinette Chatre <reinette.chatre@intel.com>,
	Shuah Khan <shuah@kernel.org>,
	 tony.luck@intel.com,
	"Shaopeng Tan (Fujitsu)" <tan.shaopeng@fujitsu.com>,
	 LKML <linux-kernel@vger.kernel.org>,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH 2/4] selftests/resctrl: SNC support for CMT
Date: Fri, 8 Mar 2024 15:53:19 +0200 (EET)	[thread overview]
Message-ID: <6181937a-54b4-8b17-0c24-734764a205d1@linux.intel.com> (raw)
In-Reply-To: <75849cb145429798b21c23b6be4abd7ece9df57b.1709721159.git.maciej.wieczor-retman@intel.com>

On Wed, 6 Mar 2024, Maciej Wieczor-Retman wrote:

> Cache Monitoring Technology (CMT) works by measuring how much data in L3
> cache is occupied by a given process identified by its Resource
> Monitoring ID (RMID).
> 
> On systems with Sub-Numa Clusters (SNC) enabled, a process can occupy
> not only the cache that belongs to its own NUMA node but also pieces of
> other NUMA nodes' caches that lie on the same socket.
> 
> A simple correction to make the CMT selftest NUMA-aware is to sum values
> reported by all nodes on the same socket for a given RMID.
> 
> Reported-by: "Shaopeng Tan (Fujitsu)" <tan.shaopeng@fujitsu.com>
> Closes: https://lore.kernel.org/all/TYAPR01MB6330B9B17686EF426D2C3F308B25A@TYAPR01MB6330.jpnprd01.prod.outlook.com/
> Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
> ---
>  tools/testing/selftests/resctrl/cache.c       | 17 +++++++++++------
>  tools/testing/selftests/resctrl/resctrl.h     |  4 +++-
>  tools/testing/selftests/resctrl/resctrl_val.c |  9 ++++++---
>  3 files changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/tools/testing/selftests/resctrl/cache.c b/tools/testing/selftests/resctrl/cache.c
> index 1b339d6bbff1..dab81920033b 100644
> --- a/tools/testing/selftests/resctrl/cache.c
> +++ b/tools/testing/selftests/resctrl/cache.c
> @@ -161,16 +161,21 @@ int perf_event_measure(int pe_fd, struct perf_event_read *pe_read,
>   *
>   * Return: =0 on success. <0 on failure.
>   */
> -int measure_llc_resctrl(const char *filename, int bm_pid)
> +int measure_llc_resctrl(const char *filename, int bm_pid, const char *ctrlgrp,
> +			const char *mongrp, int res_id)
>  {
> -	unsigned long llc_occu_resc = 0;
> +	unsigned long sum = 0, llc_occu_resc = 0;
>  	int ret;
>  
> -	ret = get_llc_occu_resctrl(&llc_occu_resc);
> -	if (ret < 0)
> -		return ret;
> +	for (int i = 0 ; i < snc_ways() ; i++) {

Spaces as per usual coding style:

	for (int i = 0; i < snc_ways(); i++) {

> +		set_cmt_path(ctrlgrp, mongrp, res_id + i);
> +		ret = get_llc_occu_resctrl(&llc_occu_resc);
> +		if (ret < 0)
> +			return ret;
> +		sum += llc_occu_resc;
> +	}
>  
> -	return print_results_cache(filename, bm_pid, llc_occu_resc);
> +	return print_results_cache(filename, bm_pid, sum);
>  }
>  
>  /*

> @@ -828,6 +828,8 @@ int resctrl_val(const struct resctrl_test *test,
>  	sleep(1);
>  
>  	/* Test runs until the callback setup() tells the test to stop. */
> +	get_domain_id("L3", uparams->cpu, &res_id);

Hardcoding L3 here limits the genericness of this function. You don't even 
need to do it, get_domain_id() does "MB" -> "L3" transformation implicitly 
for you so you can just pass test->resource instead.

Also, I don't understand why you now again make the naming inconsistent 
with "res_id".

If you based this on top of the patches I just posted, resctl_val() 
already the domain_id variable.

-- 
 i.

> +	res_id *= snc_ways();
>  	while (1) {
>  		ret = param->setup(test, uparams, param);
>  		if (ret == END_OF_TESTS) {
> @@ -844,7 +846,8 @@ int resctrl_val(const struct resctrl_test *test,
>  				break;
>  		} else if (!strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR))) {
>  			sleep(1);
> -			ret = measure_llc_resctrl(param->filename, bm_pid);
> +			ret = measure_llc_resctrl(param->filename, bm_pid, param->ctrlgrp,
> +						  param->mongrp, res_id);
>  			if (ret)
>  				break;
>  		}
> 


  reply	other threads:[~2024-03-08 13:53 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06 10:38 [PATCH 0/4] SNC support for resctrl selftests Maciej Wieczor-Retman
2024-03-06 10:39 ` [PATCH 1/4] selftests/resctrl: Adjust effective L3 cache size with SNC enabled Maciej Wieczor-Retman
2024-03-06 10:39 ` [PATCH 2/4] selftests/resctrl: SNC support for CMT Maciej Wieczor-Retman
2024-03-08 13:53   ` Ilpo Järvinen [this message]
2024-03-08 13:59     ` Ilpo Järvinen
2024-03-13 10:23       ` Maciej Wieczor-Retman
2024-03-06 10:39 ` [PATCH 3/4] selftests/resctrl: SNC support for MBM Maciej Wieczor-Retman
2024-03-08 14:07   ` Ilpo Järvinen
2024-03-13 10:26     ` Maciej Wieczor-Retman
2024-03-06 10:39 ` [PATCH 4/4] selftests/resctrl: Adjust SNC support messages Maciej Wieczor-Retman
2024-03-06 21:54   ` Luck, Tony
2024-03-07  9:25     ` Maciej Wieczor-Retman
2024-03-07 17:18       ` Luck, Tony
2024-03-07 17:41         ` Reinette Chatre
2024-03-07 17:57           ` Luck, Tony
2024-03-07 19:52             ` Reinette Chatre
2024-03-07 21:14               ` Luck, Tony
2024-03-07 22:39                 ` Reinette Chatre
2024-03-07 23:16                   ` Tony Luck
2024-03-07 23:41                     ` Reinette Chatre
2024-03-08 18:06                     ` James Morse
2024-03-08 18:42                       ` Tony Luck
2024-03-15 18:02                         ` James Morse
2024-03-18 19:15                           ` Reinette Chatre
2024-03-18 19:34                             ` Luck, Tony
2024-03-18 20:32                               ` Reinette Chatre
2024-03-18 20:47                                 ` Luck, Tony
2024-03-18 21:04                                   ` Luck, Tony
2024-03-18 21:26                                     ` Reinette Chatre
2024-03-18 22:00                                       ` Luck, Tony
2024-03-18 22:43                                         ` Reinette Chatre
2024-03-18 21:23                                   ` Reinette Chatre
2024-03-18 22:04                                     ` Luck, Tony
2024-03-19 21:01                                       ` Peter Newman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6181937a-54b4-8b17-0c24-734764a205d1@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=reinette.chatre@intel.com \
    --cc=shuah@kernel.org \
    --cc=tan.shaopeng@fujitsu.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.