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: <wwkagup7s7xgwiwz2cto5z7zwi2z6qqjz2mrdolq7cghr5w23y@edoefyeytrvz>
Date: Wed, 4 Dec 2024 12:30:53 +0100
From: Maciej Wieczor-Retman <maciej.wieczor-retman@...el.com>
To: Reinette Chatre <reinette.chatre@...el.com>
CC: <shuah@...nel.org>, <fenghua.yu@...el.com>,
	<linux-kernel@...r.kernel.org>, <linux-kselftest@...r.kernel.org>,
	<ilpo.jarvinen@...ux.intel.com>, <tony.luck@...el.com>
Subject: Re: [PATCH v6 2/2] selftests/resctrl: Discover SNC kernel support
 and adjust messages

On 2024-12-03 at 15:30:56 -0800, Reinette Chatre wrote:
>Hi Maciej,
>
>On 12/2/24 3:08 AM, Maciej Wieczor-Retman wrote:
>
>> diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c
>> index 50561993d37c..d0a5c0f78397 100644
>> --- a/tools/testing/selftests/resctrl/resctrlfs.c
>> +++ b/tools/testing/selftests/resctrl/resctrlfs.c
>> @@ -949,3 +949,35 @@ unsigned int count_bits(unsigned long n)
>>  
>>  	return count;
>>  }
>> +
>> +/**
>> + * snc_kernel_support - Check for existence of mon_sub_L3_00 file that indicates
>> + * SNC resctrl support on the kernel side.
>> + *
>> + * Return: 0 if not supported, 1 if SNC is disabled or SNC discovery is
>> + * unreliable or SNC is both enabled and supported.
>> + */
>> +int snc_kernel_support(void)
>> +{
>> +	char node_path[PATH_MAX];
>> +	struct stat statbuf;
>> +	int ret;
>> +
>> +	ret = snc_nodes_per_l3_cache();
>> +	/*
>> +	 * If SNC is disabled then its kernel support isn't important. If SNC
>> +	 * got disabled because the discovery process was unreliable the
>> +	 * snc_unreliable variable was set. It can be used to verify the SNC
>> +	 * discovery reliability elsewhere in the selftest.
>> +	 */
>> +	if (ret == 1)
>> +		return ret;
>> +
>> +	snprintf(node_path, sizeof(node_path), "%s/%s/%s", RESCTRL_PATH, "mon_data",
>> +		 "mon_L3_00/mon_sub_L3_00");
>
>The patch looks good. I am curious why the string constants are split in two and not,
>for example, a single constant of "mon_data/mon_L3_00/mon_sub_L3_00"?

I think I introduced this inconsistency by accident when trying to follow the
example of other snprintf calls. You're right, there's not reason it can't be
just "mon_data/mon_L3_00/mon_sub_L3_00". I'll fix it in the next version. Thanks :)

>
>> +
>> +	if (!stat(node_path, &statbuf))
>> +		return 1;
>> +
>> +	return 0;
>> +}
>
>Reinette

-- 
Kind regards
Maciej Wieczór-Retman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ