diff mbox series

[2/5] selftests/resctrl: Clear unused common codes called by CAT/MBA tests

Message ID 20220914015147.3071025-4-tan.shaopeng@jp.fujitsu.com (mailing list archive)
State New
Headers show
Series selftests/resctrl: Some improvements of resctrl selftest | expand

Commit Message

Shaopeng Tan Sept. 14, 2022, 1:51 a.m. UTC
In CAT/MBA(allocation) tests, function write_schemata() is used to
change the percentage of schemata.
In CMT/MBM(monitoring) tests schemata only need to be set 100% once,
and the default value of schemata is 100% which is set by executing
mount/umout resctrl filesystem.
In addition, write_schemata() was not currently called from CMT.

Clean up unused CMT-related processing in function write_schemata().

Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
---
 tools/testing/selftests/resctrl/resctrlfs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Reinette Chatre Sept. 22, 2022, 5:44 p.m. UTC | #1
Hi Shaopeng,

On 9/13/2022 6:51 PM, Shaopeng Tan wrote:
> In CAT/MBA(allocation) tests, function write_schemata() is used to
> change the percentage of schemata.
> In CMT/MBM(monitoring) tests schemata only need to be set 100% once,
> and the default value of schemata is 100% which is set by executing
> mount/umout resctrl filesystem.
> In addition, write_schemata() was not currently called from CMT.

While this is all accurate it is not clear to me that this
justifies the removal of the support for changing the
schemata as part of a CMT test. 

From what I can tell write_schemata() is a a generic function that
currently supports all possible tests. If a later update needs to use
this for a CMT test then it should work.

I do not see any harm in leaving these checks.

> 
> Clean up unused CMT-related processing in function write_schemata().
> 
> Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
> ---
>  tools/testing/selftests/resctrl/resctrlfs.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c
> index 6f543e470ad4..349dce00472f 100644
> --- a/tools/testing/selftests/resctrl/resctrlfs.c
> +++ b/tools/testing/selftests/resctrl/resctrlfs.c
> @@ -498,8 +498,7 @@ int write_schemata(char *ctrlgrp, char *schemata, int cpu_no, char *resctrl_val)
>  	FILE *fp;
>  
>  	if (strncmp(resctrl_val, MBA_STR, sizeof(MBA_STR)) &&
> -	    strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)) &&
> -	    strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR)))
> +	    strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)))
>  		return -ENOENT;
>  
>  	if (!schemata) {
> @@ -520,8 +519,7 @@ int write_schemata(char *ctrlgrp, char *schemata, int cpu_no, char *resctrl_val)
>  	else
>  		sprintf(controlgroup, "%s/schemata", RESCTRL_PATH);
>  
> -	if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)) ||
> -	    !strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR)))
> +	if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)))
>  		sprintf(schema, "%s%d%c%s", "L3:", resource_id, '=', schemata);
>  	if (!strncmp(resctrl_val, MBA_STR, sizeof(MBA_STR)))
>  		sprintf(schema, "%s%d%c%s", "MB:", resource_id, '=', schemata);

Reinette
Shaopeng Tan (Fujitsu) Sept. 27, 2022, 9:01 a.m. UTC | #2
Hi Reinette,

> On 9/13/2022 6:51 PM, Shaopeng Tan wrote:
> > In CAT/MBA(allocation) tests, function write_schemata() is used to
> > change the percentage of schemata.
> > In CMT/MBM(monitoring) tests schemata only need to be set 100% once,
> > and the default value of schemata is 100% which is set by executing
> > mount/umout resctrl filesystem.
> > In addition, write_schemata() was not currently called from CMT.
> 
> While this is all accurate it is not clear to me that this justifies the removal of the
> support for changing the schemata as part of a CMT test.
> 
> From what I can tell write_schemata() is a a generic function that currently
> supports all possible tests. If a later update needs to use this for a CMT test
> then it should work.
> 
> I do not see any harm in leaving these checks.

According to my research, whether clearing this code or not has no effect on the current program.
I cleared this code because it looks redundant. Because CMT test didn't call write_schemata().
I will remove this patch in the next version.

Best Regards,
Shaopeng

> >
> > Clean up unused CMT-related processing in function write_schemata().
> >
> > Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
> > ---
> >  tools/testing/selftests/resctrl/resctrlfs.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/tools/testing/selftests/resctrl/resctrlfs.c
> > b/tools/testing/selftests/resctrl/resctrlfs.c
> > index 6f543e470ad4..349dce00472f 100644
> > --- a/tools/testing/selftests/resctrl/resctrlfs.c
> > +++ b/tools/testing/selftests/resctrl/resctrlfs.c
> > @@ -498,8 +498,7 @@ int write_schemata(char *ctrlgrp, char *schemata, int
> cpu_no, char *resctrl_val)
> >  	FILE *fp;
> >
> >  	if (strncmp(resctrl_val, MBA_STR, sizeof(MBA_STR)) &&
> > -	    strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)) &&
> > -	    strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR)))
> > +	    strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)))
> >  		return -ENOENT;
> >
> >  	if (!schemata) {
> > @@ -520,8 +519,7 @@ int write_schemata(char *ctrlgrp, char *schemata, int
> cpu_no, char *resctrl_val)
> >  	else
> >  		sprintf(controlgroup, "%s/schemata", RESCTRL_PATH);
> >
> > -	if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)) ||
> > -	    !strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR)))
> > +	if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)))
> >  		sprintf(schema, "%s%d%c%s", "L3:", resource_id, '=',
> schemata);
> >  	if (!strncmp(resctrl_val, MBA_STR, sizeof(MBA_STR)))
> >  		sprintf(schema, "%s%d%c%s", "MB:", resource_id, '=',
> schemata);
> 
> Reinette
diff mbox series

Patch

diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c
index 6f543e470ad4..349dce00472f 100644
--- a/tools/testing/selftests/resctrl/resctrlfs.c
+++ b/tools/testing/selftests/resctrl/resctrlfs.c
@@ -498,8 +498,7 @@  int write_schemata(char *ctrlgrp, char *schemata, int cpu_no, char *resctrl_val)
 	FILE *fp;
 
 	if (strncmp(resctrl_val, MBA_STR, sizeof(MBA_STR)) &&
-	    strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)) &&
-	    strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR)))
+	    strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)))
 		return -ENOENT;
 
 	if (!schemata) {
@@ -520,8 +519,7 @@  int write_schemata(char *ctrlgrp, char *schemata, int cpu_no, char *resctrl_val)
 	else
 		sprintf(controlgroup, "%s/schemata", RESCTRL_PATH);
 
-	if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)) ||
-	    !strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR)))
+	if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR)))
 		sprintf(schema, "%s%d%c%s", "L3:", resource_id, '=', schemata);
 	if (!strncmp(resctrl_val, MBA_STR, sizeof(MBA_STR)))
 		sprintf(schema, "%s%d%c%s", "MB:", resource_id, '=', schemata);