lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <91052cec-071b-7cc7-5f85-4fa29ec2aea4@linux.intel.com>
Date: Mon, 10 Jun 2024 19:20:55 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Babu Moger <babu.moger@....com>
cc: fenghua.yu@...el.com, Reinette Chatre <reinette.chatre@...el.com>, 
    shuah@...nel.org, LKML <linux-kernel@...r.kernel.org>, 
    linux-kselftest@...r.kernel.org, 
    Maciej Wieczór-Retman <maciej.wieczor-retman@...el.com>, 
    peternewman@...gle.com, eranian@...gle.com
Subject: Re: [PATCH v2] selftests/resctrl: Fix noncont_cat_run_test for AMD

On Mon, 10 Jun 2024, Babu Moger wrote:

> The selftest noncont_cat_run_test fails on AMD with the warnings. Reason

noncont_cat_run_test()

(In general, use () when refering to a function, same thing in the 
shortlog).

"the warnings" sounds like I should know about what warning it fails with
but there's no previous context which tells that information. I suggest 
you either use "a warning" or quote the warning it fails with into the 
commit message.

> is, AMD supports non contiguous CBM masks but does not report it via CPUID.

non-contiguous

> Update noncont_cat_run_test to check for the vendor when verifying CPUID.

()

> Fixes: ae638551ab64 ("selftests/resctrl: Add non-contiguous CBMs CAT test")
> Signed-off-by: Babu Moger <babu.moger@....com>
> ---
> v2: Moved the non contiguous verification to a new function
>     arch_supports_noncont_cat.
> 
> v1:
> This was part of the series
> https://lore.kernel.org/lkml/cover.1708637563.git.babu.moger@amd.com/
> Sending this as a separate fix per review comments.
> ---
>  tools/testing/selftests/resctrl/cat_test.c | 32 +++++++++++++++-------
>  1 file changed, 22 insertions(+), 10 deletions(-)
> 
> diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c
> index d4dffc934bc3..742782438ca3 100644
> --- a/tools/testing/selftests/resctrl/cat_test.c
> +++ b/tools/testing/selftests/resctrl/cat_test.c
> @@ -288,11 +288,30 @@ static int cat_run_test(const struct resctrl_test *test, const struct user_param
>  	return ret;
>  }
>  
> +static bool arch_supports_noncont_cat(const struct resctrl_test *test)
> +{
> +	unsigned int eax, ebx, ecx, edx;
> +
> +	/* AMD always supports non-contiguous CBM. */
> +	if (get_vendor() == ARCH_AMD)
> +		return true;
> +
> +	/* Intel support for non-contiguous CBM needs to be discovered. */
> +	if (!strcmp(test->resource, "L3"))
> +		__cpuid_count(0x10, 1, eax, ebx, ecx, edx);
> +	else if (!strcmp(test->resource, "L2"))
> +		__cpuid_count(0x10, 2, eax, ebx, ecx, edx);
> +	else
> +		return false;
> +
> +	return ((ecx >> 3) & 1);
> +}
> +
>  static int noncont_cat_run_test(const struct resctrl_test *test,
>  				const struct user_params *uparams)
>  {
>  	unsigned long full_cache_mask, cont_mask, noncont_mask;
> -	unsigned int eax, ebx, ecx, edx, sparse_masks;
> +	unsigned int sparse_masks;
>  	int bit_center, ret;
>  	char schemata[64];
>  
> @@ -301,15 +320,8 @@ static int noncont_cat_run_test(const struct resctrl_test *test,
>  	if (ret)
>  		return ret;
>  
> -	if (!strcmp(test->resource, "L3"))
> -		__cpuid_count(0x10, 1, eax, ebx, ecx, edx);
> -	else if (!strcmp(test->resource, "L2"))
> -		__cpuid_count(0x10, 2, eax, ebx, ecx, edx);
> -	else
> -		return -EINVAL;
> -
> -	if (sparse_masks != ((ecx >> 3) & 1)) {
> -		ksft_print_msg("CPUID output doesn't match 'sparse_masks' file content!\n");
> +	if (arch_supports_noncont_cat(test) != sparse_masks) {
> +		ksft_print_msg("Hardware and kernel differ on non-contiguous CBM support!\n");
>  		return 1;

This looks better than the previous version, thanks.


-- 
 i.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ