diff mbox series

[V2,15/19] selftests/resctrl: Change return type of umount_resctrlfs() to void

Message ID 3c00e744acbfa67a1988638f1718cd67382a6f59.1589835155.git.sai.praneeth.prakhya@intel.com (mailing list archive)
State New
Headers show
Series Miscellaneous fixes for resctrl selftests | expand

Commit Message

Prakhya, Sai Praneeth May 18, 2020, 10:08 p.m. UTC
umount_resctrlfs() is used only during tear down path and there is nothing
much to do if unmount of resctrl file system fails, so, all the callers of
this function are not checking for the return value. Hence, change the
return type of this function from int to void.

Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
---
 tools/testing/selftests/resctrl/resctrl.h   | 2 +-
 tools/testing/selftests/resctrl/resctrlfs.c | 9 ++-------
 2 files changed, 3 insertions(+), 8 deletions(-)

Comments

Reinette Chatre May 20, 2020, 11:52 p.m. UTC | #1
Hi Sai,

On 5/18/2020 3:08 PM, Sai Praneeth Prakhya wrote:
> umount_resctrlfs() is used only during tear down path and there is nothing
> much to do if unmount of resctrl file system fails, so, all the callers of
> this function are not checking for the return value. Hence, change the
> return type of this function from int to void.

Should the callers be ignoring the return value? From what I can tell
the filesystem is unmounted between test runs so I wonder if it may help
if the return code is used and the test exits with an appropriate error
to user space for possible investigation instead of attempting to run a
new test on top of the resctrl filesystem that could potentially be
having issues at the time.

Reinette
Prakhya, Sai Praneeth May 21, 2020, 5:19 p.m. UTC | #2
Hi Reinette,

> -----Original Message-----
> From: Reinette Chatre <reinette.chatre@intel.com>
> Sent: Wednesday, May 20, 2020 4:52 PM
> To: Prakhya, Sai Praneeth <sai.praneeth.prakhya@intel.com>;
> shuah@kernel.org; skhan@linuxfoundation.org; linux-kselftest@vger.kernel.org
> Cc: tglx@linutronix.de; mingo@redhat.com; bp@alien8.de; Luck, Tony
> <tony.luck@intel.com>; babu.moger@amd.com; james.morse@arm.com;
> Shankar, Ravi V <ravi.v.shankar@intel.com>; Yu, Fenghua
> <fenghua.yu@intel.com>; x86@kernel.org; linux-kernel@vger.kernel;
> dan.carpenter@oracle.com; dcb314@hotmail.com
> Subject: Re: [PATCH V2 15/19] selftests/resctrl: Change return type of
> umount_resctrlfs() to void
> 
> Hi Sai,
> 
> On 5/18/2020 3:08 PM, Sai Praneeth Prakhya wrote:
> > umount_resctrlfs() is used only during tear down path and there is
> > nothing much to do if unmount of resctrl file system fails, so, all
> > the callers of this function are not checking for the return value.
> > Hence, change the return type of this function from int to void.
> 
> Should the callers be ignoring the return value? From what I can tell the
> filesystem is unmounted between test runs so I wonder if it may help if the
> return code is used and the test exits with an appropriate error to user space for
> possible investigation instead of attempting to run a new test on top of the
> resctrl filesystem that could potentially be having issues at the time.

Makes sense to me to check for the return value of umount() and take appropriate
action rather than ignoring it. But, since this might happen very rarely (I haven't
noticed umount() failing till now), I am thinking to queue this up for cleanup series.
What do you think?

This bug fixes series will then have patches 16 and 17 because they are fixing a bug
that could be easily noticed. Please let me know if you think otherwise.

Regards,
Sai
Reinette Chatre May 21, 2020, 6:15 p.m. UTC | #3
Hi Sai,

On 5/21/2020 10:19 AM, Prakhya, Sai Praneeth wrote:
> Hi Reinette,
> 
>> -----Original Message-----
>> From: Reinette Chatre <reinette.chatre@intel.com>
>> Sent: Wednesday, May 20, 2020 4:52 PM
>> To: Prakhya, Sai Praneeth <sai.praneeth.prakhya@intel.com>;
>> shuah@kernel.org; skhan@linuxfoundation.org; linux-kselftest@vger.kernel.org
>> Cc: tglx@linutronix.de; mingo@redhat.com; bp@alien8.de; Luck, Tony
>> <tony.luck@intel.com>; babu.moger@amd.com; james.morse@arm.com;
>> Shankar, Ravi V <ravi.v.shankar@intel.com>; Yu, Fenghua
>> <fenghua.yu@intel.com>; x86@kernel.org; linux-kernel@vger.kernel;
>> dan.carpenter@oracle.com; dcb314@hotmail.com
>> Subject: Re: [PATCH V2 15/19] selftests/resctrl: Change return type of
>> umount_resctrlfs() to void
>>
>> Hi Sai,
>>
>> On 5/18/2020 3:08 PM, Sai Praneeth Prakhya wrote:
>>> umount_resctrlfs() is used only during tear down path and there is
>>> nothing much to do if unmount of resctrl file system fails, so, all
>>> the callers of this function are not checking for the return value.
>>> Hence, change the return type of this function from int to void.
>>
>> Should the callers be ignoring the return value? From what I can tell the
>> filesystem is unmounted between test runs so I wonder if it may help if the
>> return code is used and the test exits with an appropriate error to user space for
>> possible investigation instead of attempting to run a new test on top of the
>> resctrl filesystem that could potentially be having issues at the time.
> 
> Makes sense to me to check for the return value of umount() and take appropriate
> action rather than ignoring it. But, since this might happen very rarely (I haven't
> noticed umount() failing till now), I am thinking to queue this up for cleanup series.
> What do you think?

That sounds good.

> 
> This bug fixes series will then have patches 16 and 17 because they are fixing a bug
> that could be easily noticed. Please let me know if you think otherwise.

I don't, dropping this change that makes it easy to ignore an error in
this round so that any errors could be dealt with better in a later
patch sounds good to me.

Thank you

Reinette
diff mbox series

Patch

diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h
index 65ca24bf3eac..23b691001f0b 100644
--- a/tools/testing/selftests/resctrl/resctrl.h
+++ b/tools/testing/selftests/resctrl/resctrl.h
@@ -76,7 +76,7 @@  bool check_resctrlfs_support(void);
 int filter_dmesg(void);
 int remount_resctrlfs(bool mum_resctrlfs);
 int get_resource_id(int cpu_no, int *resource_id);
-int umount_resctrlfs(void);
+void umount_resctrlfs(void);
 int validate_bw_report_request(char *bw_report);
 bool validate_resctrl_feature_request(const char *resctrl_val);
 char *fgrep(FILE *inf, const char *str);
diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c
index 05956319d9ce..83cd3b026c52 100644
--- a/tools/testing/selftests/resctrl/resctrlfs.c
+++ b/tools/testing/selftests/resctrl/resctrlfs.c
@@ -90,15 +90,10 @@  int remount_resctrlfs(bool mum_resctrlfs)
 	return ret;
 }
 
-int umount_resctrlfs(void)
+void umount_resctrlfs(void)
 {
-	if (umount(RESCTRL_PATH)) {
+	if (umount(RESCTRL_PATH))
 		perror("# Unable to umount resctrl");
-
-		return errno;
-	}
-
-	return 0;
 }
 
 /*