Re: [PATCH v2 4/4] selftests/resctrl: Add non-contiguous CBMs CAT test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 8 Jan 2024, Reinette Chatre wrote:

> Hi Maciej,
> 
> On 12/12/2023 6:52 AM, Maciej Wieczor-Retman wrote:
> > Add tests for both L2 and L3 CAT to verify the return values
> > generated by writing non-contiguous CBMs don't contradict the
> > reported non-contiguous support information.
> > 
> > Use a logical XOR to confirm return value of write_schemata() and
> > non-contiguous CBMs support information match.
> > 
> > Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx>
> > ---
> > Changelog v2:
> > - Redo the patch message. (Ilpo)
> > - Tidy up __cpuid_count calls. (Ilpo)
> > - Remove redundant AND in noncont_mask calculations (Ilpo)
> > - Fix bit_center offset.
> > - Add newline before function return. (Ilpo)
> > - Group non-contiguous tests with CAT tests. (Ilpo)
> > - Use a helper for reading sparse_masks file. (Ilpo)
> > - Make get_cache_level() available in other source files. (Ilpo)
> > 
> >  tools/testing/selftests/resctrl/cat_test.c    | 75 +++++++++++++++++++
> >  tools/testing/selftests/resctrl/resctrl.h     |  3 +
> >  .../testing/selftests/resctrl/resctrl_tests.c |  2 +
> >  tools/testing/selftests/resctrl/resctrlfs.c   |  2 +-
> >  4 files changed, 81 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c
> > index 7dc7206b3b99..ecf553a89aae 100644
> > --- a/tools/testing/selftests/resctrl/cat_test.c
> > +++ b/tools/testing/selftests/resctrl/cat_test.c
> > @@ -292,6 +292,65 @@ static int cat_run_test(const struct resctrl_test *test, const struct user_param
> >  	return ret;
> >  }
> >  
> > +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, ret;
> > +	int level, bit_center, sparse_masks;
> > +	char schemata[64];
> > +
> > +	/* Check to compare sparse_masks content to cpuid output. */
> 
> "cpuid" -> "CPUID" (to note it is an instruction)
> 
> > +	sparse_masks = read_info_res_file(test->resource, "sparse_masks");
> > +	if (sparse_masks < 0)
> > +		return sparse_masks;
> > +
> > +	level = get_cache_level(test->resource);
> > +	if (level < 0)
> > +		return -EINVAL;
> > +	__cpuid_count(0x10, 4 - level, eax, ebx, ecx, edx);
> 
> Please do not invent relationships. Please replace the "4 - level" with
> specific index used that depends on particular cache. The cache level
> may not even be needed, just use the resource to determine the correct
> index.

This is actually my fault, I suggested Maciej could use arithmetics there.

> > +
> > +	return !ret == !sparse_masks;
> 
> Please return negative on error. Ilpo just did a big cleanup to address this.

Test failure is not same as an error. So tests should return negative for 
errors which prevent even running test at all, and 0/1 for test 
success/fail.

-- 
 i.




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux