public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] madvise11: Allow test to skip if MADV_SOFT_OFFLINE is not supported
@ 2023-11-02 23:00 Edward Liaw via ltp
  2023-11-02 23:00 ` [LTP] [PATCH] madvise11: Replace /etc/mtab with /proc/mounts Edward Liaw via ltp
  2023-11-03 10:47 ` [LTP] [PATCH] madvise11: Allow test to skip if MADV_SOFT_OFFLINE is not supported Cyril Hrubis
  0 siblings, 2 replies; 6+ messages in thread
From: Edward Liaw via ltp @ 2023-11-02 23:00 UTC (permalink / raw)
  To: ltp; +Cc: kernel-team

madvise11 will exit with TFAIL if CONFIG_MEMORY_FAILURE is not
configured.  Skip the TFAIL if EINVAL is returned by madvise.

Signed-off-by: Edward Liaw <edliaw@google.com>
---
 testcases/kernel/syscalls/madvise/madvise11.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/madvise/madvise11.c b/testcases/kernel/syscalls/madvise/madvise11.c
index 3cde85ef5..0793319d2 100644
--- a/testcases/kernel/syscalls/madvise/madvise11.c
+++ b/testcases/kernel/syscalls/madvise/madvise11.c
@@ -162,7 +162,7 @@ static void *alloc_mem(void *threadnum)
 	err = allocate_offline(tnum);
 	tst_res(TINFO,
 		"Thread [%d] returned %d, %s.", tnum, err, (err ? "failed" : "succeeded"));
-	return (void *)(uintptr_t) (err ? -1 : 0);
+	return (void *)(uintptr_t) err;
 }
 
 static void stress_alloc_offl(void)
@@ -188,8 +188,9 @@ static void stress_alloc_offl(void)
 
 		SAFE_PTHREAD_JOIN(thread_ids[thread_index], &status);
 		if ((intptr_t)status != 0) {
-			tst_res(TFAIL, "thread [%d] - exited with errors",
-				thread_index);
+			if ((intptr_t)status != EINVAL)
+				tst_res(TFAIL, "thread [%d] - exited with errors",
+					thread_index);
 			thread_failure++;
 		}
 	}
-- 
2.42.0.869.gea05f2083d-goog


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] madvise11: Replace /etc/mtab with /proc/mounts
  2023-11-02 23:00 [LTP] [PATCH] madvise11: Allow test to skip if MADV_SOFT_OFFLINE is not supported Edward Liaw via ltp
@ 2023-11-02 23:00 ` Edward Liaw via ltp
  2023-11-03  8:29   ` Petr Vorel
  2023-11-03 10:47 ` [LTP] [PATCH] madvise11: Allow test to skip if MADV_SOFT_OFFLINE is not supported Cyril Hrubis
  1 sibling, 1 reply; 6+ messages in thread
From: Edward Liaw via ltp @ 2023-11-02 23:00 UTC (permalink / raw)
  To: ltp; +Cc: kernel-team

Android does not have the /etc/mtab symlink, so trying to open it fails
with TBROK.  Replace it with /proc/mounts.

Signed-off-by: Edward Liaw <edliaw@google.com>
---
 testcases/kernel/syscalls/madvise/madvise11.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/madvise/madvise11.c b/testcases/kernel/syscalls/madvise/madvise11.c
index 0793319d2..55556f530 100644
--- a/testcases/kernel/syscalls/madvise/madvise11.c
+++ b/testcases/kernel/syscalls/madvise/madvise11.c
@@ -308,9 +308,9 @@ static int open_unpoison_pfn(void)
 		SAFE_CMD(cmd_modprobe, NULL, NULL);
 
 	/* debugfs mount point */
-	mntf = setmntent("/etc/mtab", "r");
+	mntf = setmntent("/proc/mounts", "r");
 	if (!mntf) {
-		tst_brk(TBROK | TERRNO, "Can't open /etc/mtab");
+		tst_brk(TBROK | TERRNO, "Can't open /proc/mounts");
 		return -1;
 	}
 	while ((mnt = getmntent(mntf)) != NULL) {
-- 
2.42.0.869.gea05f2083d-goog


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] madvise11: Replace /etc/mtab with /proc/mounts
  2023-11-02 23:00 ` [LTP] [PATCH] madvise11: Replace /etc/mtab with /proc/mounts Edward Liaw via ltp
@ 2023-11-03  8:29   ` Petr Vorel
  2023-11-03  8:38     ` Petr Vorel
  0 siblings, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2023-11-03  8:29 UTC (permalink / raw)
  To: Edward Liaw; +Cc: kernel-team, ltp

Hi Edward,

> Android does not have the /etc/mtab symlink, so trying to open it fails
> with TBROK.  Replace it with /proc/mounts.

Thanks!

Reviewed-by: Petr Vorel <pvorel@suse.cz>

BTW there are other tests which mention /etc/mtab, but only as tst_resm(TINFO, )
message.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] madvise11: Replace /etc/mtab with /proc/mounts
  2023-11-03  8:29   ` Petr Vorel
@ 2023-11-03  8:38     ` Petr Vorel
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2023-11-03  8:38 UTC (permalink / raw)
  To: Edward Liaw, kernel-team, ltp

Hi Edward,

merged, thanks!

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] madvise11: Allow test to skip if MADV_SOFT_OFFLINE is not supported
  2023-11-02 23:00 [LTP] [PATCH] madvise11: Allow test to skip if MADV_SOFT_OFFLINE is not supported Edward Liaw via ltp
  2023-11-02 23:00 ` [LTP] [PATCH] madvise11: Replace /etc/mtab with /proc/mounts Edward Liaw via ltp
@ 2023-11-03 10:47 ` Cyril Hrubis
  2023-11-03 15:54   ` Edward Liaw via ltp
  1 sibling, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2023-11-03 10:47 UTC (permalink / raw)
  To: Edward Liaw; +Cc: kernel-team, ltp

Hi!
> madvise11 will exit with TFAIL if CONFIG_MEMORY_FAILURE is not
> configured.  Skip the TFAIL if EINVAL is returned by madvise.

Does it make sense to keep the test running if the config option is not
present? As far as I can tell we are trying to reproduce a race there
that depends on the madvise being able to soft offline the pages.

What about this then?

diff --git a/testcases/kernel/syscalls/madvise/madvise11.c b/testcases/kernel/syscalls/madvise/madvise11.c
index 74caadc44..50ab935c9 100644
--- a/testcases/kernel/syscalls/madvise/madvise11.c
+++ b/testcases/kernel/syscalls/madvise/madvise11.c
@@ -426,6 +426,10 @@ static struct tst_test test = {
                "rmmod",
                NULL
        },
+       .needs_kconfigs = (const char *[]) {
+                "CONFIG_MEMORY_FAILURE=y",
+                NULL
+        },
        .max_runtime = 30,
        .needs_checkpoints = 1,
        .setup = setup,


-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] madvise11: Allow test to skip if MADV_SOFT_OFFLINE is not supported
  2023-11-03 10:47 ` [LTP] [PATCH] madvise11: Allow test to skip if MADV_SOFT_OFFLINE is not supported Cyril Hrubis
@ 2023-11-03 15:54   ` Edward Liaw via ltp
  0 siblings, 0 replies; 6+ messages in thread
From: Edward Liaw via ltp @ 2023-11-03 15:54 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: kernel-team, ltp

Hi Cyril,

On Fri, Nov 3, 2023 at 3:47 AM Cyril Hrubis <chrubis@suse.cz> wrote:
>
> Hi!
> > madvise11 will exit with TFAIL if CONFIG_MEMORY_FAILURE is not
> > configured.  Skip the TFAIL if EINVAL is returned by madvise.
>
> Does it make sense to keep the test running if the config option is not
> present? As far as I can tell we are trying to reproduce a race there
> that depends on the madvise being able to soft offline the pages.
>
> What about this then?
>
> diff --git a/testcases/kernel/syscalls/madvise/madvise11.c b/testcases/kernel/syscalls/madvise/madvise11.c
> index 74caadc44..50ab935c9 100644
> --- a/testcases/kernel/syscalls/madvise/madvise11.c
> +++ b/testcases/kernel/syscalls/madvise/madvise11.c
> @@ -426,6 +426,10 @@ static struct tst_test test = {
>                 "rmmod",
>                 NULL
>         },
> +       .needs_kconfigs = (const char *[]) {
> +                "CONFIG_MEMORY_FAILURE=y",
> +                NULL
> +        },
>         .max_runtime = 30,
>         .needs_checkpoints = 1,
>         .setup = setup,
>
>
> --

Yeah, that makes more sense to me.

> Cyril Hrubis
> chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-11-03 15:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-02 23:00 [LTP] [PATCH] madvise11: Allow test to skip if MADV_SOFT_OFFLINE is not supported Edward Liaw via ltp
2023-11-02 23:00 ` [LTP] [PATCH] madvise11: Replace /etc/mtab with /proc/mounts Edward Liaw via ltp
2023-11-03  8:29   ` Petr Vorel
2023-11-03  8:38     ` Petr Vorel
2023-11-03 10:47 ` [LTP] [PATCH] madvise11: Allow test to skip if MADV_SOFT_OFFLINE is not supported Cyril Hrubis
2023-11-03 15:54   ` Edward Liaw via ltp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox