From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Reinette Chatre <reinette.chatre@intel.com>
Cc: linux-kselftest@vger.kernel.org, Shuah Khan <shuah@kernel.org>,
Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>,
Fenghua Yu <fenghua.yu@intel.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 07/19] selftests/resctrl: Refactor remount_resctrl(bool mum_resctrlfs) to mount_resctrl()
Date: Fri, 14 Jul 2023 14:03:47 +0300 (EEST) [thread overview]
Message-ID: <2c1f4d5f-7d6f-1178-7ec4-7f8b862b26e9@linux.intel.com> (raw)
In-Reply-To: <09605219-19db-ba2d-aaad-9e279543f461@intel.com>
[-- Attachment #1: Type: text/plain, Size: 4532 bytes --]
On Thu, 13 Jul 2023, Reinette Chatre wrote:
> On 7/13/2023 6:19 AM, Ilpo Järvinen wrote:
> > Mount/umount of the resctrl FS is now paired nicely per test.
> >
> > Rename remount_resctrl(bool mum_resctrlfs) to mount_resctrl(). Make
> > it unconditionally try to mount the resctrl FS and return error if
> > resctrl FS was mounted already.
> >
> > While at it, group the mount/umount prototypes in the header.
> >
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > ---
> > tools/testing/selftests/resctrl/resctrl.h | 2 +-
> > .../testing/selftests/resctrl/resctrl_tests.c | 8 ++++----
> > tools/testing/selftests/resctrl/resctrlfs.c | 20 +++++--------------
> > 3 files changed, 10 insertions(+), 20 deletions(-)
> >
> > diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h
> > index f455f0b7e314..23af3fb73cb4 100644
> > --- a/tools/testing/selftests/resctrl/resctrl.h
> > +++ b/tools/testing/selftests/resctrl/resctrl.h
> > @@ -85,8 +85,8 @@ extern char llc_occup_path[1024];
> > int get_vendor(void);
> > 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 mount_resctrlfs(void);
> > int umount_resctrlfs(void);
> > int validate_bw_report_request(char *bw_report);
> > bool validate_resctrl_feature_request(const char *resctrl_val);
> > diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c
> > index a421d045de08..3f26d2279f75 100644
> > --- a/tools/testing/selftests/resctrl/resctrl_tests.c
> > +++ b/tools/testing/selftests/resctrl/resctrl_tests.c
> > @@ -77,7 +77,7 @@ static void run_mbm_test(bool has_ben, char **benchmark_cmd, int span,
> >
> > ksft_print_msg("Starting MBM BW change ...\n");
> >
> > - res = remount_resctrlfs(true);
> > + res = mount_resctrlfs();
> > if (res) {
> > ksft_exit_fail_msg("Failed to mount resctrl FS\n");
> > return;
> > @@ -106,7 +106,7 @@ static void run_mba_test(bool has_ben, char **benchmark_cmd, int span,
> >
> > ksft_print_msg("Starting MBA Schemata change ...\n");
> >
> > - res = remount_resctrlfs(true);
> > + res = mount_resctrlfs();
> > if (res) {
> > ksft_exit_fail_msg("Failed to mount resctrl FS\n");
> > return;
> > @@ -132,7 +132,7 @@ static void run_cmt_test(bool has_ben, char **benchmark_cmd, int cpu_no)
> >
> > ksft_print_msg("Starting CMT test ...\n");
> >
> > - res = remount_resctrlfs(true);
> > + res = mount_resctrlfs();
> > if (res) {
> > ksft_exit_fail_msg("Failed to mount resctrl FS\n");
> > return;
> > @@ -160,7 +160,7 @@ static void run_cat_test(int cpu_no, int no_of_bits)
> >
> > ksft_print_msg("Starting CAT test ...\n");
> >
> > - res = remount_resctrlfs(true);
> > + res = mount_resctrlfs();
> > if (res) {
> > ksft_exit_fail_msg("Failed to mount resctrl FS\n");
> > return;
> > diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c
> > index b3a05488d360..f622245adafe 100644
> > --- a/tools/testing/selftests/resctrl/resctrlfs.c
> > +++ b/tools/testing/selftests/resctrl/resctrlfs.c
> > @@ -48,29 +48,19 @@ static int find_resctrl_mount(char *buffer)
> > }
> >
> > /*
> > - * remount_resctrlfs - Remount resctrl FS at /sys/fs/resctrl
> > - * @mum_resctrlfs: Should the resctrl FS be remounted?
> > + * mount_resctrlfs - Mount resctrl FS at /sys/fs/resctrl
> > *
> > * If not mounted, mount it.
> > - * If mounted and mum_resctrlfs then remount resctrl FS.
> > - * If mounted and !mum_resctrlfs then noop
> > *
> > * Return: 0 on success, non-zero on failure
> > */
>
> Since it is not obviously a "failure" I do think it will help to
> add to the comments that resctrl already being mounted is treated as
> a failure.
>
> > -int remount_resctrlfs(bool mum_resctrlfs)
> > +int mount_resctrlfs(void)
> > {
> > - char mountpoint[256];
> > int ret;
> >
> > - ret = find_resctrl_mount(mountpoint);
> > - if (ret)
> > - strcpy(mountpoint, RESCTRL_PATH);
> > -
> > - if (!ret && mum_resctrlfs && umount(mountpoint))
> > - ksft_print_msg("Fail: unmounting \"%s\"\n", mountpoint);
> > -
> > - if (!ret && !mum_resctrlfs)
> > - return 0;
> > + ret = find_resctrl_mount(NULL);
> > + if (!ret)
> > + return -1;
>
> This treats "ret == 0" as a failure. What about -ENXIO? It seems to
> me that only "ret == -ENOENT" is "success".
Yes, it's a good catch.
--
i.
next prev parent reply other threads:[~2023-07-14 11:04 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-13 13:19 [PATCH v4 00/19] selftests/resctrl: Fixes and cleanups Ilpo Järvinen
2023-07-13 13:19 ` [PATCH v4 01/19] selftests/resctrl: Add resctrl.h into build deps Ilpo Järvinen
2023-07-13 22:43 ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 02/19] selftests/resctrl: Don't leak buffer in fill_cache() Ilpo Järvinen
2023-07-13 22:44 ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 03/19] selftests/resctrl: Unmount resctrl FS if child fails to run benchmark Ilpo Järvinen
2023-07-13 22:51 ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 04/19] selftests/resctrl: Close perf value read fd on errors Ilpo Järvinen
2023-07-13 22:52 ` Reinette Chatre
2023-07-14 10:35 ` Ilpo Järvinen
2023-07-14 17:36 ` Reinette Chatre
2023-07-17 13:05 ` Ilpo Järvinen
2023-07-17 16:09 ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 05/19] selftests/resctrl: Unmount resctrl FS before starting the first test Ilpo Järvinen
2023-07-13 22:53 ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 06/19] selftests/resctrl: Move resctrl FS mount/umount to higher level Ilpo Järvinen
2023-07-13 22:55 ` Reinette Chatre
2023-07-14 11:31 ` Ilpo Järvinen
2023-07-14 17:36 ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 07/19] selftests/resctrl: Refactor remount_resctrl(bool mum_resctrlfs) to mount_resctrl() Ilpo Järvinen
2023-07-13 22:57 ` Reinette Chatre
2023-07-14 11:03 ` Ilpo Järvinen [this message]
2023-07-24 7:12 ` Wieczor-Retman, Maciej
2023-08-07 10:26 ` Ilpo Järvinen
2023-07-13 13:19 ` [PATCH v4 08/19] selftests/resctrl: Remove mum_resctrlfs from struct resctrl_val_param Ilpo Järvinen
2023-07-13 22:59 ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 09/19] selftests/resctrl: Convert span to size_t Ilpo Järvinen
2023-07-13 22:59 ` Reinette Chatre
2023-07-14 10:33 ` Ilpo Järvinen
2023-07-13 13:19 ` [PATCH v4 10/19] selftests/resctrl: Express span internally in bytes Ilpo Järvinen
2023-07-13 23:00 ` Reinette Chatre
2023-07-14 6:43 ` Wieczor-Retman, Maciej
2023-07-14 10:22 ` Ilpo Järvinen
2023-07-14 17:38 ` Reinette Chatre
2023-07-17 12:30 ` Ilpo Järvinen
2023-07-17 16:10 ` Reinette Chatre
2023-07-18 10:10 ` Ilpo Järvinen
2023-07-14 17:38 ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 11/19] selftests/resctrl: Remove duplicated preparation for span arg Ilpo Järvinen
2023-07-13 23:01 ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 12/19] selftests/resctrl: Remove "malloc_and_init_memory" param from run_fill_buf() Ilpo Järvinen
2023-07-13 23:05 ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 13/19] selftests/resctrl: Remove unnecessary startptr global from fill_buf Ilpo Järvinen
2023-07-13 23:06 ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 14/19] selftests/resctrl: Improve parameter consistency in fill_buf Ilpo Järvinen
2023-07-13 23:07 ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 15/19] selftests/resctrl: Don't pass test name to fill_buf Ilpo Järvinen
2023-07-13 23:10 ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 16/19] selftests/resctrl: Don't use variable argument list for ->setup() Ilpo Järvinen
2023-07-13 23:13 ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 17/19] selftests/resctrl: Move CAT/CMT test global vars to function they are used in Ilpo Järvinen
2023-07-14 0:04 ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 18/19] selftests/resctrl: Pass the real number of tests to show_cache_info() Ilpo Järvinen
2023-07-14 0:05 ` Reinette Chatre
2023-07-13 13:19 ` [PATCH v4 19/19] selftests/resctrl: Remove test type checks from cat_val() Ilpo Järvinen
2023-07-14 0:07 ` Reinette Chatre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2c1f4d5f-7d6f-1178-7ec4-7f8b862b26e9@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=fenghua.yu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=reinette.chatre@intel.com \
--cc=shuah@kernel.org \
--cc=tan.shaopeng@jp.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox