public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v4 00/14] Fix 32-bit cross compilation
@ 2017-10-16 15:41 Petr Vorel
  2017-10-16 15:41 ` [LTP] [PATCH v4 01/14] lapi/keyctl.h: Add doc and reorder definitions Petr Vorel
                   ` (13 more replies)
  0 siblings, 14 replies; 17+ messages in thread
From: Petr Vorel @ 2017-10-16 15:41 UTC (permalink / raw)
  To: ltp

Changes v3->v4:
Work even more on NUMA detection & cleanup dependencies. I simplified NUMA
related checks in C code.

I tried to test it well, but comments and build checks by others are welcome.

To test it, run both 32bit cross-compilation build:
./configure "CFLAGS=-m32" "CXXFLAGS=-m32" LDFLAGS="-m32" && make && make install
(Well, we don't really need CXXFLAGS)

And normal non-cross-compilation build:
./configure && make && make install

NOTE: you can see/clone this change-set in
https://github.com/pevik/ltp/tree/autotools/fix-32bit-build.v4

Kind regards,
Petr

Petr Vorel (14):
  lapi/keyctl.h: Add doc and reorder definitions
  syscalls/request_key: Port to use lapi/keyctl.h header
  m4: Fix libkeyutils detection on 32-bit cross build
  m4: Fix libaio detection on 32-bit cross build
  make: Remove workarounds for build without libnuma
  numa: Drop NUMA API v1 support
  numa: Drop NUMA_CPPFLAGS
  hotplug/memory_hotplug: Update TODO
  hotplug/memory_hotplug: Remove unused header
  hotplug/memory_hotplug: Exit with TCONF when NUMA headers not
    available
  m4,kernel/lib: Detect libnuma presence in kernel libs
  numa: Check for API >= v2 with autoconf
  numa: Remove HAVE_NUMA_ALLOC_ONNODE definition
  numa: Remove HAVE_NUMA_MOVE_PAGES definition

 configure.ac                                       |  1 +
 include/config.h.default                           |  3 -
 include/lapi/keyctl.h                              | 66 ++++++++++++---------
 include/mk/config.mk.default                       |  1 -
 include/mk/config.mk.in                            |  1 -
 m4/ltp-eventfd.m4                                  | 28 +++++----
 m4/ltp-keyutils.m4                                 |  9 ++-
 m4/ltp-numa.m4                                     | 42 ++++++-------
 .../controllers/cpuset/cpuset_lib/libcpuset.c      |  1 +
 .../cpuset/cpuset_syscall_test/Makefile            |  1 -
 .../cpuset_syscall_test/cpuset_syscall_test.c      |  5 +-
 testcases/kernel/hotplug/memory_hotplug/TODO       |  5 --
 testcases/kernel/hotplug/memory_hotplug/commands.c | 17 ++----
 testcases/kernel/hotplug/memory_hotplug/memtoy.c   | 18 ++++--
 testcases/kernel/hotplug/memory_hotplug/segment.c  |  7 ++-
 testcases/kernel/include/lib.mk                    |  2 +-
 testcases/kernel/include/numa_helper.h             |  2 +-
 testcases/kernel/io/aio/aio01/aio01.c              | 23 ++++----
 testcases/kernel/io/aio/aio02/aio_tio.c            |  3 +-
 testcases/kernel/io/aio/aio02/main.c               |  8 +--
 testcases/kernel/io/ltp-aiodio/aio-stress.c        | 15 ++++-
 testcases/kernel/io/ltp-aiodio/aiocp.c             |  7 +--
 testcases/kernel/io/ltp-aiodio/aiodio_append.c     | 14 ++++-
 testcases/kernel/io/ltp-aiodio/aiodio_sparse.c     | 18 ++++--
 testcases/kernel/lib/Makefile                      |  3 +-
 testcases/kernel/lib/numa_helper.c                 | 25 +++-----
 testcases/kernel/mem/cpuset/cpuset01.c             | 11 ++--
 testcases/kernel/mem/ksm/ksm02.c                   | 10 ++--
 testcases/kernel/mem/ksm/ksm04.c                   | 10 ++--
 testcases/kernel/mem/ksm/ksm06.c                   | 13 +++--
 testcases/kernel/mem/lib/mem.c                     | 13 ++---
 testcases/kernel/mem/oom/oom02.c                   | 11 ++--
 testcases/kernel/mem/oom/oom03.c                   | 10 +++-
 testcases/kernel/mem/oom/oom04.c                   | 11 ++--
 testcases/kernel/mem/oom/oom05.c                   | 11 ++--
 testcases/kernel/mem/vma/vma02.c                   | 16 ++---
 testcases/kernel/mem/vma/vma04.c                   | 15 ++---
 testcases/kernel/numa/Makefile                     |  2 +-
 testcases/kernel/syscalls/eventfd/eventfd01.c      | 16 +++--
 .../syscalls/get_mempolicy/get_mempolicy01.c       | 41 ++-----------
 testcases/kernel/syscalls/io_cancel/io_cancel01.c  | 12 ++--
 .../kernel/syscalls/io_destroy/io_destroy01.c      | 12 ++--
 .../kernel/syscalls/io_getevents/io_getevents01.c  | 13 +++--
 testcases/kernel/syscalls/io_setup/io_setup01.c    | 12 ++--
 testcases/kernel/syscalls/io_submit/io_submit01.c  | 11 ++--
 testcases/kernel/syscalls/mbind/Makefile           |  9 ---
 testcases/kernel/syscalls/mbind/mbind01.c          | 11 ++--
 testcases/kernel/syscalls/migrate_pages/Makefile   |  3 -
 .../syscalls/migrate_pages/migrate_pages01.c       |  9 +--
 .../syscalls/migrate_pages/migrate_pages02.c       | 10 ++--
 testcases/kernel/syscalls/move_pages/Makefile      |  5 --
 .../kernel/syscalls/move_pages/move_pages01.c      |  4 +-
 .../kernel/syscalls/move_pages/move_pages02.c      |  4 +-
 .../kernel/syscalls/move_pages/move_pages03.c      |  4 +-
 .../kernel/syscalls/move_pages/move_pages04.c      |  4 +-
 .../kernel/syscalls/move_pages/move_pages05.c      |  4 +-
 .../kernel/syscalls/move_pages/move_pages06.c      |  4 +-
 .../kernel/syscalls/move_pages/move_pages07.c      |  4 +-
 .../kernel/syscalls/move_pages/move_pages08.c      |  4 +-
 .../kernel/syscalls/move_pages/move_pages09.c      |  4 +-
 .../kernel/syscalls/move_pages/move_pages10.c      |  4 +-
 .../kernel/syscalls/move_pages/move_pages11.c      |  4 +-
 .../kernel/syscalls/move_pages/move_pages12.c      |  4 +-
 .../syscalls/move_pages/move_pages_support.c       | 18 +++---
 .../kernel/syscalls/request_key/request_key01.c    | 62 +++++++++-----------
 .../kernel/syscalls/request_key/request_key02.c    | 68 +++++++++-------------
 66 files changed, 396 insertions(+), 422 deletions(-)

-- 
2.14.2


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

* [LTP] [PATCH v4 01/14] lapi/keyctl.h: Add doc and reorder definitions
  2017-10-16 15:41 [LTP] [PATCH v4 00/14] Fix 32-bit cross compilation Petr Vorel
@ 2017-10-16 15:41 ` Petr Vorel
  2017-10-16 15:41 ` [LTP] [PATCH v4 02/14] syscalls/request_key: Port to use lapi/keyctl.h header Petr Vorel
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Petr Vorel @ 2017-10-16 15:41 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 include/lapi/keyctl.h | 55 +++++++++++++++++++++++++++------------------------
 1 file changed, 29 insertions(+), 26 deletions(-)

diff --git a/include/lapi/keyctl.h b/include/lapi/keyctl.h
index 73f4fdc90..f3fb0c347 100644
--- a/include/lapi/keyctl.h
+++ b/include/lapi/keyctl.h
@@ -65,12 +65,35 @@ static inline long keyctl(int cmd, ...)
 }
 #endif /* HAVE_KEYUTILS_H */
 
-#ifndef KEYCTL_GET_KEYRING_ID
-# define KEYCTL_GET_KEYRING_ID 0
+/* special process keyring shortcut IDs */
+#ifndef KEY_SPEC_THREAD_KEYRING
+# define KEY_SPEC_THREAD_KEYRING -1
 #endif
 
-#ifndef KEYCTL_SET_REQKEY_KEYRING
-# define KEYCTL_SET_REQKEY_KEYRING 14
+#ifndef KEY_SPEC_PROCESS_KEYRING
+# define KEY_SPEC_PROCESS_KEYRING -2
+#endif
+
+#ifndef KEY_SPEC_SESSION_KEYRING
+# define KEY_SPEC_SESSION_KEYRING -3
+#endif
+
+#ifndef KEY_SPEC_USER_KEYRING
+# define KEY_SPEC_USER_KEYRING -4
+#endif
+
+
+#ifndef KEY_SPEC_USER_SESSION_KEYRING
+# define KEY_SPEC_USER_SESSION_KEYRING -5
+#endif
+/* request-key default keyrings */
+#ifndef KEY_REQKEY_DEFL_THREAD_KEYRING
+# define KEY_REQKEY_DEFL_THREAD_KEYRING 1
+#endif
+
+/* keyctl commands */
+#ifndef KEYCTL_GET_KEYRING_ID
+# define KEYCTL_GET_KEYRING_ID 0
 #endif
 
 #ifndef KEYCTL_JOIN_SESSION_KEYRING
@@ -97,28 +120,8 @@ static inline long keyctl(int cmd, ...)
 # define KEYCTL_READ 11
 #endif
 
-#ifndef KEY_SPEC_THREAD_KEYRING
-# define KEY_SPEC_THREAD_KEYRING -1
-#endif
-
-#ifndef KEY_SPEC_PROCESS_KEYRING
-# define KEY_SPEC_PROCESS_KEYRING -2
-#endif
-
-#ifndef KEY_SPEC_SESSION_KEYRING
-# define KEY_SPEC_SESSION_KEYRING -3
-#endif
-
-#ifndef KEY_SPEC_USER_KEYRING
-# define KEY_SPEC_USER_KEYRING -4
-#endif
-
-#ifndef KEY_SPEC_USER_SESSION_KEYRING
-# define KEY_SPEC_USER_SESSION_KEYRING -5
-#endif
-
-#ifndef KEY_REQKEY_DEFL_THREAD_KEYRING
-# define KEY_REQKEY_DEFL_THREAD_KEYRING 1
+#ifndef KEYCTL_SET_REQKEY_KEYRING
+# define KEYCTL_SET_REQKEY_KEYRING 14
 #endif
 
 #endif	/* KEYCTL_H__ */
-- 
2.14.2


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

* [LTP] [PATCH v4 02/14] syscalls/request_key: Port to use lapi/keyctl.h header
  2017-10-16 15:41 [LTP] [PATCH v4 00/14] Fix 32-bit cross compilation Petr Vorel
  2017-10-16 15:41 ` [LTP] [PATCH v4 01/14] lapi/keyctl.h: Add doc and reorder definitions Petr Vorel
@ 2017-10-16 15:41 ` Petr Vorel
  2017-10-16 15:41 ` [LTP] [PATCH v4 03/14] m4: Fix libkeyutils detection on 32-bit cross build Petr Vorel
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Petr Vorel @ 2017-10-16 15:41 UTC (permalink / raw)
  To: ltp

+ minor whitespace cleanup

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 include/lapi/keyctl.h                              |  9 +++
 .../kernel/syscalls/request_key/request_key01.c    | 62 +++++++++-----------
 .../kernel/syscalls/request_key/request_key02.c    | 68 +++++++++-------------
 3 files changed, 64 insertions(+), 75 deletions(-)

diff --git a/include/lapi/keyctl.h b/include/lapi/keyctl.h
index f3fb0c347..07c6a6dce 100644
--- a/include/lapi/keyctl.h
+++ b/include/lapi/keyctl.h
@@ -86,11 +86,16 @@ static inline long keyctl(int cmd, ...)
 #ifndef KEY_SPEC_USER_SESSION_KEYRING
 # define KEY_SPEC_USER_SESSION_KEYRING -5
 #endif
+
 /* request-key default keyrings */
 #ifndef KEY_REQKEY_DEFL_THREAD_KEYRING
 # define KEY_REQKEY_DEFL_THREAD_KEYRING 1
 #endif
 
+#ifndef KEY_REQKEY_DEFL_DEFAULT
+# define KEY_REQKEY_DEFL_DEFAULT	0
+#endif
+
 /* keyctl commands */
 #ifndef KEYCTL_GET_KEYRING_ID
 # define KEYCTL_GET_KEYRING_ID 0
@@ -124,4 +129,8 @@ static inline long keyctl(int cmd, ...)
 # define KEYCTL_SET_REQKEY_KEYRING 14
 #endif
 
+#ifndef KEYCTL_SET_TIMEOUT
+# define KEYCTL_SET_TIMEOUT 15
+#endif
+
 #endif	/* KEYCTL_H__ */
diff --git a/testcases/kernel/syscalls/request_key/request_key01.c b/testcases/kernel/syscalls/request_key/request_key01.c
index d46bafac0..d290a0de7 100644
--- a/testcases/kernel/syscalls/request_key/request_key01.c
+++ b/testcases/kernel/syscalls/request_key/request_key01.c
@@ -1,40 +1,36 @@
 /*
-* Copyright (c) 2016 Fujitsu Ltd.
-* Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it would be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*
-* You should have received a copy of the GNU General Public License
-* alone with this program.
-*/
+ * Copyright (c) 2016 Fujitsu Ltd.
+ * Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
+ *
+ * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License
+ * alone with this program.
+ */
 
 /*
-* Test Name: request_key01
-*
-* Description:
-* The testcase checks basic functionality of the request_key(2).
-* request_key(2) asks the kernel to find a key which matches the
-* specified description. If successful, it attaches it to the
-* nominated keyring and returns its serial number.
-*
-*/
+ * Test Name: request_key01
+ *
+ * Description:
+ * The testcase checks basic functionality of the request_key(2).
+ * request_key(2) asks the kernel to find a key which matches the
+ * specified description. If successful, it attaches it to the
+ * nominated keyring and returns its serial number.
+ *
+ */
 
-#include "config.h"
 #include <errno.h>
-#include <sys/types.h>
-#ifdef HAVE_KEYUTILS_H
-# include <keyutils.h>
-#endif
 
 #include "tst_test.h"
-
-#ifdef HAVE_KEYUTILS_H
+#include "lapi/keyctl.h"
 
 static int key;
 
@@ -64,9 +60,3 @@ static struct tst_test test = {
 	.setup = setup,
 	.test_all = verify_request_key,
 };
-
-#else
-
-TST_TEST_TCONF("keyutils.h was missing at compilation");
-
-#endif /* HAVE_LINUX_KEYCTL_H */
diff --git a/testcases/kernel/syscalls/request_key/request_key02.c b/testcases/kernel/syscalls/request_key/request_key02.c
index 9bba24119..bde74c492 100644
--- a/testcases/kernel/syscalls/request_key/request_key02.c
+++ b/testcases/kernel/syscalls/request_key/request_key02.c
@@ -1,43 +1,39 @@
 /*
-* Copyright (c) 2016 Fujitsu Ltd.
-* Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it would be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*
-* You should have received a copy of the GNU General Public License
-* alone with this program.
+ * Copyright (c) 2016 Fujitsu Ltd.
+ * Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
+ *
+ * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License
+ * alone with this program.
 */
 
 /*
-* Test Name: request_key02
-*
-* Description:
-* 1) request_key(2) fails if no matching key was found.
-* 2) request_key(2) fails if A revoked key was found.
-* 3) request_key(2) fails if An expired key was found.
-*
-* Expected Result:
-* 1) request_key(2) should return -1 and set errno to ENOKEY.
-* 2) request_key(2) should return -1 and set errno to EKEYREVOKED.
-* 3) request_key(2) should return -1 and set errno to EKEYEXPIRED.
-*
-*/
+ * Test Name: request_key02
+ *
+ * Description:
+ * 1) request_key(2) fails if no matching key was found.
+ * 2) request_key(2) fails if A revoked key was found.
+ * 3) request_key(2) fails if An expired key was found.
+ *
+ * Expected Result:
+ * 1) request_key(2) should return -1 and set errno to ENOKEY.
+ * 2) request_key(2) should return -1 and set errno to EKEYREVOKED.
+ * 3) request_key(2) should return -1 and set errno to EKEYEXPIRED.
+ */
 
-#include "config.h"
 #include <errno.h>
-#include <sys/types.h>
-#ifdef HAVE_KEYUTILS_H
-# include <keyutils.h>
-#endif
-#include "tst_test.h"
 
-#ifdef HAVE_KEYUTILS_H
+#include "tst_test.h"
+#include "lapi/keyctl.h"
 
 static int key1;
 static int key2;
@@ -111,9 +107,3 @@ static struct tst_test test = {
 	.tcnt = ARRAY_SIZE(tcases),
 	.test = verify_request_key,
 };
-
-#else
-
-TST_TEST_TCONF("keyutils.h was missing at compilation");
-
-#endif /* HAVE_LINUX_KEYCTL_H */
-- 
2.14.2


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

* [LTP] [PATCH v4 03/14] m4: Fix libkeyutils detection on 32-bit cross build
  2017-10-16 15:41 [LTP] [PATCH v4 00/14] Fix 32-bit cross compilation Petr Vorel
  2017-10-16 15:41 ` [LTP] [PATCH v4 01/14] lapi/keyctl.h: Add doc and reorder definitions Petr Vorel
  2017-10-16 15:41 ` [LTP] [PATCH v4 02/14] syscalls/request_key: Port to use lapi/keyctl.h header Petr Vorel
@ 2017-10-16 15:41 ` Petr Vorel
  2017-10-17 12:42   ` Cyril Hrubis
  2017-10-16 15:41 ` [LTP] [PATCH v4 04/14] m4: Fix libaio " Petr Vorel
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 17+ messages in thread
From: Petr Vorel @ 2017-10-16 15:41 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 configure.ac          | 1 +
 include/lapi/keyctl.h | 6 ++++--
 m4/ltp-keyutils.m4    | 9 ++++++---
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 78d9da680..2356531cd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,7 @@ AC_PREFIX_DEFAULT(/opt/ltp)
 
 AC_CHECK_HEADERS([ \
     ifaddrs.h \
+    keyutils.h \
     libaio.h \
     linux/can.h \
     linux/genetlink.h \
diff --git a/include/lapi/keyctl.h b/include/lapi/keyctl.h
index 07c6a6dce..8e6beac0e 100644
--- a/include/lapi/keyctl.h
+++ b/include/lapi/keyctl.h
@@ -19,12 +19,14 @@
 #define KEYCTL_H__
 
 #include "config.h"
-#ifdef HAVE_KEYUTILS_H
+
+#if defined(HAVE_KEYUTILS_H) && defined(HAVE_LIBKEYUTILS)
 # include <keyutils.h>
 #else
 # ifdef HAVE_LINUX_KEYCTL_H
 #  include <linux/keyctl.h>
 # endif /* HAVE_LINUX_KEYCTL_H */
+
 # include <stdarg.h>
 # include <stdint.h>
 # include "lapi/syscalls.h"
@@ -63,7 +65,7 @@ static inline long keyctl(int cmd, ...)
 
 	return tst_syscall(__NR_keyctl, cmd, arg2, arg3, arg4, arg5);
 }
-#endif /* HAVE_KEYUTILS_H */
+#endif /* defined(HAVE_KEYUTILS_H) && defined(HAVE_LIBKEYUTILS) */
 
 /* special process keyring shortcut IDs */
 #ifndef KEY_SPEC_THREAD_KEYRING
diff --git a/m4/ltp-keyutils.m4 b/m4/ltp-keyutils.m4
index 74b7d3249..f63c44592 100644
--- a/m4/ltp-keyutils.m4
+++ b/m4/ltp-keyutils.m4
@@ -1,5 +1,7 @@
 dnl
 dnl Copyright (c) 2016 Fujitsu Ltd.
+dnl Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
+dnl
 dnl Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
 dnl
 dnl This program is free software; you can redistribute it and/or modify it
@@ -18,7 +20,8 @@ dnl
 dnl LTP_CHECK_KEYUTILS_SUPPORT
 dnl ----------------------------
 dnl
-AC_DEFUN([LTP_CHECK_KEYUTILS_SUPPORT],[
-AC_CHECK_HEADERS([keyutils.h], [keyutils_libs="-lkeyutils"])
-AC_SUBST([KEYUTILS_LIBS], [$keyutils_libs])
+AC_DEFUN([LTP_CHECK_KEYUTILS_SUPPORT], [
+	AC_CHECK_LIB([keyutils], [add_key],
+	[AC_DEFINE(HAVE_LIBKEYUTILS, 1, [Define to 1 if you have libkeyutils installed.]),
+	      AC_SUBST(KEYUTILS_LIBS, "-lkeyutils")])
 ])
-- 
2.14.2


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

* [LTP] [PATCH v4 04/14] m4: Fix libaio detection on 32-bit cross build
  2017-10-16 15:41 [LTP] [PATCH v4 00/14] Fix 32-bit cross compilation Petr Vorel
                   ` (2 preceding siblings ...)
  2017-10-16 15:41 ` [LTP] [PATCH v4 03/14] m4: Fix libkeyutils detection on 32-bit cross build Petr Vorel
@ 2017-10-16 15:41 ` Petr Vorel
  2017-10-17 13:29   ` Cyril Hrubis
  2017-10-16 15:41 ` [LTP] [PATCH v4 05/14] make: Remove workarounds for build without libnuma Petr Vorel
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 17+ messages in thread
From: Petr Vorel @ 2017-10-16 15:41 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 m4/ltp-eventfd.m4                                  | 28 ++++++++++------------
 testcases/kernel/io/aio/aio01/aio01.c              | 23 ++++++++----------
 testcases/kernel/io/aio/aio02/aio_tio.c            |  3 +--
 testcases/kernel/io/aio/aio02/main.c               |  8 +++----
 testcases/kernel/io/ltp-aiodio/aio-stress.c        | 15 ++++++++++--
 testcases/kernel/io/ltp-aiodio/aiocp.c             |  7 ++----
 testcases/kernel/io/ltp-aiodio/aiodio_append.c     | 14 +++++++++--
 testcases/kernel/io/ltp-aiodio/aiodio_sparse.c     | 18 ++++++++++----
 testcases/kernel/syscalls/eventfd/eventfd01.c      | 16 +++++++++----
 testcases/kernel/syscalls/io_cancel/io_cancel01.c  | 12 ++++++----
 .../kernel/syscalls/io_destroy/io_destroy01.c      | 12 ++++++----
 .../kernel/syscalls/io_getevents/io_getevents01.c  | 13 +++++-----
 testcases/kernel/syscalls/io_setup/io_setup01.c    | 12 ++++++----
 testcases/kernel/syscalls/io_submit/io_submit01.c  | 11 +++++----
 14 files changed, 114 insertions(+), 78 deletions(-)

diff --git a/m4/ltp-eventfd.m4 b/m4/ltp-eventfd.m4
index 923b9bde3..4ed7efec6 100644
--- a/m4/ltp-eventfd.m4
+++ b/m4/ltp-eventfd.m4
@@ -16,28 +16,26 @@ dnl along with this program;  if not, write to the Free Software
 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 dnl
 dnl Author: Masatake YAMATO <yamato@redhat.com>
+dnl Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
 dnl
 
 dnl
 dnl LTP_CHECK_SYSCALL_EVENTFD
 dnl ----------------------------
 dnl
-AC_DEFUN([LTP_CHECK_SYSCALL_EVENTFD],
-[dnl
-AH_TEMPLATE(HAVE_IO_SET_EVENTFD,
-[Define to 1 if you have the `io_set_eventfd' function.])
-AC_CHECK_HEADERS(libaio.h,[
-	AC_CHECK_LIB(aio,io_setup,[
-		AIO_LIBS="-laio"
-		AC_MSG_CHECKING([io_set_eventfd is defined in aio library or aio header])
+AC_DEFUN([LTP_CHECK_SYSCALL_EVENTFD], [
+	AC_CHECK_HEADERS(libaio.h, [have_libaio=yes])
+	AC_CHECK_LIB(aio, io_setup, [have_aio=yes])
+
+	if test "x$have_libaio" = "xyes" -a "x$have_aio" = "xyes"; then
+		AC_DEFINE(HAVE_LIBAIO, 1, [Define to 1 if you have libaio and it's headers installed.])
+		AC_SUBST(AIO_LIBS, "-laio")
+
+		AC_TRY_LINK(... AC_DEFINE(HAVE_IO_SET_EVENTFD) ...)
 		AC_TRY_LINK([#include <stdio.h>
                              #include <libaio.h>
 		            ],
-                            [io_set_eventfd(NULL, 0); return 0;
-			    ],
-			    [AC_DEFINE(HAVE_IO_SET_EVENTFD)
-			     AC_MSG_RESULT(yes)],
-                            [AC_MSG_RESULT(no)])],
-		AIO_LIBS="")])
-AC_SUBST(AIO_LIBS)
+		            [io_set_eventfd(NULL, 0); return 0;],
+		            [AC_DEFINE(HAVE_IO_SET_EVENTFD, 1, [Define to 1 if you have `io_set_eventfd' function.])])
+	fi
 ])
diff --git a/testcases/kernel/io/aio/aio01/aio01.c b/testcases/kernel/io/aio/aio01/aio01.c
index 2829b2485..ba23e226c 100644
--- a/testcases/kernel/io/aio/aio01/aio01.c
+++ b/testcases/kernel/io/aio/aio01/aio01.c
@@ -47,26 +47,26 @@
 
 #define _XOPEN_SOURCE 600
 
-#include "test.h"
-#include "config.h"
-
-char *TCID = "aio01";
-int TST_TOTAL = 6;
-
-#ifdef HAVE_LIBAIO_H
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <time.h>
 #include <errno.h>
-#include <libaio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 
+#include "test.h"
+#include "config.h"
+
+char *TCID = "aio01";
+int TST_TOTAL = 6;
+
+#ifdef HAVE_LIBAIO
+#include <libaio.h>
+
 static void help(void);
 static void setup(void);
 static void cleanup(void);
@@ -413,14 +413,11 @@ static void cleanup(void)
 	close(fd);
 	io_queue_release(io_ctx);
 	tst_rmdir();
-
 }
 
 #else
-
 int main(void)
 {
-	tst_brkm(TCONF, NULL, "libaio missing");
+	tst_brkm(TCONF, NULL, "test requires libaio and it's development packages");
 }
-
 #endif
diff --git a/testcases/kernel/io/aio/aio02/aio_tio.c b/testcases/kernel/io/aio/aio02/aio_tio.c
index 34fa9ed51..08fb04162 100644
--- a/testcases/kernel/io/aio/aio02/aio_tio.c
+++ b/testcases/kernel/io/aio/aio02/aio_tio.c
@@ -37,7 +37,7 @@
 #include <string.h>
 #include <errno.h>
 
-#if HAVE_LIBAIO_H
+#ifdef HAVE_LIBAIO
 
 #define AIO_MAXIO 32
 #define AIO_BLKSIZE (64*1024)
@@ -237,5 +237,4 @@ int test_main(void)
 
 	return status;
 }
-
 #endif
diff --git a/testcases/kernel/io/aio/aio02/main.c b/testcases/kernel/io/aio/aio02/main.c
index 24ec17181..7b157f31b 100644
--- a/testcases/kernel/io/aio/aio02/main.c
+++ b/testcases/kernel/io/aio/aio02/main.c
@@ -6,16 +6,16 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include "test.h"
+
 #include "config.h"
+#include "test.h"
 
 #define TEST_NAME "aio_tio"
 
 char *TCID = "aio02/" TEST_NAME;
 int TST_TOTAL = 0;
 
-#if HAVE_LIBAIO_H
-
+#ifdef HAVE_LIBAIO
 #include <libaio.h>
 
 int test_main(void);
@@ -32,6 +32,6 @@ int main(void)
 #else
 int main(void)
 {
-	tst_brkm(TCONF, NULL, "libaio missing");
+	tst_brkm(TCONF, NULL, "test requires libaio and it's development packages");
 }
 #endif
diff --git a/testcases/kernel/io/ltp-aiodio/aio-stress.c b/testcases/kernel/io/ltp-aiodio/aio-stress.c
index d6d7b0880..348f398db 100644
--- a/testcases/kernel/io/ltp-aiodio/aio-stress.c
+++ b/testcases/kernel/io/ltp-aiodio/aio-stress.c
@@ -50,19 +50,23 @@
 #include <errno.h>
 #include <assert.h>
 #include <stdlib.h>
-
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/time.h>
-#include <libaio.h>
 #include <sys/ipc.h>
 #include <sys/shm.h>
 #include <sys/mman.h>
 #include <string.h>
 #include <pthread.h>
 
+#include "config.h"
+#include "tst_res_flags.h"
+
+#ifdef HAVE_LIBAIO
+#include <libaio.h>
+
 #define IO_FREE 0
 #define IO_PENDING 1
 #define RUN_FOREVER -1
@@ -1557,3 +1561,10 @@ int main(int ac, char **av)
 	}
 	return status;
 }
+#else
+int main(void)
+{
+	fprintf(stderr, "test requires libaio and it's development packages\n");
+	return TCONF;
+}
+#endif
diff --git a/testcases/kernel/io/ltp-aiodio/aiocp.c b/testcases/kernel/io/ltp-aiodio/aiocp.c
index 93984bf28..d315353d0 100644
--- a/testcases/kernel/io/ltp-aiodio/aiocp.c
+++ b/testcases/kernel/io/ltp-aiodio/aiocp.c
@@ -38,8 +38,7 @@
 #include "config.h"
 #include "tst_res_flags.h"
 
-#if HAVE_LIBAIO_H
-
+#ifdef HAVE_LIBAIO
 #include <libaio.h>
 
 #define AIO_BLKSIZE	(64*1024)
@@ -600,11 +599,9 @@ int main(int argc, char *const *argv)
  */
 
 #else
-
 int main(void)
 {
-	fprintf(stderr, "System doesn't have libaio support.\n");
+	fprintf(stderr, "test requires libaio and it's development packages\n");
 	return TCONF;
 }
-
 #endif
diff --git a/testcases/kernel/io/ltp-aiodio/aiodio_append.c b/testcases/kernel/io/ltp-aiodio/aiodio_append.c
index 39a529fa3..5d97ed941 100644
--- a/testcases/kernel/io/ltp-aiodio/aiodio_append.c
+++ b/testcases/kernel/io/ltp-aiodio/aiodio_append.c
@@ -32,10 +32,14 @@
 #include <fcntl.h>
 #include <unistd.h>
 
-#include <libaio.h>
-
+#include "config.h"
 #include "test.h"
 
+char *TCID = "aiodio_append";
+
+#ifdef HAVE_LIBAIO
+#include <libaio.h>
+
 #define NUM_CHILDREN 8
 
 #include "common_checkzero.h"
@@ -174,3 +178,9 @@ int main(int argc, char **argv)
 
 	return 0;
 }
+#else
+int main(void)
+{
+	tst_brkm(TCONF, NULL, "test requires libaio and it's development packages");
+}
+#endif
diff --git a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c
index d40e45b1b..4767f49d2 100644
--- a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c
+++ b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c
@@ -35,11 +35,17 @@
 #include <limits.h>
 #include <getopt.h>
 
-#include <libaio.h>
 
+#include "config.h"
 #include "test.h"
 #include "safe_macros.h"
 
+char *TCID = "aiodio_sparse";
+int TST_TOTAL = 1;
+
+#ifdef HAVE_LIBAIO
+#include <libaio.h>
+
 #define NUM_CHILDREN 1000
 
 int debug;
@@ -49,9 +55,6 @@ static void setup(void);
 static void cleanup(void);
 static void usage(void);
 
-char *TCID = "aiodio_sparse";
-int TST_TOTAL = 1;
-
 #include "common_sparse.h"
 
 /*
@@ -325,3 +328,10 @@ static void cleanup(void)
 
 	tst_rmdir();
 }
+
+#else
+int main(void)
+{
+	tst_brkm(TCONF, NULL, "test requires libaio and it's development packages");
+}
+#endif
diff --git a/testcases/kernel/syscalls/eventfd/eventfd01.c b/testcases/kernel/syscalls/eventfd/eventfd01.c
index 37cca7d53..e4f9c804a 100644
--- a/testcases/kernel/syscalls/eventfd/eventfd01.c
+++ b/testcases/kernel/syscalls/eventfd/eventfd01.c
@@ -61,15 +61,14 @@
 #define CLEANUP cleanup
 #include "lapi/syscalls.h"
 
-#ifdef HAVE_LIBAIO_H
+TCID_DEFINE(eventfd01);
+int TST_TOTAL = 15;
+
+#ifdef HAVE_LIBAIO
 #include <libaio.h>
-#endif
 
 static void setup(void);
 
-TCID_DEFINE(eventfd01);
-int TST_TOTAL = 15;
-
 static int myeventfd(unsigned int initval, int flags)
 {
 	/* eventfd2 uses FLAGS but eventfd doesn't take FLAGS. */
@@ -727,3 +726,10 @@ static void cleanup(void)
 {
 	tst_rmdir();
 }
+
+#else
+int main(void)
+{
+	tst_brkm(TCONF, NULL, "test requires libaio and it's development packages");
+}
+#endif
diff --git a/testcases/kernel/syscalls/io_cancel/io_cancel01.c b/testcases/kernel/syscalls/io_cancel/io_cancel01.c
index 8d7ca2607..ed6af050b 100644
--- a/testcases/kernel/syscalls/io_cancel/io_cancel01.c
+++ b/testcases/kernel/syscalls/io_cancel/io_cancel01.c
@@ -21,6 +21,9 @@
 /* Porting from Crackerjack to LTP is done
    by Masatake YAMATO <yamato@redhat.com> */
 
+#include <errno.h>
+#include <string.h>
+
 #include "config.h"
 #include "test.h"
 
@@ -28,10 +31,8 @@ char *TCID = "io_cancel01";
 
 int TST_TOTAL = 1;
 
-#ifdef HAVE_LIBAIO_H
+#ifdef HAVE_LIBAIO
 #include <libaio.h>
-#include <errno.h>
-#include <string.h>
 
 static void cleanup(void)
 {
@@ -105,9 +106,10 @@ int main(int argc, char *argv[])
 	cleanup();
 	tst_exit();
 }
+
 #else
-int main(int argc, char *argv[])
+int main(void)
 {
-	tst_brkm(TCONF, NULL, "System doesn't have libaio support");
+	tst_brkm(TCONF, NULL, "test requires libaio and it's development packages");
 }
 #endif
diff --git a/testcases/kernel/syscalls/io_destroy/io_destroy01.c b/testcases/kernel/syscalls/io_destroy/io_destroy01.c
index 9de4987f4..88bef7ecf 100644
--- a/testcases/kernel/syscalls/io_destroy/io_destroy01.c
+++ b/testcases/kernel/syscalls/io_destroy/io_destroy01.c
@@ -21,6 +21,9 @@
 /* Porting from Crackerjack to LTP is done
    by Masatake YAMATO <yamato@redhat.com> */
 
+#include <errno.h>
+#include <string.h>
+
 #include "config.h"
 #include "test.h"
 
@@ -28,10 +31,8 @@ char *TCID = "io_destroy01";
 
 int TST_TOTAL = 1;
 
-#ifdef HAVE_LIBAIO_H
+#ifdef HAVE_LIBAIO
 #include <libaio.h>
-#include <errno.h>
-#include <string.h>
 
 static void cleanup(void)
 {
@@ -99,9 +100,10 @@ int main(int argc, char *argv[])
 	cleanup();
 	tst_exit();
 }
+
 #else
-int main(int argc, char *argv[])
+int main(void)
 {
-	tst_brkm(TCONF, NULL, "System doesn't support execution of the test");
+	tst_brkm(TCONF, NULL, "test requires libaio and it's development packages");
 }
 #endif
diff --git a/testcases/kernel/syscalls/io_getevents/io_getevents01.c b/testcases/kernel/syscalls/io_getevents/io_getevents01.c
index 0f31ece32..b34f17907 100644
--- a/testcases/kernel/syscalls/io_getevents/io_getevents01.c
+++ b/testcases/kernel/syscalls/io_getevents/io_getevents01.c
@@ -21,17 +21,17 @@
 /* Porting from Crackerjack to LTP is done
    by Masatake YAMATO <yamato@redhat.com> */
 
+#include <errno.h>
+#include <string.h>
+
 #include "config.h"
 #include "test.h"
 
 char *TCID = "io_getevents01";
-
 int TST_TOTAL = 1;
 
-#ifdef HAVE_LIBAIO_H
+#ifdef HAVE_LIBAIO
 #include <libaio.h>
-#include <errno.h>
-#include <string.h>
 
 static void cleanup(void)
 {
@@ -104,9 +104,10 @@ int main(int argc, char *argv[])
 	cleanup();
 	tst_exit();
 }
+
 #else
-int main(int argc, char *argv[])
+int main(void)
 {
-	tst_brkm(TCONF, NULL, "System doesn't support execution of the test");
+	tst_brkm(TCONF, NULL, "test requires libaio and it's development packages");
 }
 #endif
diff --git a/testcases/kernel/syscalls/io_setup/io_setup01.c b/testcases/kernel/syscalls/io_setup/io_setup01.c
index 829cef516..22b91bc17 100644
--- a/testcases/kernel/syscalls/io_setup/io_setup01.c
+++ b/testcases/kernel/syscalls/io_setup/io_setup01.c
@@ -21,6 +21,9 @@
 /* Porting from Crackerjack to LTP is done
    by Masatake YAMATO <yamato@redhat.com> */
 
+#include <errno.h>
+#include <string.h>
+
 #include "config.h"
 #include "test.h"
 
@@ -28,10 +31,8 @@ char *TCID = "io_setup01";
 
 int TST_TOTAL = 4;
 
-#ifdef HAVE_LIBAIO_H
+#ifdef HAVE_LIBAIO
 #include <libaio.h>
-#include <errno.h>
-#include <string.h>
 
 static void cleanup(void)
 {
@@ -131,9 +132,10 @@ int main(int argc, char *argv[])
 
 	tst_exit();
 }
+
 #else
-int main(int argc, char *argv[])
+int main(void)
 {
-	tst_brkm(TCONF, NULL, "System doesn't support execution of the test");
+	tst_brkm(TCONF, NULL, "test requires libaio and it's development packages");
 }
 #endif
diff --git a/testcases/kernel/syscalls/io_submit/io_submit01.c b/testcases/kernel/syscalls/io_submit/io_submit01.c
index 9baf520b8..f4f9933f6 100644
--- a/testcases/kernel/syscalls/io_submit/io_submit01.c
+++ b/testcases/kernel/syscalls/io_submit/io_submit01.c
@@ -20,14 +20,15 @@
 /* Porting from Crackerjack to LTP is done
    by Masatake YAMATO <yamato@redhat.com> */
 
+#include <errno.h>
+#include <string.h>
+#include <fcntl.h>
+
 #include "config.h"
 #include "tst_test.h"
 
-#ifdef HAVE_LIBAIO_H
+#ifdef HAVE_LIBAIO
 #include <libaio.h>
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
 
 static io_context_t ctx;
 static io_context_t invalid_ctx;
@@ -139,5 +140,5 @@ static struct tst_test test = {
 };
 
 #else
-	TST_TEST_TCONF("libaio.h was mission upon compilation");
+	TST_TEST_TCONF("test requires libaio and it's development packages");
 #endif
-- 
2.14.2


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

* [LTP] [PATCH v4 05/14] make: Remove workarounds for build without libnuma
  2017-10-16 15:41 [LTP] [PATCH v4 00/14] Fix 32-bit cross compilation Petr Vorel
                   ` (3 preceding siblings ...)
  2017-10-16 15:41 ` [LTP] [PATCH v4 04/14] m4: Fix libaio " Petr Vorel
@ 2017-10-16 15:41 ` Petr Vorel
  2017-10-16 15:41 ` [LTP] [PATCH v4 06/14] numa: Drop NUMA API v1 support Petr Vorel
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Petr Vorel @ 2017-10-16 15:41 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/syscalls/mbind/Makefile         | 9 ---------
 testcases/kernel/syscalls/migrate_pages/Makefile | 3 ---
 testcases/kernel/syscalls/move_pages/Makefile    | 5 -----
 3 files changed, 17 deletions(-)

diff --git a/testcases/kernel/syscalls/mbind/Makefile b/testcases/kernel/syscalls/mbind/Makefile
index 5132dffa4..1e2f5e4de 100644
--- a/testcases/kernel/syscalls/mbind/Makefile
+++ b/testcases/kernel/syscalls/mbind/Makefile
@@ -20,15 +20,6 @@ top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-#
-# gcc complains about unused functions / variables when HAS_NUMA_H isn't
-# defined, so let's just skip the warning. It's nothing more than a few extra
-# variables and functions allocated on the stack, so meh... no harm, no foul.
-#
-ifeq ($(NUMA_LIBS),)
-CPPFLAGS		+= -Wno-unused
-endif
-
 CPPFLAGS		+= -I$(abs_srcdir)/../utils/
 
 include $(top_srcdir)/testcases/kernel/include/lib.mk
diff --git a/testcases/kernel/syscalls/migrate_pages/Makefile b/testcases/kernel/syscalls/migrate_pages/Makefile
index 7168cd6e1..46a35d3e0 100644
--- a/testcases/kernel/syscalls/migrate_pages/Makefile
+++ b/testcases/kernel/syscalls/migrate_pages/Makefile
@@ -23,9 +23,6 @@ include $(top_srcdir)/include/mk/testcases.mk
 MAKE_TARGETS		:= $(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*[0-9].c))
 $(MAKE_TARGETS): %: %.o migrate_pages_common.o
 
-ifeq ($(NUMA_LIBS),)
-CPPFLAGS		+= -Wno-unused
-endif
 CPPFLAGS		+= -I$(abs_srcdir)/../utils/
 
 include $(top_srcdir)/testcases/kernel/include/lib.mk
diff --git a/testcases/kernel/syscalls/move_pages/Makefile b/testcases/kernel/syscalls/move_pages/Makefile
index d4620e10a..989277019 100644
--- a/testcases/kernel/syscalls/move_pages/Makefile
+++ b/testcases/kernel/syscalls/move_pages/Makefile
@@ -26,11 +26,6 @@ INSTALL_TARGETS		:= move_pages.sh
 
 MAKE_TARGETS		:= $(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*[0-9].c))
 
-# linux_syscall_numbers.h is forcing move_pages_support.o to complain about
-# cleanup being undefined [and when defined] unused. Let's just skip this
-# warning...
-move_pages_support.o: CFLAGS += -Wno-unused-function
-
 $(MAKE_TARGETS): %: %.o move_pages_support.o
 
 LDLIBS			+= -lpthread -lrt
-- 
2.14.2


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

* [LTP] [PATCH v4 06/14] numa: Drop NUMA API v1 support
  2017-10-16 15:41 [LTP] [PATCH v4 00/14] Fix 32-bit cross compilation Petr Vorel
                   ` (4 preceding siblings ...)
  2017-10-16 15:41 ` [LTP] [PATCH v4 05/14] make: Remove workarounds for build without libnuma Petr Vorel
@ 2017-10-16 15:41 ` Petr Vorel
  2017-10-16 15:41 ` [LTP] [PATCH v4 07/14] numa: Drop NUMA_CPPFLAGS Petr Vorel
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Petr Vorel @ 2017-10-16 15:41 UTC (permalink / raw)
  To: ltp

NOTE: there still some code using v1 API
(thus flag -DNUMA_VERSION1_COMPATIBILITY is needed)

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 .../cpuset_syscall_test/cpuset_syscall_test.c      |  4 +--
 testcases/kernel/hotplug/memory_hotplug/commands.c | 12 +------
 testcases/kernel/lib/numa_helper.c                 | 15 ++-------
 testcases/kernel/mem/vma/vma02.c                   | 13 +++-----
 testcases/kernel/mem/vma/vma04.c                   | 12 ++-----
 .../syscalls/get_mempolicy/get_mempolicy01.c       | 38 ++--------------------
 6 files changed, 14 insertions(+), 80 deletions(-)

diff --git a/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c b/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c
index 371cbc751..c3ed1a502 100644
--- a/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c
+++ b/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c
@@ -51,8 +51,8 @@
 char *TCID = "cpuset_syscall_test";
 int TST_TOTAL = 1;
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
+#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H && HAVE_MPOL_CONSTANTS \
+	&& defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 
 #include "../cpuset_lib/cpuset.h"
 #include "../cpuset_lib/bitmask.h"
diff --git a/testcases/kernel/hotplug/memory_hotplug/commands.c b/testcases/kernel/hotplug/memory_hotplug/commands.c
index a9c618d82..7f271c341 100644
--- a/testcases/kernel/hotplug/memory_hotplug/commands.c
+++ b/testcases/kernel/hotplug/memory_hotplug/commands.c
@@ -29,7 +29,7 @@
  */
 
 #include "config.h"
-#if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_LINUX_MEMPOLICY_H
+#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H
 #include <linux/mempolicy.h>
 #include <sys/types.h>
 #include <sys/time.h>
@@ -59,7 +59,6 @@
 #define MPOL_MF_WAIT    (1<<2)	/* Wait for existing pages to migrate */
 #endif
 
-#if defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION == 2
 static inline int nodemask_isset(nodemask_t * mask, int node)
 {
 	if ((unsigned)node >= NUMA_NUM_NODES)
@@ -75,7 +74,6 @@ static inline void nodemask_set(nodemask_t * mask, int node)
 	mask->n[node / (8 * sizeof(unsigned long))] |=
 	    (1UL << (node % (8 * sizeof(unsigned long))));
 }
-#endif
 
 static char *whitespace = " \t";
 
@@ -385,11 +383,7 @@ static int get_arg_nodeid_list(char *args, unsigned int *list)
 	int node, count = 0;
 
 	gcp = &glctx;
-#if defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION == 2
 	my_allowed_nodes = numa_get_membind_compat();
-#else
-	my_allowed_nodes = numa_get_membind();
-#endif
 	while (*args != '\0') {
 		if (!isdigit(*args)) {
 			fprintf(stderr, "%s:  expected digit for <node/list>\n",
@@ -447,11 +441,7 @@ static int get_current_nodeid_list(unsigned int *fromids)
 	int node;
 
 	gcp = &glctx;
-#if defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION == 2
 	my_allowed_nodes = numa_get_membind_compat();
-#else
-	my_allowed_nodes = numa_get_membind();
-#endif
 	for (node = 0; node <= max_node; ++node) {
 		if (nodemask_isset(&my_allowed_nodes, node))
 			*(fromids + nr_nodes++) = node;
diff --git a/testcases/kernel/lib/numa_helper.c b/testcases/kernel/lib/numa_helper.c
index dd080ee4e..8dc9d23a8 100644
--- a/testcases/kernel/lib/numa_helper.c
+++ b/testcases/kernel/lib/numa_helper.c
@@ -39,20 +39,9 @@
 unsigned long get_max_node(void)
 {
 	unsigned long max_node = 0;
-#if HAVE_NUMA_H
-#if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
-	max_node = NUMA_NUM_NODES;
-	/*
-	 * NUMA_NUM_NODES is not reliable, libnuma >=2 is looking
-	 * at /proc/self/status to figure out correct number.
-	 * If buffer is not large enough get_mempolicy will fail with EINVAL.
-	 */
-	if (max_node < 1024)
-		max_node = 1024;
-#else
+#if HAVE_NUMA_H && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 	max_node = numa_max_possible_node() + 1;
 #endif
-#endif /* HAVE_NUMA_H */
 	return max_node;
 }
 
@@ -209,7 +198,7 @@ int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes)
 		}
 	} while (0);
 	free(nodemask);
-#endif
+#endif /* HAVE_NUMA_H */
 	return ret;
 }
 
diff --git a/testcases/kernel/mem/vma/vma02.c b/testcases/kernel/mem/vma/vma02.c
index ae35b2a07..1492e1385 100644
--- a/testcases/kernel/mem/vma/vma02.c
+++ b/testcases/kernel/mem/vma/vma02.c
@@ -49,9 +49,9 @@
 char *TCID = "vma02";
 int TST_TOTAL = 1;
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
-#if defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION == 2
+#if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_MPOL_CONSTANTS && \
+	defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+
 static unsigned long pagesize;
 static int opt_node;
 static char *opt_nodestr;
@@ -163,12 +163,7 @@ void usage(void)
 {
 	printf("  -n      Number of NUMA nodes\n");
 }
-#else /* libnuma v1 */
-int main(void)
-{
-	tst_brkm(TCONF, NULL, "XXX: test is only supported on libnuma v2.");
-}
-#endif
+
 #else /* no NUMA */
 int main(void)
 {
diff --git a/testcases/kernel/mem/vma/vma04.c b/testcases/kernel/mem/vma/vma04.c
index 5e2cc91b7..905fbd3ad 100644
--- a/testcases/kernel/mem/vma/vma04.c
+++ b/testcases/kernel/mem/vma/vma04.c
@@ -53,9 +53,9 @@
 char *TCID = "vma04";
 int TST_TOTAL = 5;
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
-#if defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION == 2
+#if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_MPOL_CONSTANTS && \
+	defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+
 static unsigned long pagesize;
 static int opt_node;
 static char *opt_nodestr;
@@ -325,12 +325,6 @@ static void usage(void)
 	printf("  -n      Number of NUMA nodes\n");
 }
 
-#else /* libnuma v1 */
-int main(void)
-{
-	tst_brkm(TCONF, NULL, "XXX: test is only supported on libnuma v2.");
-}
-#endif
 #else /* no NUMA */
 int main(void)
 {
diff --git a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
index cca50288f..daa5f5dcc 100644
--- a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
+++ b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
@@ -66,7 +66,8 @@
 char *TCID = "get_mempolicy01";
 int TST_TOTAL = 1;
 
-#if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_MPOL_CONSTANTS
+#if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_MPOL_CONSTANTS && \
+	defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 
 #define MEM_LENGTH	(4 * 1024 * 1024)
 
@@ -221,13 +222,8 @@ static int do_test(struct test_case *tc)
 {
 	int ret, err, result, cmp_ok;
 	int policy, flags;
-#if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
-	nodemask_t *nodemask, *getnodemask;
-	unsigned long maxnode = NUMA_NUM_NODES;
-#else
 	struct bitmask *nodemask = numa_allocate_nodemask();
 	struct bitmask *getnodemask = numa_allocate_nodemask();
-#endif
 	char *p = NULL;
 	unsigned long len = MEM_LENGTH;
 	int test_node = -1;
@@ -235,15 +231,7 @@ static int do_test(struct test_case *tc)
 	ret = get_allowed_nodes(NH_MEMS, 1, &test_node);
 	if (ret < 0)
 		tst_brkm(TBROK | TERRNO, cleanup, "get_allowed_nodes: %d", ret);
-#if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
-	nodemask = malloc(sizeof(nodemask_t));
-	nodemask_zero(nodemask);
-	nodemask_set(nodemask, test_node);
-	getnodemask = malloc(sizeof(nodemask_t));
-	nodemask_zero(getnodemask);
-#else
 	numa_bitmask_setbit(nodemask, test_node);
-#endif
 	switch (tc->ttype) {
 	case DEFAULT:
 		flags = 0;
@@ -252,13 +240,8 @@ static int do_test(struct test_case *tc)
 			TEST(ltp_syscall(__NR_set_mempolicy, tc->policy,
 				NULL, 0));
 		else
-#if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
-			TEST(ltp_syscall(__NR_set_mempolicy, tc->policy,
-				nodemask, maxnode));
-#else
 			TEST(ltp_syscall(__NR_set_mempolicy, tc->policy,
 				nodemask->maskp, nodemask->size));
-#endif
 		if (TEST_RETURN < 0) {
 			tst_resm(TBROK | TERRNO, "set_mempolicy");
 			return -1;
@@ -275,13 +258,8 @@ static int do_test(struct test_case *tc)
 			TEST(ltp_syscall(__NR_mbind, p, len, tc->policy,
 				NULL, 0, 0));
 		else
-#if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
-			TEST(ltp_syscall(__NR_mbind, p, len, tc->policy,
-				nodemask, maxnode, 0));
-#else
 			TEST(ltp_syscall(__NR_mbind, p, len, tc->policy,
 				nodemask->maskp, nodemask->size, 0));
-#endif
 		if (TEST_RETURN < 0) {
 			tst_resm(TBROK | TERRNO, "mbind");
 			return -1;
@@ -299,30 +277,18 @@ static int do_test(struct test_case *tc)
 	}
 	errno = 0;
 	cmp_ok = 1;
-#if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
-	TEST(ret = ltp_syscall(__NR_get_mempolicy, &policy, getnodemask,
-			   maxnode, p, flags));
-#else
 	TEST(ret = ltp_syscall(__NR_get_mempolicy, &policy, getnodemask->maskp,
 			   getnodemask->size, p, flags));
-#endif
 	err = TEST_ERRNO;
 	if (ret < 0)
 		goto TEST_END;
 
 	/* if policy == MPOL_DEFAULT, get_mempolicy doesn't return nodemask */
 	if (tc->policy == MPOL_DEFAULT)
-#if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
-		nodemask_zero(nodemask);
-	cmp_ok = (tc->policy == policy && (tc->from_node == NONE ||
-					   nodemask_equal(nodemask,
-							  getnodemask)));
-#else
 		numa_bitmask_clearall(nodemask);
 	cmp_ok = (tc->policy == policy && (tc->from_node == NONE ||
 					   numa_bitmask_equal(nodemask,
 							      getnodemask)));
-#endif
 TEST_END:
 	result = (err != tc->err) || !cmp_ok;
 	PRINT_RESULT_CMP(0, tc->ret, tc->err, ret, err, cmp_ok);
-- 
2.14.2


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

* [LTP] [PATCH v4 07/14] numa: Drop NUMA_CPPFLAGS
  2017-10-16 15:41 [LTP] [PATCH v4 00/14] Fix 32-bit cross compilation Petr Vorel
                   ` (5 preceding siblings ...)
  2017-10-16 15:41 ` [LTP] [PATCH v4 06/14] numa: Drop NUMA API v1 support Petr Vorel
@ 2017-10-16 15:41 ` Petr Vorel
  2017-10-16 15:41 ` [LTP] [PATCH v4 08/14] hotplug/memory_hotplug: Update TODO Petr Vorel
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Petr Vorel @ 2017-10-16 15:41 UTC (permalink / raw)
  To: ltp

and remove most -DNUMA_VERSION1_COMPATIBILITY flags.
The place which requires it (e.g. using legacy code) is
testcases/kernel/lib/commands.c.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 include/mk/config.mk.default                                     | 1 -
 include/mk/config.mk.in                                          | 1 -
 m4/ltp-numa.m4                                                   | 9 ++-------
 testcases/kernel/controllers/cpuset/cpuset_syscall_test/Makefile | 1 -
 testcases/kernel/include/lib.mk                                  | 2 +-
 testcases/kernel/lib/Makefile                                    | 3 ++-
 testcases/kernel/numa/Makefile                                   | 2 +-
 7 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/include/mk/config.mk.default b/include/mk/config.mk.default
index dff3479db..0934d9453 100644
--- a/include/mk/config.mk.default
+++ b/include/mk/config.mk.default
@@ -39,7 +39,6 @@ YACC			:= bison -y
 #ACL_LIBS		:= -lacl
 #CRYPTO_LIBS		:= -lcrypto
 #LEXLIB			:= -lfl
-#NUMA_CPPFLAGS		:= -DNUMA_VERSION1_COMPATIBILITY
 #NUMA_LIBS		:= -lnuma
 #SELINUX_LIBS		:= -lselinux
 #TIRPC_CPPFLAGS		:= -I/usr/include/tirpc
diff --git a/include/mk/config.mk.in b/include/mk/config.mk.in
index dde2a9e55..8c4f9da82 100644
--- a/include/mk/config.mk.in
+++ b/include/mk/config.mk.in
@@ -41,7 +41,6 @@ CAP_LIBS		:= @CAP_LIBS@
 ACL_LIBS		:= @ACL_LIBS@
 CRYPTO_LIBS		:= @CRYPTO_LIBS@
 LEXLIB			:= @LEXLIB@
-NUMA_CPPFLAGS		:= @NUMA_CPPFLAGS@
 NUMA_LIBS		:= @NUMA_LIBS@
 SELINUX_LIBS		:= @SELINUX_LIBS@
 TIRPC_CPPFLAGS		:= @TIRPC_CPPFLAGS@
diff --git a/m4/ltp-numa.m4 b/m4/ltp-numa.m4
index 30650cd00..b9e9069b6 100644
--- a/m4/ltp-numa.m4
+++ b/m4/ltp-numa.m4
@@ -22,8 +22,7 @@ dnl
 dnl LTP_CHECK_SYSCALL_NUMA
 dnl ----------------------------
 dnl
-AC_DEFUN([LTP_CHECK_SYSCALL_NUMA],
-[dnl
+AC_DEFUN([LTP_CHECK_SYSCALL_NUMA], [
 AC_CHECK_HEADERS([linux/mempolicy.h numa.h numaif.h],[
 	LTP_SYSCALL_NUMA_HEADERS=yes
 	AC_CHECK_LIB(numa,numa_alloc_onnode,[have_numa_alloc_onnode="yes"])
@@ -35,14 +34,10 @@ AC_CHECK_HEADERS([linux/mempolicy.h numa.h numaif.h],[
 		AC_DEFINE(HAVE_NUMA_MOVE_PAGES,1,[define to 1 if you have 'numa_move_pages' function])
 	fi
 ]
-	AC_CHECK_LIB(numa,numa_available,[
-NUMA_CPPFLAGS="-DNUMA_VERSION1_COMPATIBILITY"
-NUMA_LIBS="-lnuma"
-	])
+	AC_CHECK_LIB(numa,numa_available,[NUMA_LIBS="-lnuma"])
 dnl For testcases/kernel/controllers/cpuset, testcases/kernel/syscalls/get_mempolicy,
 dnl testcases/kernel/syscalls/mbind
 AC_CHECK_DECLS([MPOL_BIND, MPOL_DEFAULT, MPOL_F_ADDR, MPOL_F_MEMS_ALLOWED, MPOL_F_NODE, MPOL_INTERLEAVE, MPOL_PREFERRED],[have_mpol_constants="yes"],,[#include <numaif.h>])
-AC_SUBST(NUMA_CPPFLAGS)
 AC_SUBST(NUMA_LIBS)
 if test "x$have_mpol_constants" = "xyes"; then
 	AC_DEFINE(HAVE_MPOL_CONSTANTS,1,[define to 1 if you have all constants required to use mbind tests])
diff --git a/testcases/kernel/controllers/cpuset/cpuset_syscall_test/Makefile b/testcases/kernel/controllers/cpuset/cpuset_syscall_test/Makefile
index 6de1f8901..3f5e591f9 100644
--- a/testcases/kernel/controllers/cpuset/cpuset_syscall_test/Makefile
+++ b/testcases/kernel/controllers/cpuset/cpuset_syscall_test/Makefile
@@ -26,7 +26,6 @@ include $(top_srcdir)/include/mk/testcases.mk
 include $(abs_srcdir)/../Makefile.inc
 
 LDLIBS                  += $(NUMA_LIBS)
-CPPFLAGS                += $(NUMA_CPPFLAGS)
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
diff --git a/testcases/kernel/include/lib.mk b/testcases/kernel/include/lib.mk
index 5c97ae2c9..40a09b77e 100644
--- a/testcases/kernel/include/lib.mk
+++ b/testcases/kernel/include/lib.mk
@@ -22,7 +22,7 @@ LIBKERNTEST_SRCDIR	:= $(KERNEL_SRCDIR)/lib
 KERNEL_DIR		:= $(abs_top_builddir)/testcases/kernel
 LIBKERNTEST_DIR		:= $(KERNEL_DIR)/lib
 LIBKERNTEST		:= $(LIBKERNTEST_DIR)/libkerntest.a
-CPPFLAGS		+= $(NUMA_CPPFLAGS) -I$(KERNEL_SRCDIR)/include
+CPPFLAGS		+= -I$(KERNEL_SRCDIR)/include
 LDLIBS			+= -lkerntest -lltp $(NUMA_LIBS)
 LDFLAGS			+= -L$(LIBKERNTEST_DIR)
 
diff --git a/testcases/kernel/lib/Makefile b/testcases/kernel/lib/Makefile
index 8e19eed9e..fabf2f06e 100644
--- a/testcases/kernel/lib/Makefile
+++ b/testcases/kernel/lib/Makefile
@@ -22,7 +22,8 @@ top_srcdir		?= ../../..
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-CPPFLAGS		+= $(NUMA_CPPFLAGS) -I$(abs_srcdir)/../include \
+CPPFLAGS		+= -DNUMA_VERSION1_COMPATIBILITY \
+			   -I$(abs_srcdir)/../include \
 			   -I$(abs_builddir)/../include
 INTERNAL_LIB		:= libkerntest.a
 
diff --git a/testcases/kernel/numa/Makefile b/testcases/kernel/numa/Makefile
index f5e1881fd..48494e456 100644
--- a/testcases/kernel/numa/Makefile
+++ b/testcases/kernel/numa/Makefile
@@ -20,7 +20,7 @@ top_srcdir		:= ../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-CPPFLAGS		+= -D_GNU_SOURCE -DNUMA_VERSION1_COMPATIBILITY
+CPPFLAGS		+= -D_GNU_SOURCE
 
 LDLIBS 			+= $(NUMA_LIBS)
 
-- 
2.14.2


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

* [LTP] [PATCH v4 08/14] hotplug/memory_hotplug: Update TODO
  2017-10-16 15:41 [LTP] [PATCH v4 00/14] Fix 32-bit cross compilation Petr Vorel
                   ` (6 preceding siblings ...)
  2017-10-16 15:41 ` [LTP] [PATCH v4 07/14] numa: Drop NUMA_CPPFLAGS Petr Vorel
@ 2017-10-16 15:41 ` Petr Vorel
  2017-10-16 15:42 ` [LTP] [PATCH v4 09/14] hotplug/memory_hotplug: Remove unused header Petr Vorel
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Petr Vorel @ 2017-10-16 15:41 UTC (permalink / raw)
  To: ltp

_NEED_MIGRATE_PAGES definition was removed in commit 5ed9ed059
("Address the issue reported in the following email by installing all .c files.")

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/hotplug/memory_hotplug/TODO | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/testcases/kernel/hotplug/memory_hotplug/TODO b/testcases/kernel/hotplug/memory_hotplug/TODO
index 35c18aa57..1460eb6a2 100644
--- a/testcases/kernel/hotplug/memory_hotplug/TODO
+++ b/testcases/kernel/hotplug/memory_hotplug/TODO
@@ -1,12 +1,7 @@
 memtoy:
 
-if migrate_pages(2) system call ever becomes standard, will need to change
-Makefile not to build and link against migrate_pages.o and not to define
-_NEED_MIGRATE_PAGES.
-
 More documentation?
 
-
 Desired features?
 
 	+ verify contents after migration?
-- 
2.14.2


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

* [LTP] [PATCH v4 09/14] hotplug/memory_hotplug: Remove unused header
  2017-10-16 15:41 [LTP] [PATCH v4 00/14] Fix 32-bit cross compilation Petr Vorel
                   ` (7 preceding siblings ...)
  2017-10-16 15:41 ` [LTP] [PATCH v4 08/14] hotplug/memory_hotplug: Update TODO Petr Vorel
@ 2017-10-16 15:42 ` Petr Vorel
  2017-10-16 15:42 ` [LTP] [PATCH v4 10/14] hotplug/memory_hotplug: Exit with TCONF when NUMA headers not available Petr Vorel
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Petr Vorel @ 2017-10-16 15:42 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/hotplug/memory_hotplug/commands.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/testcases/kernel/hotplug/memory_hotplug/commands.c b/testcases/kernel/hotplug/memory_hotplug/commands.c
index 7f271c341..35056b5b6 100644
--- a/testcases/kernel/hotplug/memory_hotplug/commands.c
+++ b/testcases/kernel/hotplug/memory_hotplug/commands.c
@@ -29,8 +29,7 @@
  */
 
 #include "config.h"
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H
-#include <linux/mempolicy.h>
+#if HAVE_NUMA_H && HAVE_NUMAIF_H
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/mman.h>
-- 
2.14.2


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

* [LTP] [PATCH v4 10/14] hotplug/memory_hotplug: Exit with TCONF when NUMA headers not available
  2017-10-16 15:41 [LTP] [PATCH v4 00/14] Fix 32-bit cross compilation Petr Vorel
                   ` (8 preceding siblings ...)
  2017-10-16 15:42 ` [LTP] [PATCH v4 09/14] hotplug/memory_hotplug: Remove unused header Petr Vorel
@ 2017-10-16 15:42 ` Petr Vorel
  2017-10-16 15:42 ` [LTP] [PATCH v4 11/14] m4, kernel/lib: Detect libnuma presence in kernel libs Petr Vorel
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Petr Vorel @ 2017-10-16 15:42 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/hotplug/memory_hotplug/memtoy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/hotplug/memory_hotplug/memtoy.c b/testcases/kernel/hotplug/memory_hotplug/memtoy.c
index 1a96d914a..296788e30 100644
--- a/testcases/kernel/hotplug/memory_hotplug/memtoy.c
+++ b/testcases/kernel/hotplug/memory_hotplug/memtoy.c
@@ -24,6 +24,8 @@
 
 #include <stdio.h>
 #include "config.h"
+#include "tst_res_flags.h"
+
 /* Shortcut because the test requires numa and mempolicy support. */
 #if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_LINUX_MEMPOLICY_H
 #include <sys/types.h>
@@ -495,6 +497,6 @@ int main(int argc, char *argv[])
 int main(void)
 {
 	printf("System doesn't have required numa support.\n");
-	return 0;
+	return TCONF;
 }
 #endif /* HAVE_NUMA_H && HAVE_NUMAIF_H */
-- 
2.14.2


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

* [LTP] [PATCH v4 11/14] m4, kernel/lib: Detect libnuma presence in kernel libs
  2017-10-16 15:41 [LTP] [PATCH v4 00/14] Fix 32-bit cross compilation Petr Vorel
                   ` (9 preceding siblings ...)
  2017-10-16 15:42 ` [LTP] [PATCH v4 10/14] hotplug/memory_hotplug: Exit with TCONF when NUMA headers not available Petr Vorel
@ 2017-10-16 15:42 ` Petr Vorel
  2017-10-16 15:42 ` [LTP] [PATCH v4 12/14] numa: Check for API >= v2 with autoconf Petr Vorel
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Petr Vorel @ 2017-10-16 15:42 UTC (permalink / raw)
  To: ltp

This fixes link problems when NUMA headers are available
but libnuma not (e.g. on 32-bit cross build).

numa_alloc_onnode() and numa_move_pages() do not depend on
linux/mempolicy.h, thus remove the dependency.

Removed HAVE_MPOL_CONSTANTS definition and it's usage as
with dropped NUMA API v1 are these constants always available.

Removed dependency on linux/mempolicy.h (#if HAVE_LINUX_MEMPOLICY_H
check) from C files which do not need it.

Removed unused variable LTP_SYSCALL_NUMA_HEADERS (added in cb805c4aa,
but never used).

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
If you don't like I changed too many things in one commit, I can add "removed
dependency on linux/mempolicy.h" into separate commit.
---
 m4/ltp-numa.m4                                     | 34 ++++++++++------------
 .../controllers/cpuset/cpuset_lib/libcpuset.c      |  1 +
 .../cpuset_syscall_test/cpuset_syscall_test.c      |  6 ++--
 testcases/kernel/hotplug/memory_hotplug/commands.c |  6 +++-
 testcases/kernel/hotplug/memory_hotplug/memtoy.c   | 13 +++++----
 testcases/kernel/hotplug/memory_hotplug/segment.c  |  6 +++-
 testcases/kernel/include/numa_helper.h             |  2 +-
 testcases/kernel/lib/numa_helper.c                 | 14 ++++-----
 testcases/kernel/mem/cpuset/cpuset01.c             | 10 ++++---
 testcases/kernel/mem/ksm/ksm02.c                   | 11 ++++---
 testcases/kernel/mem/ksm/ksm04.c                   | 11 ++++---
 testcases/kernel/mem/ksm/ksm06.c                   | 14 +++++----
 testcases/kernel/mem/lib/mem.c                     | 13 ++++-----
 testcases/kernel/mem/oom/oom02.c                   | 11 ++++---
 testcases/kernel/mem/oom/oom03.c                   | 10 +++++--
 testcases/kernel/mem/oom/oom04.c                   | 11 ++++---
 testcases/kernel/mem/oom/oom05.c                   | 11 ++++---
 testcases/kernel/mem/vma/vma02.c                   |  7 ++---
 testcases/kernel/mem/vma/vma04.c                   |  7 ++---
 .../syscalls/get_mempolicy/get_mempolicy01.c       |  7 +++--
 testcases/kernel/syscalls/mbind/mbind01.c          | 11 ++++---
 .../syscalls/migrate_pages/migrate_pages01.c       | 10 ++++---
 .../syscalls/migrate_pages/migrate_pages02.c       | 11 ++++---
 .../syscalls/move_pages/move_pages_support.c       | 14 ++++-----
 24 files changed, 145 insertions(+), 106 deletions(-)

diff --git a/m4/ltp-numa.m4 b/m4/ltp-numa.m4
index b9e9069b6..f21e38858 100644
--- a/m4/ltp-numa.m4
+++ b/m4/ltp-numa.m4
@@ -16,6 +16,7 @@ dnl along with this program;  if not, write to the Free Software
 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 dnl
 dnl Author: Ngie Cooper <yaneurabeya@gmail.com>
+dnl Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
 dnl
 
 dnl
@@ -23,23 +24,18 @@ dnl LTP_CHECK_SYSCALL_NUMA
 dnl ----------------------------
 dnl
 AC_DEFUN([LTP_CHECK_SYSCALL_NUMA], [
-AC_CHECK_HEADERS([linux/mempolicy.h numa.h numaif.h],[
-	LTP_SYSCALL_NUMA_HEADERS=yes
-	AC_CHECK_LIB(numa,numa_alloc_onnode,[have_numa_alloc_onnode="yes"])
-	if  test "x$have_numa_alloc_onnode" = "xyes"; then
-		AC_DEFINE(HAVE_NUMA_ALLOC_ONNODE,1,[define to 1 if you have 'numa_alloc_onnode' function])
-	fi
-	AC_CHECK_LIB(numa,numa_move_pages,[have_numa_move_pages="yes"])
-	if  test "x$have_numa_move_pages" = "xyes"; then
-		AC_DEFINE(HAVE_NUMA_MOVE_PAGES,1,[define to 1 if you have 'numa_move_pages' function])
+	AC_CHECK_LIB(numa, numa_available, [have_libnuma=yes])
+	AC_CHECK_HEADERS([numa.h numaif.h], [], [have_numa_headers=no])
+
+	if test "x$have_libnuma" = "xyes" -a "x$have_numa_headers" != "xno"; then
+		AC_SUBST(NUMA_LIBS, "-lnuma")
+		AC_DEFINE(HAVE_LIBNUMA, 1, [Define to 1 if you have libnuma and it's headers installed.])
+
+		AC_CHECK_LIB(numa, numa_alloc_onnode, [
+			AC_DEFINE(HAVE_NUMA_ALLOC_ONNODE, 1, [Define to 1 if you have `numa_alloc_onnode' function.])
+		])
+		AC_CHECK_LIB(numa, numa_move_pages, [
+			AC_DEFINE(HAVE_NUMA_MOVE_PAGES, 1, [Define to 1 if you have `numa_move_pages' function.])
+		])
 	fi
-]
-	AC_CHECK_LIB(numa,numa_available,[NUMA_LIBS="-lnuma"])
-dnl For testcases/kernel/controllers/cpuset, testcases/kernel/syscalls/get_mempolicy,
-dnl testcases/kernel/syscalls/mbind
-AC_CHECK_DECLS([MPOL_BIND, MPOL_DEFAULT, MPOL_F_ADDR, MPOL_F_MEMS_ALLOWED, MPOL_F_NODE, MPOL_INTERLEAVE, MPOL_PREFERRED],[have_mpol_constants="yes"],,[#include <numaif.h>])
-AC_SUBST(NUMA_LIBS)
-if test "x$have_mpol_constants" = "xyes"; then
-	AC_DEFINE(HAVE_MPOL_CONSTANTS,1,[define to 1 if you have all constants required to use mbind tests])
-fi
-)])
+])
diff --git a/testcases/kernel/controllers/cpuset/cpuset_lib/libcpuset.c b/testcases/kernel/controllers/cpuset/cpuset_lib/libcpuset.c
index b38289679..9b67e37c9 100644
--- a/testcases/kernel/controllers/cpuset/cpuset_lib/libcpuset.c
+++ b/testcases/kernel/controllers/cpuset/cpuset_lib/libcpuset.c
@@ -50,6 +50,7 @@
 #include "test.h"
 #include "lapi/syscalls.h"
 #include "config.h"
+
 #if HAVE_LINUX_MEMPOLICY_H
 #include <linux/mempolicy.h>
 
diff --git a/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c b/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c
index c3ed1a502..6a6c7a803 100644
--- a/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c
+++ b/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c
@@ -51,8 +51,8 @@
 char *TCID = "cpuset_syscall_test";
 int TST_TOTAL = 1;
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H && HAVE_MPOL_CONSTANTS \
-	&& defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2 \
+	&& defined(HAVE_LINUX_MEMPOLICY_H)
 
 #include "../cpuset_lib/cpuset.h"
 #include "../cpuset_lib/bitmask.h"
@@ -243,6 +243,6 @@ int main(int argc, char *argv[])
 #else
 int main(void)
 {
-	tst_brkm(TCONF, NULL, "System doesn't have required mempolicy support");
+	tst_brkm(TCONF, NULL, "test requires libnuma >= 2 and it's development packages");
 }
 #endif
diff --git a/testcases/kernel/hotplug/memory_hotplug/commands.c b/testcases/kernel/hotplug/memory_hotplug/commands.c
index 35056b5b6..54a79224d 100644
--- a/testcases/kernel/hotplug/memory_hotplug/commands.c
+++ b/testcases/kernel/hotplug/memory_hotplug/commands.c
@@ -29,7 +29,11 @@
  */
 
 #include "config.h"
-#if HAVE_NUMA_H && HAVE_NUMAIF_H
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
+
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/mman.h>
diff --git a/testcases/kernel/hotplug/memory_hotplug/memtoy.c b/testcases/kernel/hotplug/memory_hotplug/memtoy.c
index 296788e30..40d08ef63 100644
--- a/testcases/kernel/hotplug/memory_hotplug/memtoy.c
+++ b/testcases/kernel/hotplug/memory_hotplug/memtoy.c
@@ -23,11 +23,14 @@
  */
 
 #include <stdio.h>
+
 #include "config.h"
 #include "tst_res_flags.h"
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
 
-/* Shortcut because the test requires numa and mempolicy support. */
-#if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_LINUX_MEMPOLICY_H
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/mman.h>
@@ -493,10 +496,10 @@ int main(int argc, char *argv[])
 	return 0;
 
 }
-#else /* ! (HAVE_NUMA_H && HAVE_NUMAIF_H) */
+#else
 int main(void)
 {
-	printf("System doesn't have required numa support.\n");
+	fprintf(stderr, "test requires libnuma >= 2 and it's development packages\n");
 	return TCONF;
 }
-#endif /* HAVE_NUMA_H && HAVE_NUMAIF_H */
+#endif
diff --git a/testcases/kernel/hotplug/memory_hotplug/segment.c b/testcases/kernel/hotplug/memory_hotplug/segment.c
index 62ccd81f9..a087eb2e1 100644
--- a/testcases/kernel/hotplug/memory_hotplug/segment.c
+++ b/testcases/kernel/hotplug/memory_hotplug/segment.c
@@ -28,7 +28,11 @@
  */
 
 #include "config.h"
-#if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_LINUX_MEMPOLICY_H
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
+
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/mman.h>
diff --git a/testcases/kernel/include/numa_helper.h b/testcases/kernel/include/numa_helper.h
index b9d55f04d..39cf7aa23 100644
--- a/testcases/kernel/include/numa_helper.h
+++ b/testcases/kernel/include/numa_helper.h
@@ -36,4 +36,4 @@ int get_allowed_nodes(int flag, int count, ...);
 void nh_dump_nodes(void);
 int is_numa(void (*cleanup_fn)(void), int flag, int min_nodes);
 
-#endif
+#endif /* NUMA_HELPER_H */
diff --git a/testcases/kernel/lib/numa_helper.c b/testcases/kernel/lib/numa_helper.c
index 8dc9d23a8..095285bb2 100644
--- a/testcases/kernel/lib/numa_helper.c
+++ b/testcases/kernel/lib/numa_helper.c
@@ -39,13 +39,13 @@
 unsigned long get_max_node(void)
 {
 	unsigned long max_node = 0;
-#if HAVE_NUMA_H && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 	max_node = numa_max_possible_node() + 1;
 #endif
 	return max_node;
 }
 
-#if HAVE_NUMA_H
+#ifdef HAVE_LIBNUMA
 static void get_nodemask_allnodes(nodemask_t * nodemask, unsigned long max_node)
 {
 	unsigned long nodemask_size = max_node / 8;
@@ -63,7 +63,7 @@ static void get_nodemask_allnodes(nodemask_t * nodemask, unsigned long max_node)
 
 static int filter_nodemask_mem(nodemask_t * nodemask, unsigned long max_node)
 {
-#if MPOL_F_MEMS_ALLOWED
+#ifdef MPOL_F_MEMS_ALLOWED
 	unsigned long nodemask_size = max_node / 8;
 	memset(nodemask, 0, nodemask_size);
 	/*
@@ -134,7 +134,7 @@ static void filter_nodemask_cpu(nodemask_t * nodemask, unsigned long max_node)
 	}
 	free(cpumask);
 }
-#endif /* HAVE_NUMA_H */
+#endif /* HAVE_LIBNUMA */
 
 /*
  * get_allowed_nodes_arr - get number and array of available nodes
@@ -152,7 +152,7 @@ static void filter_nodemask_cpu(nodemask_t * nodemask, unsigned long max_node)
 int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes)
 {
 	int ret = 0;
-#if HAVE_NUMA_H
+#ifdef HAVE_LIBNUMA
 	int i;
 	nodemask_t *nodemask = NULL;
 #endif
@@ -160,7 +160,7 @@ int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes)
 	if (nodes)
 		*nodes = NULL;
 
-#if HAVE_NUMA_H
+#ifdef HAVE_LIBNUMA
 	unsigned long max_node, nodemask_size;
 
 	if (numa_available() == -1)
@@ -198,7 +198,7 @@ int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes)
 		}
 	} while (0);
 	free(nodemask);
-#endif /* HAVE_NUMA_H */
+#endif /* HAVE_LIBNUMA */
 	return ret;
 }
 
diff --git a/testcases/kernel/mem/cpuset/cpuset01.c b/testcases/kernel/mem/cpuset/cpuset01.c
index 3d68cc07a..4efb01f23 100644
--- a/testcases/kernel/mem/cpuset/cpuset01.c
+++ b/testcases/kernel/mem/cpuset/cpuset01.c
@@ -23,6 +23,9 @@
 #include "config.h"
 #include <stdio.h>
 #include <sys/wait.h>
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
 #if HAVE_NUMAIF_H
 #include <numaif.h>
 #endif
@@ -30,8 +33,7 @@
 #include "mem.h"
 #include "numa_helper.h"
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 volatile int end;
 static int *nodes;
 static int nnodes;
@@ -186,6 +188,6 @@ static struct tst_test test = {
 	.min_kver = "2.6.32",
 };
 
-#else /* no NUMA */
-	TST_TEST_TCONF("no NUMA development packages installed.");
+#else
+	TST_TEST_TCONF("test requires libnuma >= 2 and it's development packages");
 #endif
diff --git a/testcases/kernel/mem/ksm/ksm02.c b/testcases/kernel/mem/ksm/ksm02.c
index 6fe75d380..801412fd7 100644
--- a/testcases/kernel/mem/ksm/ksm02.c
+++ b/testcases/kernel/mem/ksm/ksm02.c
@@ -50,6 +50,9 @@
 #include <sys/stat.h>
 #include <errno.h>
 #include <fcntl.h>
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
 #if HAVE_NUMAIF_H
 #include <numaif.h>
 #endif
@@ -59,8 +62,8 @@
 #include "mem.h"
 #include "ksm_common.h"
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2 \
+	&& HAVE_LINUX_MEMPOLICY_H
 
 static void verify_ksm(void)
 {
@@ -121,6 +124,6 @@ static struct tst_test test = {
 	.min_kver = "2.6.32",
 };
 
-#else /* no NUMA */
-	TST_TEST_TCONF("no NUMA development packages installed.");
+#else
+	TST_TEST_TCONF("test requires libnuma >= 2 and it's development packages");
 #endif
diff --git a/testcases/kernel/mem/ksm/ksm04.c b/testcases/kernel/mem/ksm/ksm04.c
index 1c8bf20c2..bdce8b9fb 100644
--- a/testcases/kernel/mem/ksm/ksm04.c
+++ b/testcases/kernel/mem/ksm/ksm04.c
@@ -50,6 +50,9 @@
 #include <sys/stat.h>
 #include <errno.h>
 #include <fcntl.h>
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
 #if HAVE_NUMAIF_H
 #include <numaif.h>
 #endif
@@ -59,8 +62,8 @@
 #include "mem.h"
 #include "ksm_common.h"
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2 \
+	&& HAVE_LINUX_MEMPOLICY_H
 
 static void verify_ksm(void)
 {
@@ -125,6 +128,6 @@ static struct tst_test test = {
 	.min_kver = "2.6.32",
 };
 
-#else /* no NUMA */
-	TST_TEST_TCONF("no NUMA development packages installed.");
+#else
+	TST_TEST_TCONF("test requires libnuma >= 2 and it's development packages");
 #endif
diff --git a/testcases/kernel/mem/ksm/ksm06.c b/testcases/kernel/mem/ksm/ksm06.c
index 334a04834..4763460cf 100644
--- a/testcases/kernel/mem/ksm/ksm06.c
+++ b/testcases/kernel/mem/ksm/ksm06.c
@@ -28,6 +28,9 @@
 #include <limits.h>
 #include <errno.h>
 #include <fcntl.h>
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
 #if HAVE_NUMAIF_H
 #include <numaif.h>
 #endif
@@ -35,11 +38,12 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <limits.h>
-#include "numa_helper.h"
+
 #include "mem.h"
+#include "numa_helper.h"
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2 \
+	&& HAVE_LINUX_MEMPOLICY_H
 
 static int run = -1;
 static int sleep_millisecs = -1;
@@ -105,6 +109,6 @@ static struct tst_test test = {
 	.test_all = test_ksm,
 };
 
-#else /* no NUMA */
-	TST_TEST_TCONF("no NUMA development packages installed.");
+#else
+	TST_TEST_TCONF("test requires libnuma >= 2 and it's development packages");
 #endif
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index dd82b08d2..c046c77c5 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -162,10 +162,9 @@ void oom(int testcase, int lite, int retcode, int allow_sigkill)
 	}
 }
 
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 static void set_global_mempolicy(int mempolicy)
 {
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
 	unsigned long nmask[MAXNODES / BITS_PER_LONG] = { 0 };
 	int num_nodes, *nodes;
 	int ret;
@@ -203,8 +202,10 @@ static void set_global_mempolicy(int mempolicy)
 		if (set_mempolicy(mempolicy, nmask, MAXNODES) == -1)
 			tst_brk(TBROK|TERRNO, "set_mempolicy");
 	}
-#endif
 }
+#else
+static void set_global_mempolicy(int mempolicy LTP_ATTRIBUTE_UNUSED) { }
+#endif
 
 void testoom(int mempolicy, int lite, int retcode, int allow_sigkill)
 {
@@ -562,8 +563,7 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages)
 	unsigned long length;
 	unsigned long pagesize;
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 	unsigned long nmask[MAXNODES / BITS_PER_LONG] = { 0 };
 #endif
 
@@ -588,8 +588,7 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages)
 			tst_brk(TBROK|TERRNO, "madvise");
 #endif
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 		clean_node(nmask);
 		set_node(nmask, nodes[i]);
 		/*
diff --git a/testcases/kernel/mem/oom/oom02.c b/testcases/kernel/mem/oom/oom02.c
index 3434a34ba..6bc08213f 100644
--- a/testcases/kernel/mem/oom/oom02.c
+++ b/testcases/kernel/mem/oom/oom02.c
@@ -26,11 +26,14 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
+
 #include "numa_helper.h"
 #include "mem.h"
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 
 static void verify_oom(void)
 {
@@ -71,6 +74,6 @@ static struct tst_test test = {
 	.test_all = verify_oom,
 };
 
-#else /* no NUMA */
-	TST_TEST_TCONF("no NUMA development packages installed.");
+#else
+	TST_TEST_TCONF("test requires libnuma >= 2 and it's development packages");
 #endif
diff --git a/testcases/kernel/mem/oom/oom03.c b/testcases/kernel/mem/oom/oom03.c
index f883bc054..29159d629 100644
--- a/testcases/kernel/mem/oom/oom03.c
+++ b/testcases/kernel/mem/oom/oom03.c
@@ -20,16 +20,20 @@
  * the GNU General Public License for more details.
  */
 
+#include "config.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
+
 #include "numa_helper.h"
 #include "mem.h"
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 
 static void verify_oom(void)
 {
@@ -85,5 +89,5 @@ static struct tst_test test = {
 };
 
 #else
-	TST_TEST_TCONF("no NUMA development packages installed.");
+	TST_TEST_TCONF("test requires libnuma >= 2 and it's development packages");
 #endif
diff --git a/testcases/kernel/mem/oom/oom04.c b/testcases/kernel/mem/oom/oom04.c
index e4e70e26f..39fedd2a8 100644
--- a/testcases/kernel/mem/oom/oom04.c
+++ b/testcases/kernel/mem/oom/oom04.c
@@ -26,11 +26,14 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
+
 #include "numa_helper.h"
 #include "mem.h"
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 
 static void verify_oom(void)
 {
@@ -93,6 +96,6 @@ static struct tst_test test = {
 	.test_all = verify_oom,
 };
 
-#else /* no NUMA */
-	TST_TEST_TCONF("no NUMA development packages installed.");
+#else
+	TST_TEST_TCONF("test requires libnuma >= 2 and it's development packages");
 #endif
diff --git a/testcases/kernel/mem/oom/oom05.c b/testcases/kernel/mem/oom/oom05.c
index bdf5d1923..7095974c5 100644
--- a/testcases/kernel/mem/oom/oom05.c
+++ b/testcases/kernel/mem/oom/oom05.c
@@ -26,11 +26,14 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
+
 #include "numa_helper.h"
 #include "mem.h"
 
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 
 static void verify_oom(void)
 {
@@ -119,6 +122,6 @@ static struct tst_test test = {
 	.test_all = verify_oom,
 };
 
-#else /* no NUMA */
-	TST_TEST_TCONF("no NUMA development packages installed.");
+#else
+	TST_TEST_TCONF("test requires libnuma >= 2 and it's development packages");
 #endif
diff --git a/testcases/kernel/mem/vma/vma02.c b/testcases/kernel/mem/vma/vma02.c
index 1492e1385..99642e39e 100644
--- a/testcases/kernel/mem/vma/vma02.c
+++ b/testcases/kernel/mem/vma/vma02.c
@@ -49,8 +49,7 @@
 char *TCID = "vma02";
 int TST_TOTAL = 1;
 
-#if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_MPOL_CONSTANTS && \
-	defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 
 static unsigned long pagesize;
 static int opt_node;
@@ -164,9 +163,9 @@ void usage(void)
 	printf("  -n      Number of NUMA nodes\n");
 }
 
-#else /* no NUMA */
+#else
 int main(void)
 {
-	tst_brkm(TCONF, NULL, "no NUMA development packages installed.");
+	tst_brkm(TCONF, NULL, "test requires libnuma >= 2 and it's development packages");
 }
 #endif
diff --git a/testcases/kernel/mem/vma/vma04.c b/testcases/kernel/mem/vma/vma04.c
index 905fbd3ad..030a92691 100644
--- a/testcases/kernel/mem/vma/vma04.c
+++ b/testcases/kernel/mem/vma/vma04.c
@@ -53,8 +53,7 @@
 char *TCID = "vma04";
 int TST_TOTAL = 5;
 
-#if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_MPOL_CONSTANTS && \
-	defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 
 static unsigned long pagesize;
 static int opt_node;
@@ -325,9 +324,9 @@ static void usage(void)
 	printf("  -n      Number of NUMA nodes\n");
 }
 
-#else /* no NUMA */
+#else
 int main(void)
 {
-	tst_brkm(TCONF, NULL, "no NUMA development packages installed.");
+	tst_brkm(TCONF, NULL, "test requires libnuma >= 2 and it's development packages");
 }
 #endif
diff --git a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
index daa5f5dcc..90c4f9662 100644
--- a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
+++ b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
@@ -57,6 +57,7 @@
 #if HAVE_NUMAIF_H
 #include <numaif.h>
 #endif
+
 #include "test.h"
 #include "lapi/syscalls.h"
 #include "include_j_h.h"
@@ -66,8 +67,7 @@
 char *TCID = "get_mempolicy01";
 int TST_TOTAL = 1;
 
-#if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_MPOL_CONSTANTS && \
-	defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 
 #define MEM_LENGTH	(4 * 1024 * 1024)
 
@@ -311,9 +311,10 @@ static void setup(void)
 	TEST_PAUSE;
 	tst_tmpdir();
 }
+
 #else
 int main(void)
 {
-	tst_brkm(TCONF, NULL, "System doesn't have required numa support");
+	tst_brkm(TCONF, NULL, "test requires libnuma >= 2 and it's development packages");
 }
 #endif
diff --git a/testcases/kernel/syscalls/mbind/mbind01.c b/testcases/kernel/syscalls/mbind/mbind01.c
index be5470691..291cf3e95 100644
--- a/testcases/kernel/syscalls/mbind/mbind01.c
+++ b/testcases/kernel/syscalls/mbind/mbind01.c
@@ -22,12 +22,15 @@
  */
 
 #include <errno.h>
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
 
+#include "config.h"
 #include "numa_helper.h"
 #include "tst_test.h"
 
-#if HAVE_NUMA_H && HAVE_NUMAIF_H && HAVE_MPOL_CONSTANTS && \
-	defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 
 #define MEM_LENGTH (4 * 1024 * 1024)
 
@@ -233,6 +236,6 @@ static struct tst_test test = {
 	.setup = setup,
 };
 
-#else /* libnuma >= 2 */
-TST_TEST_TCONF("test requires libnuma >= 2.");
+#else
+TST_TEST_TCONF("test requires libnuma >= 2 and it's development packages");
 #endif
diff --git a/testcases/kernel/syscalls/migrate_pages/migrate_pages01.c b/testcases/kernel/syscalls/migrate_pages/migrate_pages01.c
index 32c78b29a..6add4fa67 100644
--- a/testcases/kernel/syscalls/migrate_pages/migrate_pages01.c
+++ b/testcases/kernel/syscalls/migrate_pages/migrate_pages01.c
@@ -55,7 +55,9 @@ option_t options[] = {
 	{NULL, NULL, NULL}
 };
 
-#if defined(__NR_migrate_pages) && HAVE_NUMA_H && HAVE_NUMAIF_H
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2 \
+	&& defined(__NR_migrate_pages)
+
 static unsigned long *sane_old_nodes;
 static unsigned long *sane_new_nodes;
 static int sane_nodemask_size;
@@ -249,10 +251,10 @@ static void cleanup(void)
 	free(sane_new_nodes);
 }
 
-#else /* __NR_migrate_pages */
+#else
 int main(void)
 {
-	tst_brkm(TCONF, NULL, "System doesn't support __NR_migrate_pages"
-		 " or libnuma is not available");
+	tst_brkm(TCONF, NULL, "System doesn't support __NR_migrate_pages or "
+		 "libnuma or libnuma development packages are not available");
 }
 #endif
diff --git a/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c b/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
index 6755a384d..480fbd20c 100644
--- a/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
+++ b/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
@@ -45,6 +45,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <pwd.h>
+
 #include "config.h"
 #include "test.h"
 #include "safe_macros.h"
@@ -65,7 +66,9 @@
 char *TCID = "migrate_pages02";
 int TST_TOTAL = 1;
 
-#if defined(__NR_migrate_pages) && HAVE_NUMA_H && HAVE_NUMAIF_H
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2 \
+	&& defined(__NR_migrate_pages)
+
 static const char nobody_uid[] = "nobody";
 static struct passwd *ltpuser;
 static int *nodes, nodeA, nodeB;
@@ -397,10 +400,10 @@ static void cleanup(void)
 	free(nodes);
 }
 
-#else /* __NR_migrate_pages */
+#else
 int main(void)
 {
-	tst_brkm(TCONF, NULL, "System doesn't support __NR_migrate_pages"
-		 " or libnuma is not available");
+	tst_brkm(TCONF, NULL, "System doesn't support __NR_migrate_pages or "
+		 "libnuma or libnuma development packages are not available");
 }
 #endif
diff --git a/testcases/kernel/syscalls/move_pages/move_pages_support.c b/testcases/kernel/syscalls/move_pages/move_pages_support.c
index a488c88f0..3fce8b77f 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages_support.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages_support.c
@@ -16,6 +16,7 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "config.h"
 #include <sys/mman.h>
 #include <sys/syscall.h>
 #include <unistd.h>
@@ -35,8 +36,7 @@ long get_page_size(void)
  */
 void free_pages(void **pages, unsigned int num)
 {
-
-#if HAVE_NUMA_H
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 	int i;
 	size_t onepage = get_page_size();
 
@@ -111,7 +111,7 @@ int alloc_pages_linear(void **pages, unsigned int num)
 {
 	int nodes[num];
 
-#if HAVE_NUMA_H
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 	unsigned int i;
 	unsigned int n = 0;
 	int num_allowed_nodes;
@@ -168,7 +168,7 @@ int alloc_pages_on_node(void **pages, unsigned int num, int node)
 void
 verify_pages_on_nodes(void **pages, int *status, unsigned int num, int *nodes)
 {
-#if HAVE_NUMA_H
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 	unsigned int i;
 	int which_node;
 	int ret;
@@ -214,7 +214,7 @@ verify_pages_on_nodes(void **pages, int *status, unsigned int num, int *nodes)
  */
 void verify_pages_linear(void **pages, int *status, unsigned int num)
 {
-#if HAVE_NUMA_H
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 	unsigned int i;
 	unsigned int n = 0;
 	int nodes[num];
@@ -269,7 +269,7 @@ void verify_pages_on_node(void **pages, int *status, unsigned int num, int node)
  */
 int alloc_shared_pages_on_node(void **pages, unsigned int num, int node)
 {
-#if HAVE_NUMA_H
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 	char *shared;
 	unsigned int i;
 	int nodes[num];
@@ -392,7 +392,7 @@ void free_sem(sem_t * sem, int num)
  */
 void check_config(unsigned int min_nodes)
 {
-#if HAVE_NUMA_H && HAVE_NUMAIF_H
+#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
 	int num_allowed_nodes;
 	int ret;
 
-- 
2.14.2


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

* [LTP] [PATCH v4 12/14] numa: Check for API >= v2 with autoconf
  2017-10-16 15:41 [LTP] [PATCH v4 00/14] Fix 32-bit cross compilation Petr Vorel
                   ` (10 preceding siblings ...)
  2017-10-16 15:42 ` [LTP] [PATCH v4 11/14] m4, kernel/lib: Detect libnuma presence in kernel libs Petr Vorel
@ 2017-10-16 15:42 ` Petr Vorel
  2017-10-16 15:42 ` [LTP] [PATCH v4 13/14] numa: Remove HAVE_NUMA_ALLOC_ONNODE definition Petr Vorel
  2017-10-16 15:42 ` [LTP] [PATCH v4 14/14] numa: Remove HAVE_NUMA_MOVE_PAGES definition Petr Vorel
  13 siblings, 0 replies; 17+ messages in thread
From: Petr Vorel @ 2017-10-16 15:42 UTC (permalink / raw)
  To: ltp

instead of more verbose check in C code.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 m4/ltp-numa.m4                                               | 12 ++++++++++--
 .../cpuset/cpuset_syscall_test/cpuset_syscall_test.c         |  3 +--
 testcases/kernel/hotplug/memory_hotplug/commands.c           |  2 +-
 testcases/kernel/hotplug/memory_hotplug/memtoy.c             |  3 ++-
 testcases/kernel/hotplug/memory_hotplug/segment.c            |  3 ++-
 testcases/kernel/lib/numa_helper.c                           | 12 ++++++------
 testcases/kernel/mem/cpuset/cpuset01.c                       |  3 ++-
 testcases/kernel/mem/ksm/ksm02.c                             |  3 +--
 testcases/kernel/mem/ksm/ksm04.c                             |  3 +--
 testcases/kernel/mem/ksm/ksm06.c                             |  3 +--
 testcases/kernel/mem/lib/mem.c                               |  6 +++---
 testcases/kernel/mem/oom/oom02.c                             |  2 +-
 testcases/kernel/mem/oom/oom03.c                             |  2 +-
 testcases/kernel/mem/oom/oom04.c                             |  2 +-
 testcases/kernel/mem/oom/oom05.c                             |  2 +-
 testcases/kernel/mem/vma/vma02.c                             |  2 +-
 testcases/kernel/mem/vma/vma04.c                             |  2 +-
 testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c    |  2 +-
 testcases/kernel/syscalls/mbind/mbind01.c                    |  2 +-
 testcases/kernel/syscalls/migrate_pages/migrate_pages01.c    |  3 +--
 testcases/kernel/syscalls/migrate_pages/migrate_pages02.c    |  3 +--
 testcases/kernel/syscalls/move_pages/move_pages_support.c    | 12 ++++++------
 22 files changed, 46 insertions(+), 41 deletions(-)

diff --git a/m4/ltp-numa.m4 b/m4/ltp-numa.m4
index f21e38858..547fa58a5 100644
--- a/m4/ltp-numa.m4
+++ b/m4/ltp-numa.m4
@@ -27,9 +27,17 @@ AC_DEFUN([LTP_CHECK_SYSCALL_NUMA], [
 	AC_CHECK_LIB(numa, numa_available, [have_libnuma=yes])
 	AC_CHECK_HEADERS([numa.h numaif.h], [], [have_numa_headers=no])
 
-	if test "x$have_libnuma" = "xyes" -a "x$have_numa_headers" != "xno"; then
+	AC_RUN_IFELSE([AC_LANG_PROGRAM([
+#include <numa.h>
+		], [
+#if LIBNUMA_API_VERSION < 2
+exit(1);
+#endif
+		])], [have_numa_headers_v2=yes])
+
+	if test "x$have_libnuma" = "xyes" -a "x$have_numa_headers" != "xno" -a "x$have_numa_headers_v2" = "xyes"; then
 		AC_SUBST(NUMA_LIBS, "-lnuma")
-		AC_DEFINE(HAVE_LIBNUMA, 1, [Define to 1 if you have libnuma and it's headers installed.])
+		AC_DEFINE(HAVE_NUMA_V2, 1, [Define to 1 if you have libnuma and it's headers version >= 2 installed.])
 
 		AC_CHECK_LIB(numa, numa_alloc_onnode, [
 			AC_DEFINE(HAVE_NUMA_ALLOC_ONNODE, 1, [Define to 1 if you have `numa_alloc_onnode' function.])
diff --git a/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c b/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c
index 6a6c7a803..9e568a970 100644
--- a/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c
+++ b/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c
@@ -51,8 +51,7 @@
 char *TCID = "cpuset_syscall_test";
 int TST_TOTAL = 1;
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2 \
-	&& defined(HAVE_LINUX_MEMPOLICY_H)
+#ifdef defined(HAVE_NUMA_V2) && defined(HAVE_LINUX_MEMPOLICY_H)
 
 #include "../cpuset_lib/cpuset.h"
 #include "../cpuset_lib/bitmask.h"
diff --git a/testcases/kernel/hotplug/memory_hotplug/commands.c b/testcases/kernel/hotplug/memory_hotplug/commands.c
index 54a79224d..886ee82f7 100644
--- a/testcases/kernel/hotplug/memory_hotplug/commands.c
+++ b/testcases/kernel/hotplug/memory_hotplug/commands.c
@@ -33,7 +33,7 @@
 #include <numa.h>
 #endif
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/mman.h>
diff --git a/testcases/kernel/hotplug/memory_hotplug/memtoy.c b/testcases/kernel/hotplug/memory_hotplug/memtoy.c
index 40d08ef63..fe76fb9d8 100644
--- a/testcases/kernel/hotplug/memory_hotplug/memtoy.c
+++ b/testcases/kernel/hotplug/memory_hotplug/memtoy.c
@@ -30,7 +30,8 @@
 #include <numa.h>
 #endif
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
+
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/mman.h>
diff --git a/testcases/kernel/hotplug/memory_hotplug/segment.c b/testcases/kernel/hotplug/memory_hotplug/segment.c
index a087eb2e1..73c718ce7 100644
--- a/testcases/kernel/hotplug/memory_hotplug/segment.c
+++ b/testcases/kernel/hotplug/memory_hotplug/segment.c
@@ -32,7 +32,8 @@
 #include <numa.h>
 #endif
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
+
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/mman.h>
diff --git a/testcases/kernel/lib/numa_helper.c b/testcases/kernel/lib/numa_helper.c
index 095285bb2..2eee8d35d 100644
--- a/testcases/kernel/lib/numa_helper.c
+++ b/testcases/kernel/lib/numa_helper.c
@@ -39,13 +39,13 @@
 unsigned long get_max_node(void)
 {
 	unsigned long max_node = 0;
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 	max_node = numa_max_possible_node() + 1;
 #endif
 	return max_node;
 }
 
-#ifdef HAVE_LIBNUMA
+#ifdef HAVE_NUMA_V2
 static void get_nodemask_allnodes(nodemask_t * nodemask, unsigned long max_node)
 {
 	unsigned long nodemask_size = max_node / 8;
@@ -134,7 +134,7 @@ static void filter_nodemask_cpu(nodemask_t * nodemask, unsigned long max_node)
 	}
 	free(cpumask);
 }
-#endif /* HAVE_LIBNUMA */
+#endif /* HAVE_NUMA_V2 */
 
 /*
  * get_allowed_nodes_arr - get number and array of available nodes
@@ -152,7 +152,7 @@ static void filter_nodemask_cpu(nodemask_t * nodemask, unsigned long max_node)
 int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes)
 {
 	int ret = 0;
-#ifdef HAVE_LIBNUMA
+#ifdef HAVE_NUMA_V2
 	int i;
 	nodemask_t *nodemask = NULL;
 #endif
@@ -160,7 +160,7 @@ int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes)
 	if (nodes)
 		*nodes = NULL;
 
-#ifdef HAVE_LIBNUMA
+#ifdef HAVE_NUMA_V2
 	unsigned long max_node, nodemask_size;
 
 	if (numa_available() == -1)
@@ -198,7 +198,7 @@ int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes)
 		}
 	} while (0);
 	free(nodemask);
-#endif /* HAVE_LIBNUMA */
+#endif /* HAVE_NUMA_V2 */
 	return ret;
 }
 
diff --git a/testcases/kernel/mem/cpuset/cpuset01.c b/testcases/kernel/mem/cpuset/cpuset01.c
index 4efb01f23..354b6fc32 100644
--- a/testcases/kernel/mem/cpuset/cpuset01.c
+++ b/testcases/kernel/mem/cpuset/cpuset01.c
@@ -33,7 +33,8 @@
 #include "mem.h"
 #include "numa_helper.h"
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
+
 volatile int end;
 static int *nodes;
 static int nnodes;
diff --git a/testcases/kernel/mem/ksm/ksm02.c b/testcases/kernel/mem/ksm/ksm02.c
index 801412fd7..e8ac8aa15 100644
--- a/testcases/kernel/mem/ksm/ksm02.c
+++ b/testcases/kernel/mem/ksm/ksm02.c
@@ -62,8 +62,7 @@
 #include "mem.h"
 #include "ksm_common.h"
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2 \
-	&& HAVE_LINUX_MEMPOLICY_H
+#if defined(HAVE_NUMA_V2) && defined(HAVE_LINUX_MEMPOLICY_H)
 
 static void verify_ksm(void)
 {
diff --git a/testcases/kernel/mem/ksm/ksm04.c b/testcases/kernel/mem/ksm/ksm04.c
index bdce8b9fb..1070bfba1 100644
--- a/testcases/kernel/mem/ksm/ksm04.c
+++ b/testcases/kernel/mem/ksm/ksm04.c
@@ -62,8 +62,7 @@
 #include "mem.h"
 #include "ksm_common.h"
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2 \
-	&& HAVE_LINUX_MEMPOLICY_H
+#if defined(HAVE_NUMA_V2) && defined(HAVE_LINUX_MEMPOLICY_H)
 
 static void verify_ksm(void)
 {
diff --git a/testcases/kernel/mem/ksm/ksm06.c b/testcases/kernel/mem/ksm/ksm06.c
index 4763460cf..e0fa0270e 100644
--- a/testcases/kernel/mem/ksm/ksm06.c
+++ b/testcases/kernel/mem/ksm/ksm06.c
@@ -42,8 +42,7 @@
 #include "mem.h"
 #include "numa_helper.h"
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2 \
-	&& HAVE_LINUX_MEMPOLICY_H
+#if defined(HAVE_NUMA_V2) && defined(HAVE_LINUX_MEMPOLICY_H)
 
 static int run = -1;
 static int sleep_millisecs = -1;
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index c046c77c5..fc2f130f4 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -162,7 +162,7 @@ void oom(int testcase, int lite, int retcode, int allow_sigkill)
 	}
 }
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 static void set_global_mempolicy(int mempolicy)
 {
 	unsigned long nmask[MAXNODES / BITS_PER_LONG] = { 0 };
@@ -563,7 +563,7 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages)
 	unsigned long length;
 	unsigned long pagesize;
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 	unsigned long nmask[MAXNODES / BITS_PER_LONG] = { 0 };
 #endif
 
@@ -588,7 +588,7 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages)
 			tst_brk(TBROK|TERRNO, "madvise");
 #endif
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 		clean_node(nmask);
 		set_node(nmask, nodes[i]);
 		/*
diff --git a/testcases/kernel/mem/oom/oom02.c b/testcases/kernel/mem/oom/oom02.c
index 6bc08213f..45e64d370 100644
--- a/testcases/kernel/mem/oom/oom02.c
+++ b/testcases/kernel/mem/oom/oom02.c
@@ -33,7 +33,7 @@
 #include "numa_helper.h"
 #include "mem.h"
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 
 static void verify_oom(void)
 {
diff --git a/testcases/kernel/mem/oom/oom03.c b/testcases/kernel/mem/oom/oom03.c
index 29159d629..c4b90c190 100644
--- a/testcases/kernel/mem/oom/oom03.c
+++ b/testcases/kernel/mem/oom/oom03.c
@@ -33,7 +33,7 @@
 #include "numa_helper.h"
 #include "mem.h"
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 
 static void verify_oom(void)
 {
diff --git a/testcases/kernel/mem/oom/oom04.c b/testcases/kernel/mem/oom/oom04.c
index 39fedd2a8..7dbf9ce70 100644
--- a/testcases/kernel/mem/oom/oom04.c
+++ b/testcases/kernel/mem/oom/oom04.c
@@ -33,7 +33,7 @@
 #include "numa_helper.h"
 #include "mem.h"
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 
 static void verify_oom(void)
 {
diff --git a/testcases/kernel/mem/oom/oom05.c b/testcases/kernel/mem/oom/oom05.c
index 7095974c5..eb2453156 100644
--- a/testcases/kernel/mem/oom/oom05.c
+++ b/testcases/kernel/mem/oom/oom05.c
@@ -33,7 +33,7 @@
 #include "numa_helper.h"
 #include "mem.h"
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 
 static void verify_oom(void)
 {
diff --git a/testcases/kernel/mem/vma/vma02.c b/testcases/kernel/mem/vma/vma02.c
index 99642e39e..33d000d01 100644
--- a/testcases/kernel/mem/vma/vma02.c
+++ b/testcases/kernel/mem/vma/vma02.c
@@ -49,7 +49,7 @@
 char *TCID = "vma02";
 int TST_TOTAL = 1;
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 
 static unsigned long pagesize;
 static int opt_node;
diff --git a/testcases/kernel/mem/vma/vma04.c b/testcases/kernel/mem/vma/vma04.c
index 030a92691..a5918bcb7 100644
--- a/testcases/kernel/mem/vma/vma04.c
+++ b/testcases/kernel/mem/vma/vma04.c
@@ -53,7 +53,7 @@
 char *TCID = "vma04";
 int TST_TOTAL = 5;
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 
 static unsigned long pagesize;
 static int opt_node;
diff --git a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
index 90c4f9662..a1b9e4327 100644
--- a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
+++ b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
@@ -67,7 +67,7 @@
 char *TCID = "get_mempolicy01";
 int TST_TOTAL = 1;
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 
 #define MEM_LENGTH	(4 * 1024 * 1024)
 
diff --git a/testcases/kernel/syscalls/mbind/mbind01.c b/testcases/kernel/syscalls/mbind/mbind01.c
index 291cf3e95..4eb7da698 100644
--- a/testcases/kernel/syscalls/mbind/mbind01.c
+++ b/testcases/kernel/syscalls/mbind/mbind01.c
@@ -30,7 +30,7 @@
 #include "numa_helper.h"
 #include "tst_test.h"
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 
 #define MEM_LENGTH (4 * 1024 * 1024)
 
diff --git a/testcases/kernel/syscalls/migrate_pages/migrate_pages01.c b/testcases/kernel/syscalls/migrate_pages/migrate_pages01.c
index 6add4fa67..01409f300 100644
--- a/testcases/kernel/syscalls/migrate_pages/migrate_pages01.c
+++ b/testcases/kernel/syscalls/migrate_pages/migrate_pages01.c
@@ -55,8 +55,7 @@ option_t options[] = {
 	{NULL, NULL, NULL}
 };
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2 \
-	&& defined(__NR_migrate_pages)
+#if defined(HAVE_NUMA_V2) && defined(__NR_migrate_pages)
 
 static unsigned long *sane_old_nodes;
 static unsigned long *sane_new_nodes;
diff --git a/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c b/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
index 480fbd20c..faf96b6b7 100644
--- a/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
+++ b/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
@@ -66,8 +66,7 @@
 char *TCID = "migrate_pages02";
 int TST_TOTAL = 1;
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2 \
-	&& defined(__NR_migrate_pages)
+#if defined(HAVE_NUMA_V2) && defined(__NR_migrate_pages)
 
 static const char nobody_uid[] = "nobody";
 static struct passwd *ltpuser;
diff --git a/testcases/kernel/syscalls/move_pages/move_pages_support.c b/testcases/kernel/syscalls/move_pages/move_pages_support.c
index 3fce8b77f..340a715fc 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages_support.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages_support.c
@@ -36,7 +36,7 @@ long get_page_size(void)
  */
 void free_pages(void **pages, unsigned int num)
 {
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 	int i;
 	size_t onepage = get_page_size();
 
@@ -111,7 +111,7 @@ int alloc_pages_linear(void **pages, unsigned int num)
 {
 	int nodes[num];
 
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 	unsigned int i;
 	unsigned int n = 0;
 	int num_allowed_nodes;
@@ -168,7 +168,7 @@ int alloc_pages_on_node(void **pages, unsigned int num, int node)
 void
 verify_pages_on_nodes(void **pages, int *status, unsigned int num, int *nodes)
 {
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 	unsigned int i;
 	int which_node;
 	int ret;
@@ -214,7 +214,7 @@ verify_pages_on_nodes(void **pages, int *status, unsigned int num, int *nodes)
  */
 void verify_pages_linear(void **pages, int *status, unsigned int num)
 {
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 	unsigned int i;
 	unsigned int n = 0;
 	int nodes[num];
@@ -269,7 +269,7 @@ void verify_pages_on_node(void **pages, int *status, unsigned int num, int node)
  */
 int alloc_shared_pages_on_node(void **pages, unsigned int num, int node)
 {
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 	char *shared;
 	unsigned int i;
 	int nodes[num];
@@ -392,7 +392,7 @@ void free_sem(sem_t * sem, int num)
  */
 void check_config(unsigned int min_nodes)
 {
-#if HAVE_LIBNUMA && defined(LIBNUMA_API_VERSION) && LIBNUMA_API_VERSION >= 2
+#ifdef HAVE_NUMA_V2
 	int num_allowed_nodes;
 	int ret;
 
-- 
2.14.2


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

* [LTP] [PATCH v4 13/14] numa: Remove HAVE_NUMA_ALLOC_ONNODE definition
  2017-10-16 15:41 [LTP] [PATCH v4 00/14] Fix 32-bit cross compilation Petr Vorel
                   ` (11 preceding siblings ...)
  2017-10-16 15:42 ` [LTP] [PATCH v4 12/14] numa: Check for API >= v2 with autoconf Petr Vorel
@ 2017-10-16 15:42 ` Petr Vorel
  2017-10-16 15:42 ` [LTP] [PATCH v4 14/14] numa: Remove HAVE_NUMA_MOVE_PAGES definition Petr Vorel
  13 siblings, 0 replies; 17+ messages in thread
From: Petr Vorel @ 2017-10-16 15:42 UTC (permalink / raw)
  To: ltp

numa_alloc_onnode() was added in libnuma v0.6 and we require
NUMA API v2 => replace with HAVE_NUMA_V2 definition.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 include/config.h.default                                  | 3 ---
 m4/ltp-numa.m4                                            | 3 ---
 testcases/kernel/syscalls/move_pages/move_pages_support.c | 4 ++--
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/include/config.h.default b/include/config.h.default
index ef6a3d55f..8b245fce0 100644
--- a/include/config.h.default
+++ b/include/config.h.default
@@ -125,9 +125,6 @@
 /* 2.6 version of swapon/swapoff */
 #define HAVE_NEW_SWAPONOFF 1
 
-/* Define to 1 if you have the `numa_alloc_onnode' function. */
-#undef HAVE_NUMA_ALLOC_ONNODE
-
 /* Define to 1 if you have the <numa.h> header file. */
 #undef HAVE_NUMA_H
 
diff --git a/m4/ltp-numa.m4 b/m4/ltp-numa.m4
index 547fa58a5..56a2b81f7 100644
--- a/m4/ltp-numa.m4
+++ b/m4/ltp-numa.m4
@@ -39,9 +39,6 @@ exit(1);
 		AC_SUBST(NUMA_LIBS, "-lnuma")
 		AC_DEFINE(HAVE_NUMA_V2, 1, [Define to 1 if you have libnuma and it's headers version >= 2 installed.])
 
-		AC_CHECK_LIB(numa, numa_alloc_onnode, [
-			AC_DEFINE(HAVE_NUMA_ALLOC_ONNODE, 1, [Define to 1 if you have `numa_alloc_onnode' function.])
-		])
 		AC_CHECK_LIB(numa, numa_move_pages, [
 			AC_DEFINE(HAVE_NUMA_MOVE_PAGES, 1, [Define to 1 if you have `numa_move_pages' function.])
 		])
diff --git a/testcases/kernel/syscalls/move_pages/move_pages_support.c b/testcases/kernel/syscalls/move_pages/move_pages_support.c
index 340a715fc..31f74968f 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages_support.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages_support.c
@@ -63,7 +63,7 @@ void free_pages(void **pages, unsigned int num)
 int alloc_pages_on_nodes(void **pages, unsigned int num, int *nodes)
 {
 	int i;
-#if HAVE_NUMA_ALLOC_ONNODE
+#ifdef HAVE_NUMA_V2
 	size_t onepage = get_page_size();
 #endif
 
@@ -74,7 +74,7 @@ int alloc_pages_on_nodes(void **pages, unsigned int num, int *nodes)
 	for (i = 0; i < num; i++) {
 		char *page;
 
-#if HAVE_NUMA_ALLOC_ONNODE
+#ifdef HAVE_NUMA_V2
 		pages[i] = numa_alloc_onnode(onepage, nodes[i]);
 #endif
 		if (pages[i] == NULL) {
-- 
2.14.2


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

* [LTP] [PATCH v4 14/14] numa: Remove HAVE_NUMA_MOVE_PAGES definition
  2017-10-16 15:41 [LTP] [PATCH v4 00/14] Fix 32-bit cross compilation Petr Vorel
                   ` (12 preceding siblings ...)
  2017-10-16 15:42 ` [LTP] [PATCH v4 13/14] numa: Remove HAVE_NUMA_ALLOC_ONNODE definition Petr Vorel
@ 2017-10-16 15:42 ` Petr Vorel
  13 siblings, 0 replies; 17+ messages in thread
From: Petr Vorel @ 2017-10-16 15:42 UTC (permalink / raw)
  To: ltp

numa_move_pages() was added in NUMA API v2 => replace with
HAVE_NUMA_V2 definition.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 m4/ltp-numa.m4                                      | 4 ----
 testcases/kernel/syscalls/move_pages/move_pages01.c | 4 ++--
 testcases/kernel/syscalls/move_pages/move_pages02.c | 4 ++--
 testcases/kernel/syscalls/move_pages/move_pages03.c | 4 ++--
 testcases/kernel/syscalls/move_pages/move_pages04.c | 4 ++--
 testcases/kernel/syscalls/move_pages/move_pages05.c | 4 ++--
 testcases/kernel/syscalls/move_pages/move_pages06.c | 4 ++--
 testcases/kernel/syscalls/move_pages/move_pages07.c | 4 ++--
 testcases/kernel/syscalls/move_pages/move_pages08.c | 4 ++--
 testcases/kernel/syscalls/move_pages/move_pages09.c | 4 ++--
 testcases/kernel/syscalls/move_pages/move_pages10.c | 4 ++--
 testcases/kernel/syscalls/move_pages/move_pages11.c | 4 ++--
 testcases/kernel/syscalls/move_pages/move_pages12.c | 4 ++--
 13 files changed, 24 insertions(+), 28 deletions(-)

diff --git a/m4/ltp-numa.m4 b/m4/ltp-numa.m4
index 56a2b81f7..f199643a1 100644
--- a/m4/ltp-numa.m4
+++ b/m4/ltp-numa.m4
@@ -38,9 +38,5 @@ exit(1);
 	if test "x$have_libnuma" = "xyes" -a "x$have_numa_headers" != "xno" -a "x$have_numa_headers_v2" = "xyes"; then
 		AC_SUBST(NUMA_LIBS, "-lnuma")
 		AC_DEFINE(HAVE_NUMA_V2, 1, [Define to 1 if you have libnuma and it's headers version >= 2 installed.])
-
-		AC_CHECK_LIB(numa, numa_move_pages, [
-			AC_DEFINE(HAVE_NUMA_MOVE_PAGES, 1, [Define to 1 if you have `numa_move_pages' function.])
-		])
 	fi
 ])
diff --git a/testcases/kernel/syscalls/move_pages/move_pages01.c b/testcases/kernel/syscalls/move_pages/move_pages01.c
index 6f9bd896d..e86c5fc80 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages01.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages01.c
@@ -72,7 +72,7 @@ int main(int argc, char **argv)
 
 	setup();
 
-#if HAVE_NUMA_MOVE_PAGES
+#ifdef HAVE_NUMA_V2
 	int lc;
 
 	/* check for looping state if -i option is given */
@@ -101,7 +101,7 @@ int main(int argc, char **argv)
 
 	}
 #else
-	tst_resm(TCONF, "move_pages support not found.");
+	tst_resm(TCONF, "test requires libnuma >= 2 and it's development packages");
 #endif
 
 	cleanup();
diff --git a/testcases/kernel/syscalls/move_pages/move_pages02.c b/testcases/kernel/syscalls/move_pages/move_pages02.c
index 23594ab1b..ee84b92a7 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages02.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages02.c
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
 
 	setup();
 
-#if HAVE_NUMA_MOVE_PAGES
+#ifdef HAVE_NUMA_V2
 	unsigned int i;
 	int lc;
 	unsigned int from_node;
@@ -117,7 +117,7 @@ int main(int argc, char **argv)
 		free_pages(pages, TEST_PAGES);
 	}
 #else
-	tst_resm(TCONF, "move_pages support not found.");
+	tst_resm(TCONF, "test requires libnuma >= 2 and it's development packages");
 #endif
 
 	cleanup();
diff --git a/testcases/kernel/syscalls/move_pages/move_pages03.c b/testcases/kernel/syscalls/move_pages/move_pages03.c
index ec036e610..f3f4fd9c1 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages03.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages03.c
@@ -111,7 +111,7 @@ int main(int argc, char **argv)
 
 	setup();
 
-#if HAVE_NUMA_MOVE_PAGES
+#ifdef HAVE_NUMA_V2
 	unsigned int i;
 	int lc;
 	unsigned int from_node;
@@ -183,7 +183,7 @@ err_free_pages:
 		free_shared_pages(pages, TEST_PAGES);
 	}
 #else
-	tst_resm(TCONF, "move_pages support not found.");
+	tst_resm(TCONF, "test requires libnuma >= 2 and it's development packages");
 #endif
 
 	cleanup();
diff --git a/testcases/kernel/syscalls/move_pages/move_pages04.c b/testcases/kernel/syscalls/move_pages/move_pages04.c
index 0182538c0..3678df0e0 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages04.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages04.c
@@ -84,7 +84,7 @@ int main(int argc, char **argv)
 
 	setup();
 
-#if HAVE_NUMA_MOVE_PAGES
+#ifdef HAVE_NUMA_V2
 	unsigned int i;
 	int lc;
 	unsigned int from_node;
@@ -150,7 +150,7 @@ err_free_pages:
 		free_pages(pages, TEST_PAGES);
 	}
 #else
-	tst_resm(TCONF, "move_pages support not found.");
+	tst_resm(TCONF, "test requires libnuma >= 2 and it's development packages");
 #endif
 
 	cleanup();
diff --git a/testcases/kernel/syscalls/move_pages/move_pages05.c b/testcases/kernel/syscalls/move_pages/move_pages05.c
index 10264ef20..da9642e7e 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages05.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages05.c
@@ -112,7 +112,7 @@ int main(int argc, char **argv)
 
 	setup();
 
-#if HAVE_NUMA_MOVE_PAGES
+#ifdef HAVE_NUMA_V2
 	unsigned int i;
 	int lc;
 	unsigned int from_node;
@@ -198,7 +198,7 @@ err_free_shared:
 		free_shared_pages(pages + SHARED_PAGE, N_SHARED_PAGES);
 	}
 #else
-	tst_resm(TCONF, "move_pages support not found.");
+	tst_resm(TCONF, "test requires libnuma >= 2 and it's development packages");
 #endif
 
 	cleanup();
diff --git a/testcases/kernel/syscalls/move_pages/move_pages06.c b/testcases/kernel/syscalls/move_pages/move_pages06.c
index 847fc6279..0edb58218 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages06.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages06.c
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
 
 	setup();
 
-#if HAVE_NUMA_MOVE_PAGES
+#ifdef HAVE_NUMA_V2
 	unsigned int i;
 	int lc;
 	unsigned int from_node;
@@ -113,7 +113,7 @@ int main(int argc, char **argv)
 		free_pages(pages, TEST_PAGES);
 	}
 #else
-	tst_resm(TCONF, "move_pages support not found.");
+	tst_resm(TCONF, "test requires libnuma >= 2 and it's development packages");
 #endif
 
 	cleanup();
diff --git a/testcases/kernel/syscalls/move_pages/move_pages07.c b/testcases/kernel/syscalls/move_pages/move_pages07.c
index b8653bd8c..0ed54b77a 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages07.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages07.c
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
 
 	setup();
 
-#if HAVE_NUMA_MOVE_PAGES
+#ifdef HAVE_NUMA_V2
 	unsigned int i;
 	int lc;
 	unsigned int from_node;
@@ -115,7 +115,7 @@ int main(int argc, char **argv)
 		free_pages(pages, TEST_PAGES);
 	}
 #else
-	tst_resm(TCONF, "move_pages support not found.");
+	tst_resm(TCONF, "test requires libnuma >= 2 and it's development packages");
 #endif
 
 	cleanup();
diff --git a/testcases/kernel/syscalls/move_pages/move_pages08.c b/testcases/kernel/syscalls/move_pages/move_pages08.c
index 66544eb2a..bf237f35e 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages08.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages08.c
@@ -74,7 +74,7 @@ int main(int argc, char **argv)
 
 	setup();
 
-#if HAVE_NUMA_MOVE_PAGES
+#ifdef HAVE_NUMA_V2
 	unsigned int i;
 	int lc;
 	unsigned int from_node;
@@ -113,7 +113,7 @@ int main(int argc, char **argv)
 		free_pages(pages, TEST_PAGES);
 	}
 #else
-	tst_resm(TCONF, "move_pages support not found.");
+	tst_resm(TCONF, "test requires libnuma >= 2 and it's development packages");
 #endif
 
 	cleanup();
diff --git a/testcases/kernel/syscalls/move_pages/move_pages09.c b/testcases/kernel/syscalls/move_pages/move_pages09.c
index d217fc2a1..2d9dc4680 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages09.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages09.c
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
 
 	setup();
 
-#if HAVE_NUMA_MOVE_PAGES
+#ifdef HAVE_NUMA_V2
 	unsigned int i;
 	int lc;
 	unsigned int from_node;
@@ -125,7 +125,7 @@ int main(int argc, char **argv)
 		free_pages(pages, TEST_PAGES);
 	}
 #else
-	tst_resm(TCONF, "move_pages support not found.");
+	tst_resm(TCONF, "test requires libnuma >= 2 and it's development packages");
 #endif
 
 	cleanup();
diff --git a/testcases/kernel/syscalls/move_pages/move_pages10.c b/testcases/kernel/syscalls/move_pages/move_pages10.c
index 1777ff465..7044135fa 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages10.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages10.c
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
 
 	setup();
 
-#if HAVE_NUMA_MOVE_PAGES
+#ifdef HAVE_NUMA_V2
 	unsigned int i;
 	int lc;
 	unsigned int from_node;
@@ -112,7 +112,7 @@ int main(int argc, char **argv)
 		free_pages(pages, TEST_PAGES);
 	}
 #else
-	tst_resm(TCONF, "move_pages support not found.");
+	tst_resm(TCONF, "test requires libnuma >= 2 and it's development packages");
 #endif
 
 	cleanup();
diff --git a/testcases/kernel/syscalls/move_pages/move_pages11.c b/testcases/kernel/syscalls/move_pages/move_pages11.c
index 773e9c569..a9d84c5d5 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages11.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages11.c
@@ -112,7 +112,7 @@ int main(int argc, char **argv)
 
 	setup();
 
-#if HAVE_NUMA_MOVE_PAGES
+#ifdef HAVE_NUMA_V2
 	unsigned int i;
 	int lc;
 	unsigned int from_node;
@@ -186,7 +186,7 @@ err_free_pages:
 		free_shared_pages(pages, TEST_PAGES);
 	}
 #else
-	tst_resm(TCONF, "move_pages support not found.");
+	tst_resm(TCONF, "test requires libnuma >= 2 and it's development packages");
 #endif
 
 	cleanup();
diff --git a/testcases/kernel/syscalls/move_pages/move_pages12.c b/testcases/kernel/syscalls/move_pages/move_pages12.c
index 4c7d5c2c0..1ac7bc1c4 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages12.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages12.c
@@ -43,7 +43,7 @@
 #include "move_pages_support.h"
 #include "lapi/mmap.h"
 
-#if HAVE_NUMA_MOVE_PAGES
+#ifdef HAVE_NUMA_V2
 
 #define LOOPS	1000
 #define PATH_MEMINFO	"/proc/meminfo"
@@ -267,5 +267,5 @@ static struct tst_test test = {
 };
 
 #else
-	TST_TEST_TCONF("move_pages support not found");
+	TST_TEST_TCONF("test requires libnuma >= 2 and it's development packages");
 #endif
-- 
2.14.2


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

* [LTP] [PATCH v4 03/14] m4: Fix libkeyutils detection on 32-bit cross build
  2017-10-16 15:41 ` [LTP] [PATCH v4 03/14] m4: Fix libkeyutils detection on 32-bit cross build Petr Vorel
@ 2017-10-17 12:42   ` Cyril Hrubis
  0 siblings, 0 replies; 17+ messages in thread
From: Cyril Hrubis @ 2017-10-17 12:42 UTC (permalink / raw)
  To: ltp

Hi!
> +AC_DEFUN([LTP_CHECK_KEYUTILS_SUPPORT], [
> +	AC_CHECK_LIB([keyutils], [add_key],
> +	[AC_DEFINE(HAVE_LIBKEYUTILS, 1, [Define to 1 if you have libkeyutils installed.]),
                                                                                         ^
						I've removed this comma
						otherwise it tries to
						execute command ','
						during the configure
						run.

The [] is actually quotation not an array so the macros in [] are not
separated by commas, only the macro parameters are.

> +	      AC_SUBST(KEYUTILS_LIBS, "-lkeyutils")])
>  ])

And I've pushed the patchset up to this patch, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [PATCH v4 04/14] m4: Fix libaio detection on 32-bit cross build
  2017-10-16 15:41 ` [LTP] [PATCH v4 04/14] m4: Fix libaio " Petr Vorel
@ 2017-10-17 13:29   ` Cyril Hrubis
  0 siblings, 0 replies; 17+ messages in thread
From: Cyril Hrubis @ 2017-10-17 13:29 UTC (permalink / raw)
  To: ltp

Hi!
> +		AC_TRY_LINK(... AC_DEFINE(HAVE_IO_SET_EVENTFD) ...)
                 ^
		 Is this a forgotten placeholder?

>  		AC_TRY_LINK([#include <stdio.h>
>                               #include <libaio.h>
>  		            ],
> -                            [io_set_eventfd(NULL, 0); return 0;
> -			    ],
> -			    [AC_DEFINE(HAVE_IO_SET_EVENTFD)
> -			     AC_MSG_RESULT(yes)],
> -                            [AC_MSG_RESULT(no)])],
> -		AIO_LIBS="")])
> -AC_SUBST(AIO_LIBS)
> +		            [io_set_eventfd(NULL, 0); return 0;],
> +		            [AC_DEFINE(HAVE_IO_SET_EVENTFD, 1, [Define to 1 if you have `io_set_eventfd' function.])])

Okay this AC_TRY_LINK() actually works, but does not produce any output,
notice the AC_MSG_CHECKING() and AC_MSG_RESULT() in the original code.

I was going to suggest to use AC_CHECK_LIB() but the io_set_eventfd() is
inline function defined in the header so we have to stuck with
AC_TRY_LINK().

We also seem to have duplicit libaio.h check in configure.ac.

-- 
Cyril Hrubis
chrubis@suse.cz

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

end of thread, other threads:[~2017-10-17 13:29 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-16 15:41 [LTP] [PATCH v4 00/14] Fix 32-bit cross compilation Petr Vorel
2017-10-16 15:41 ` [LTP] [PATCH v4 01/14] lapi/keyctl.h: Add doc and reorder definitions Petr Vorel
2017-10-16 15:41 ` [LTP] [PATCH v4 02/14] syscalls/request_key: Port to use lapi/keyctl.h header Petr Vorel
2017-10-16 15:41 ` [LTP] [PATCH v4 03/14] m4: Fix libkeyutils detection on 32-bit cross build Petr Vorel
2017-10-17 12:42   ` Cyril Hrubis
2017-10-16 15:41 ` [LTP] [PATCH v4 04/14] m4: Fix libaio " Petr Vorel
2017-10-17 13:29   ` Cyril Hrubis
2017-10-16 15:41 ` [LTP] [PATCH v4 05/14] make: Remove workarounds for build without libnuma Petr Vorel
2017-10-16 15:41 ` [LTP] [PATCH v4 06/14] numa: Drop NUMA API v1 support Petr Vorel
2017-10-16 15:41 ` [LTP] [PATCH v4 07/14] numa: Drop NUMA_CPPFLAGS Petr Vorel
2017-10-16 15:41 ` [LTP] [PATCH v4 08/14] hotplug/memory_hotplug: Update TODO Petr Vorel
2017-10-16 15:42 ` [LTP] [PATCH v4 09/14] hotplug/memory_hotplug: Remove unused header Petr Vorel
2017-10-16 15:42 ` [LTP] [PATCH v4 10/14] hotplug/memory_hotplug: Exit with TCONF when NUMA headers not available Petr Vorel
2017-10-16 15:42 ` [LTP] [PATCH v4 11/14] m4, kernel/lib: Detect libnuma presence in kernel libs Petr Vorel
2017-10-16 15:42 ` [LTP] [PATCH v4 12/14] numa: Check for API >= v2 with autoconf Petr Vorel
2017-10-16 15:42 ` [LTP] [PATCH v4 13/14] numa: Remove HAVE_NUMA_ALLOC_ONNODE definition Petr Vorel
2017-10-16 15:42 ` [LTP] [PATCH v4 14/14] numa: Remove HAVE_NUMA_MOVE_PAGES definition Petr Vorel

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