public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] numa_helper: don't break is_numa() with TCONF
@ 2016-02-22 14:03 Jan Stancek
  2016-02-22 14:26 ` Cyril Hrubis
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Stancek @ 2016-02-22 14:03 UTC (permalink / raw)
  To: ltp





----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp@lists.linux.it
> Sent: Monday, 22 February, 2016 2:25:22 PM
> Subject: Re: [LTP] [PATCH] numa_helper: don't break is_numa() with TCONF
> 
> Hi!
> > > And the same for is_numa(), it calls tst_brkm(TBROK | TERRNO, ...) in
> > > case that get_allowed_nodes_arr() returned non-zero.
> > 
> > If get_allowed_nodes_arr() returned non-zero because of get_mempolicy,
> > that means get_mempolicy is implemented but failed. I think that
> > justifies TBROK.
> 
> Now I'm confused. You said that the syscall can exit -1 and ENOSYS.

Correct, get_mempolicy is not implemented on aarch64.

> In that case the filter_nodemask_mem() returns -2 which is propagated from
> get_allowed_nodes_arr() to is_numa() where the test ends with TBROK
> rather than with TCONF.

It won't return -2 for ENOSYS, because of this line:
+        if (ret < 0 && errno != ENOSYS)
                 return -2;

> Or did I miss something?

I didn't make it clear in commit message that patch now silently ignores ENOSYS
from get_mempolicy. In this case get_allowed_nodes should return success, but
returned node set should be empty (I'll double check that this is the case on aarch64).

> 
> --
> Cyril Hrubis
> chrubis@suse.cz
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [LTP] [PATCH] numa_helper: don't break is_numa() with TCONF
@ 2016-02-19 15:02 Jan Stancek
  2016-02-22 11:36 ` Cyril Hrubis
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Stancek @ 2016-02-19 15:02 UTC (permalink / raw)
  To: ltp

Li reported, that some oom tests on aarch64 exit with TCONF
during is_numa() call, because get_mempolicy syscall is not
implemented. And because numa_helper used ltp_syscall() it
terminated the test in all instances.

Switch to syscall() and let the tests decide what should happen
if system doesn't support NUMA.

Reported-by: Li Wang <liwang@redhat.com>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/lib/numa_helper.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/lib/numa_helper.c b/testcases/kernel/lib/numa_helper.c
index 0074180991ec..91214fcd85d9 100644
--- a/testcases/kernel/lib/numa_helper.c
+++ b/testcases/kernel/lib/numa_helper.c
@@ -76,14 +76,22 @@ static int filter_nodemask_mem(nodemask_t * nodemask, unsigned long max_node)
 {
 #if MPOL_F_MEMS_ALLOWED
 	unsigned long nodemask_size = max_node / 8;
+	int ret;
+
 	memset(nodemask, 0, nodemask_size);
 	/*
 	 * avoid numa_get_mems_allowed(), because of bug in getpol()
 	 * utility function in older versions:
 	 * http://www.spinics.net/lists/linux-numa/msg00849.html
 	 */
-	if (ltp_syscall(__NR_get_mempolicy, NULL, nodemask->n,
-		    max_node, 0, MPOL_F_MEMS_ALLOWED) < 0)
+	ret = syscall(__NR_get_mempolicy, NULL, nodemask->n,
+		    max_node, 0, MPOL_F_MEMS_ALLOWED);
+	/*
+	 * If we don't have __NR_get_mempolicy assume we can use all
+	 * present nodes. It is likely this is a system, that doesn't
+	 * support NUMA and there's just 1 node.
+	 */
+	if (ret < 0 && errno != ENOSYS)
 		return -2;
 #else
 	int i;
-- 
1.8.3.1


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

end of thread, other threads:[~2016-02-22 15:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22 14:03 [LTP] [PATCH] numa_helper: don't break is_numa() with TCONF Jan Stancek
2016-02-22 14:26 ` Cyril Hrubis
2016-02-22 15:35   ` Jan Stancek
  -- strict thread matches above, loose matches on Subject: below --
2016-02-19 15:02 Jan Stancek
2016-02-22 11:36 ` Cyril Hrubis
2016-02-22 12:46   ` Jan Stancek
2016-02-22 13:25     ` Cyril Hrubis

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