Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: Babu Moger <babu.moger@amd.com>, <fenghua.yu@intel.com>,
	<shuah@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-kselftest@vger.kernel.org>,
	<ilpo.jarvinen@linux.intel.com>,
	<maciej.wieczor-retman@intel.com>, <peternewman@google.com>,
	<eranian@google.com>
Subject: Re: [PATCH v2 2/4] selftests/resctrl: Pass sysfs controller name of the vendor
Date: Thu, 9 May 2024 14:11:10 -0700	[thread overview]
Message-ID: <eb80df2b-d6ba-4171-ad05-c76c218b0e3a@intel.com> (raw)
In-Reply-To: <406d1fbe6b480fbe13fd0b8c432cdc517a7bd8c1.1714073751.git.babu.moger@amd.com>

Hi Babu,

On 4/25/2024 1:17 PM, Babu Moger wrote:
> Detect the vendor and pass the sysfs name for the vendor for searching
> the controller information.

Could you please write a proper changelog?

> 
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
>  tools/testing/selftests/resctrl/resctrl_val.c | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c
> index a30cfcff605f..e3b09128ec3d 100644
> --- a/tools/testing/selftests/resctrl/resctrl_val.c
> +++ b/tools/testing/selftests/resctrl/resctrl_val.c
> @@ -224,14 +224,24 @@ static int num_of_mem_controllers(void)
>  {
>  	char imc_dir[512], *temp;
>  	unsigned int count = 0;
> +	int ret, vendor, size;
>  	struct dirent *ep;
> -	int ret;
> +	char *sysfs_name;
>  	DIR *dp;
>  
> +	vendor = get_vendor();
> +	if (vendor == ARCH_INTEL) {
> +		sysfs_name = UNCORE_IMC;
> +		size = sizeof(UNCORE_IMC);

Why is separate size needed? Can strlen() just be used when needed?

> +	} else {
> +		perror("Unsupported Vendor!\n");

ksft_perror()?

In the message, "Vendor" need not start with capital. It may also
help to print the vendor value in this unlikely case.

> +		return -1;
> +	}
> +
>  	dp = opendir(DYN_PMU_PATH);
>  	if (dp) {
>  		while ((ep = readdir(dp))) {
> -			temp = strstr(ep->d_name, UNCORE_IMC);
> +			temp = strstr(ep->d_name, sysfs_name);
>  			if (!temp)
>  				continue;
>  
> @@ -242,7 +252,7 @@ static int num_of_mem_controllers(void)
>  			 * well and hence the last underscore character in
>  			 * uncore_imc'_' need not be counted.
>  			 */
> -			temp = temp + sizeof(UNCORE_IMC);
> +			temp = temp + size;

strlen()? (Keeping in mind the adjustment for the "_" character).

>  
>  			/*
>  			 * Some directories under "DYN_PMU_PATH" could have

Reinette

  reply	other threads:[~2024-05-09 21:11 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22 21:35 [PATCH 0/4] selftests/resctrl: Enable MBM and MBA tests on AMD Babu Moger
2024-02-22 21:35 ` [PATCH 1/4] selftests/resctrl: Rename variable imcs and num_of_imcs() to generic names Babu Moger
2024-02-23 10:38   ` Ilpo Järvinen
2024-02-23 18:11     ` Moger, Babu
2024-02-22 21:35 ` [PATCH 2/4] selftests/resctrl: Pass sysfs controller name of the vendor Babu Moger
2024-02-22 21:35 ` [PATCH 3/4] selftests/resctrl: Add support for MBM and MBA tests on AMD Babu Moger
2024-02-23 10:53   ` Ilpo Järvinen
2024-02-23 19:30     ` Moger, Babu
2024-02-23 19:47       ` Moger, Babu
2024-02-23 22:39         ` Reinette Chatre
2024-02-26 18:02           ` Moger, Babu
2024-02-22 21:35 ` [PATCH 4/4] selftests/resctrl: Skip the tests if iMC/UMC counters are unavailable Babu Moger
2024-02-23 10:56   ` Ilpo Järvinen
2024-02-23 19:39     ` Moger, Babu
2024-04-25 20:16 ` [PATCH v2 0/4] selftests/resctrl: Enable MBM and MBA tests on AMD Babu Moger
2024-04-25 20:16   ` [PATCH v2 1/4] selftests/resctrl: Rename variable imcs and num_of_imcs() to generic names Babu Moger
2024-05-09 21:10     ` Reinette Chatre
2024-05-30 16:07       ` Moger, Babu
2024-04-25 20:17   ` [PATCH v2 2/4] selftests/resctrl: Pass sysfs controller name of the vendor Babu Moger
2024-05-09 21:11     ` Reinette Chatre [this message]
2024-05-30 16:08       ` Moger, Babu
2024-04-25 20:17   ` [PATCH v2 3/4] selftests/resctrl: Add support for MBM and MBA tests on AMD Babu Moger
2024-05-09 21:11     ` Reinette Chatre
2024-05-30 16:08       ` Moger, Babu
2024-04-25 20:17   ` [PATCH v2 4/4] selftests/resctrl: Enable MBA/MBA " Babu Moger
2024-04-26  7:06     ` Ilpo Järvinen
2024-04-26 14:56       ` Moger, Babu
2024-05-09 21:11       ` Reinette Chatre
2024-05-30 16:08         ` Moger, Babu
2024-05-09 21:10   ` [PATCH v2 0/4] selftests/resctrl: Enable MBM and MBA " Reinette Chatre
2024-05-30 16:07     ` Moger, Babu

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=eb80df2b-d6ba-4171-ad05-c76c218b0e3a@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=babu.moger@amd.com \
    --cc=eranian@google.com \
    --cc=fenghua.yu@intel.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=peternewman@google.com \
    --cc=shuah@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox