[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ikd2opu75n66j4a4rafz5garz2kuozssx4v73legg3prsh7m6n@v2frrzizkjgt>
Date: Mon, 12 Feb 2024 08:15:58 +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-kselftest@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<ilpo.jarvinen@...ux.intel.com>
Subject: Re: [PATCH v5 3/5] selftests/resctrl: Split
validate_resctrl_feature_request()
Hi,
On 2024-02-09 at 09:20:27 -0800, Reinette Chatre wrote:
>Hi Maciej,
>
>On 2/9/2024 6:01 AM, Maciej Wieczor-Retman wrote:
>
>...
>
>> diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h
>> index 5116ea082d03..f434a6543b4f 100644
>> --- a/tools/testing/selftests/resctrl/resctrl.h
>> +++ b/tools/testing/selftests/resctrl/resctrl.h
>> @@ -136,7 +136,9 @@ int get_domain_id(const char *resource, int cpu_no, int *domain_id);
>> int mount_resctrlfs(void);
>> int umount_resctrlfs(void);
>> int validate_bw_report_request(char *bw_report);
>> -bool validate_resctrl_feature_request(const char *resource, const char *feature);
>> +bool resctrl_resource_exists(const char *resource);
>> +bool resctrl_mon_feature_exists(const char *resource, const char *feature);
>> +bool resource_info_file_exists(const char *resource, const char *file);
>
>Portion of next patch sneaked in here.
Missed it, thanks for pointing that out!
>
>> bool test_resource_feature_check(const struct resctrl_test *test);
>> char *fgrep(FILE *inf, const char *str);
>> int taskset_benchmark(pid_t bm_pid, int cpu_no, cpu_set_t *old_affinity);
>> diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c
>> index 8a183c73bc23..af4f800ab23d 100644
>> --- a/tools/testing/selftests/resctrl/resctrlfs.c
>> +++ b/tools/testing/selftests/resctrl/resctrlfs.c
>> @@ -708,20 +708,16 @@ char *fgrep(FILE *inf, const char *str)
>> }
>>
>> /*
>> - * validate_resctrl_feature_request - Check if requested feature is valid.
>> - * @resource: Required resource (e.g., MB, L3, L2, L3_MON, etc.)
>> - * @feature: Required monitor feature (in mon_features file). Can only be
>> - * set for L3_MON. Must be NULL for all other resources.
>> + * resctrl_resource_exists - Check if a resource is supported.
>> + * @resource: Resctrl resource (e.g., MB, L3, L2, L3_MON, etc.)
>> *
>> - * Return: True if the resource/feature is supported, else false. False is
>> + * Return: True if the resource is supported, else false. False is
>> * also returned if resctrl FS is not mounted.
>> */
>> -bool validate_resctrl_feature_request(const char *resource, const char *feature)
>> +bool resctrl_resource_exists(const char *resource)
>> {
>> char res_path[PATH_MAX];
>> struct stat statbuf;
>> - char *res;
>> - FILE *inf;
>> int ret;
>>
>> if (!resource)
>> @@ -736,8 +732,25 @@ bool validate_resctrl_feature_request(const char *resource, const char *feature)
>> if (stat(res_path, &statbuf))
>> return false;
>>
>> + return true;
>> +}
>> +
>> +/*
>> + * resctrl_mon_feature_exists - Check if requested monitoring feature is valid.
>> + * @resource: Resource that uses the mon_features file. Currently only L3_MON
>> + * is valid.
>> + * @feature: Required monitor feature (in mon_features file).
>> + *
>> + * Return: True if the feature is supported, else false.
>> + */
>> +bool resctrl_mon_feature_exists(const char *resource, const char *feature)
>> +{
>> + char res_path[PATH_MAX];
>> + char *res;
>> + FILE *inf;
>> +
>> if (!feature)
>
>Now that resource is a new parameter should it be checked also? It is not obvious
>why only one parameter is checked.
Right, I'll add the check there.
>
>Reinette
--
Kind regards
Maciej Wieczór-Retman
Powered by blists - more mailing lists