Fix 32-bit cross compilation
v4 cover Fix 32-bit cross compilation
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(-)
Signature · 1 line
2.14.2
PATCH v4 1/14 lapi/keyctl.h: Add doc and reorder definitions
--- include/lapi/keyctl.h | 55 +++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 26 deletions(-)
include/lapi/keyctl.h +29 -26
@@ -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__ */
Signature · 1 line
2.14.2
PATCH v4 2/14 syscalls/request_key: Port to use lapi/keyctl.h header
In reply to Petr Vorel+ minor whitespace cleanup
--- 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(-)
include/lapi/keyctl.h +9 -0
@@ -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__ */
testcases/kernel/syscalls/request_key/request_key01.c +26 -36
75 lines not on this page · raw message
testcases/kernel/syscalls/request_key/request_key02.c +29 -39
81 lines not on this page · raw message
Signature · 1 line
2.14.2
PATCH v4 3/14 m4: Fix libkeyutils detection on 32-bit cross build
In reply to Petr Vorel--- configure.ac | 1 + include/lapi/keyctl.h | 6 ++++-- m4/ltp-keyutils.m4 | 9 ++++++--- 3 files changed, 11 insertions(+), 5 deletions(-)
configure.ac +1 -0
@@ -32,6 +32,7 @@ AC_PREFIX_DEFAULT(/opt/ltp) AC_CHECK_HEADERS([ \ ifaddrs.h \ + keyutils.h \ libaio.h \ linux/can.h \ linux/genetlink.h \
include/lapi/keyctl.h +4 -2
@@ -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
m4/ltp-keyutils.m4 +6 -3
@@ -1,5 +1,7 @@ dnl dnl Copyright (c) 2016 Fujitsu Ltd. +dnl Copyright (c) 2017 Petr Vorel <[email protected]> +dnl dnl Author: Xiao Yang <[email protected]> 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")]) ])
Signature · 1 line
2.14.2
PATCH v4 3/14 m4: Fix libkeyutils detection on 32-bit cross build
Hi!
m4/ltp-keyutils.m4 dnl · line 25
Quoted 3 lines
m4/ltp-keyutils.m4 +3
-0+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.
m4/ltp-keyutils.m4 dnl · line 27
Quoted 2 lines
m4/ltp-keyutils.m4 +1
-0+ AC_SUBST(KEYUTILS_LIBS, "-lkeyutils")]) ])
And I've pushed the patchset up to this patch, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v4 4/14 m4: Fix libaio detection on 32-bit cross build
In reply to Petr Vorel--- 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(-)
m4/ltp-eventfd.m4 +13 -15
@@ -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 <[email protected]> +dnl Copyright (c) 2017 Petr Vorel <[email protected]> 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 ])
testcases/kernel/io/aio/aio01/aio01.c +10 -13
@@ -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
testcases/kernel/io/aio/aio02/aio_tio.c +1 -2
@@ -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
testcases/kernel/io/aio/aio02/main.c +4 -4
@@ -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
testcases/kernel/io/ltp-aiodio/aio-stress.c +13 -2
@@ -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
testcases/kernel/io/ltp-aiodio/aiocp.c +2 -5
@@ -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
testcases/kernel/io/ltp-aiodio/aiodio_append.c +12 -2
@@ -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
testcases/kernel/io/ltp-aiodio/aiodio_sparse.c +14 -4
@@ -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 1000int 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
testcases/kernel/syscalls/eventfd/eventfd01.c +11 -5
@@ -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
testcases/kernel/syscalls/io_cancel/io_cancel01.c +7 -5
@@ -21,6 +21,9 @@/* Porting from Crackerjack to LTP is done by Masatake YAMATO <[email protected]> */ +#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
testcases/kernel/syscalls/io_destroy/io_destroy01.c +7 -5
@@ -21,6 +21,9 @@/* Porting from Crackerjack to LTP is done by Masatake YAMATO <[email protected]> */ +#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
testcases/kernel/syscalls/io_getevents/io_getevents01.c +7 -6
@@ -21,17 +21,17 @@/* Porting from Crackerjack to LTP is done by Masatake YAMATO <[email protected]> */ +#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
testcases/kernel/syscalls/io_setup/io_setup01.c +7 -5
@@ -21,6 +21,9 @@/* Porting from Crackerjack to LTP is done by Masatake YAMATO <[email protected]> */ +#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
testcases/kernel/syscalls/io_submit/io_submit01.c +6 -5
@@ -20,14 +20,15 @@/* Porting from Crackerjack to LTP is done by Masatake YAMATO <[email protected]> */ +#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
Signature · 1 line
2.14.2
PATCH v4 4/14 m4: Fix libaio detection on 32-bit cross build
Hi!
m4/ltp-eventfd.m4 dnl along with this program; if not, write to the Free Software · line 34
Quoted 1 line
m4/ltp-eventfd.m4 +1
-0+ AC_TRY_LINK(... AC_DEFINE(HAVE_IO_SET_EVENTFD) ...)
^
Is this a forgotten placeholder?
m4/ltp-eventfd.m4 dnl along with this program; if not, write to the Free Software · line 39
Quoted 12 lines
m4/ltp-eventfd.m4 +2
-7AC_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.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v4 5/14 make: Remove workarounds for build without libnuma
In reply to Petr Vorel--- 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(-)
testcases/kernel/syscalls/mbind/Makefile +0 -9
@@ -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
testcases/kernel/syscalls/migrate_pages/Makefile +0 -3
@@ -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
testcases/kernel/syscalls/move_pages/Makefile +0 -5
@@ -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
Signature · 1 line
2.14.2
PATCH v4 6/14 numa: Drop NUMA API v1 support
In reply to Petr VorelNOTE: there still some code using v1 API (thus flag -DNUMA_VERSION1_COMPATIBILITY is needed)
--- .../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(-)
testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c +2 -2
@@ -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"
testcases/kernel/hotplug/memory_hotplug/commands.c +1 -11
@@ -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;
testcases/kernel/lib/numa_helper.c +2 -13
@@ -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; }
testcases/kernel/mem/vma/vma02.c +4 -9
@@ -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 ) {
testcases/kernel/mem/vma/vma04.c +3 -9
@@ -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 ) {
testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c +2 -36
@@ -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);
Signature · 1 line
2.14.2
PATCH v4 7/14 numa: Drop NUMA_CPPFLAGS
In reply to Petr Voreland remove most -DNUMA_VERSION1_COMPATIBILITY flags. The place which requires it (e.g. using legacy code) is testcases/kernel/lib/commands.c.
--- 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(-)
include/mk/config.mk.default +0 -1
@@ -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
include/mk/config.mk.in +0 -1
@@ -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@
m4/ltp-numa.m4 +2 -7
@@ -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])
testcases/kernel/controllers/cpuset/cpuset_syscall_test/Makefile +0 -1
@@ -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
testcases/kernel/include/lib.mk +1 -1
@@ -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)
testcases/kernel/lib/Makefile +2 -1
@@ -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
testcases/kernel/numa/Makefile +1 -1
@@ -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)
Signature · 1 line
2.14.2
PATCH v4 8/14 hotplug/memory_hotplug: Update TODO
In reply to Petr Vorel_NEED_MIGRATE_PAGES definition was removed in commit 5ed9ed059 ("Address the issue reported in the following email by installing all .c files.")
--- testcases/kernel/hotplug/memory_hotplug/TODO | 5 ----- 1 file changed, 5 deletions(-)
testcases/kernel/hotplug/memory_hotplug/TODO +0 -5
@@ -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?
Signature · 1 line
2.14.2
PATCH v4 9/14 hotplug/memory_hotplug: Remove unused header
In reply to Petr Vorel--- testcases/kernel/hotplug/memory_hotplug/commands.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
testcases/kernel/hotplug/memory_hotplug/commands.c +1 -2
@@ -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>
Signature · 1 line
2.14.2
PATCH v4 10/14 hotplug/memory_hotplug: Exit with TCONF when NUMA headers not available
In reply to Petr Vorel--- testcases/kernel/hotplug/memory_hotplug/memtoy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
testcases/kernel/hotplug/memory_hotplug/memtoy.c +3 -1
@@ -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 */
Signature · 1 line
2.14.2
PATCH v4 11/14 m4, kernel/lib: Detect libnuma presence in kernel libs
In reply to Petr VorelThis 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).
---
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(-)
m4/ltp-numa.m4 +15 -19
@@ -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 <[email protected]> +dnl Copyright (c) 2017 Petr Vorel <[email protected]> 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 -)]) +])
testcases/kernel/controllers/cpuset/cpuset_lib/libcpuset.c +1 -0
@@ -50,6 +50,7 @@#include "test.h" #include "lapi/syscalls.h" #include "config.h" +#if HAVE_LINUX_MEMPOLICY_H #include <linux/mempolicy.h>
testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c +3 -3
@@ -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
testcases/kernel/hotplug/memory_hotplug/commands.c +5 -1
@@ -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>
testcases/kernel/hotplug/memory_hotplug/memtoy.c +8 -5
@@ -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
testcases/kernel/hotplug/memory_hotplug/segment.c +5 -1
@@ -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>
testcases/kernel/include/numa_helper.h +1 -1
@@ -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 */
testcases/kernel/lib/numa_helper.c +7 -7
@@ -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; }
testcases/kernel/mem/cpuset/cpuset01.c +6 -4
@@ -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
testcases/kernel/mem/ksm/ksm02.c +7 -4
@@ -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
testcases/kernel/mem/ksm/ksm04.c +7 -4
@@ -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
testcases/kernel/mem/ksm/ksm06.c +9 -5
@@ -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
testcases/kernel/mem/lib/mem.c +6 -7
@@ -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]);/*
testcases/kernel/mem/oom/oom02.c +7 -4
@@ -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
testcases/kernel/mem/oom/oom03.c +7 -3
@@ -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
testcases/kernel/mem/oom/oom04.c +7 -4
@@ -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
testcases/kernel/mem/oom/oom05.c +7 -4
@@ -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
testcases/kernel/mem/vma/vma02.c +3 -4
@@ -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
testcases/kernel/mem/vma/vma04.c +3 -4
@@ -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
testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c +4 -3
@@ -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
testcases/kernel/syscalls/mbind/mbind01.c +7 -4
@@ -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
testcases/kernel/syscalls/migrate_pages/migrate_pages01.c +6 -4
@@ -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
testcases/kernel/syscalls/migrate_pages/migrate_pages02.c +7 -4
@@ -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
testcases/kernel/syscalls/move_pages/move_pages_support.c +7 -7
@@ -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;
Signature · 1 line
2.14.2
PATCH v4 12/14 numa: Check for API >= v2 with autoconf
In reply to Petr Vorelinstead of more verbose check in C code.
--- 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(-)
m4/ltp-numa.m4 +10 -2
@@ -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.])
testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c +1 -2
@@ -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"
testcases/kernel/hotplug/memory_hotplug/commands.c +1 -1
@@ -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>
testcases/kernel/hotplug/memory_hotplug/memtoy.c +2 -1
@@ -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>
testcases/kernel/hotplug/memory_hotplug/segment.c +2 -1
@@ -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>
testcases/kernel/lib/numa_helper.c +6 -6
@@ -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; }
testcases/kernel/mem/cpuset/cpuset01.c +2 -1
@@ -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;
testcases/kernel/mem/ksm/ksm02.c +1 -2
@@ -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 ) {
testcases/kernel/mem/ksm/ksm04.c +1 -2
@@ -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 ) {
testcases/kernel/mem/ksm/ksm06.c +1 -2
@@ -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 ;
testcases/kernel/mem/lib/mem.c +3 -3
@@ -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]);/*
testcases/kernel/mem/oom/oom02.c +1 -1
@@ -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 ) {
testcases/kernel/mem/oom/oom03.c +1 -1
@@ -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 ) {
testcases/kernel/mem/oom/oom04.c +1 -1
@@ -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 ) {
testcases/kernel/mem/oom/oom05.c +1 -1
@@ -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 ) {
testcases/kernel/mem/vma/vma02.c +1 -1
@@ -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;
testcases/kernel/mem/vma/vma04.c +1 -1
@@ -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;
testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c +1 -1
@@ -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)
testcases/kernel/syscalls/mbind/mbind01.c +1 -1
@@ -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)
testcases/kernel/syscalls/migrate_pages/migrate_pages01.c +1 -2
@@ -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;
testcases/kernel/syscalls/migrate_pages/migrate_pages02.c +1 -2
@@ -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;
testcases/kernel/syscalls/move_pages/move_pages_support.c +6 -6
@@ -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;
Signature · 1 line
2.14.2
PATCH v4 13/14 numa: Remove HAVE_NUMA_ALLOC_ONNODE definition
In reply to Petr Vorelnuma_alloc_onnode() was added in libnuma v0.6 and we require NUMA API v2 => replace with HAVE_NUMA_V2 definition.
--- 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(-)
include/config.h.default +0 -3
@@ -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
m4/ltp-numa.m4 +0 -3
@@ -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.]) ])
testcases/kernel/syscalls/move_pages/move_pages_support.c +2 -2
@@ -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 ) {
Signature · 1 line
2.14.2
PATCH v4 14/14 numa: Remove HAVE_NUMA_MOVE_PAGES definition
In reply to Petr Vorelnuma_move_pages() was added in NUMA API v2 => replace with HAVE_NUMA_V2 definition.
--- 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(-)
m4/ltp-numa.m4 +0 -4
@@ -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 ])
testcases/kernel/syscalls/move_pages/move_pages01.c +2 -2
@@ -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 ();
testcases/kernel/syscalls/move_pages/move_pages02.c +2 -2
@@ -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 ();
testcases/kernel/syscalls/move_pages/move_pages03.c +2 -2
@@ -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 ();
testcases/kernel/syscalls/move_pages/move_pages04.c +2 -2
@@ -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 ();
testcases/kernel/syscalls/move_pages/move_pages05.c +2 -2
@@ -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 ();
testcases/kernel/syscalls/move_pages/move_pages06.c +2 -2
@@ -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 ();
testcases/kernel/syscalls/move_pages/move_pages07.c +2 -2
@@ -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 ();
testcases/kernel/syscalls/move_pages/move_pages08.c +2 -2
@@ -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 ();
testcases/kernel/syscalls/move_pages/move_pages09.c +2 -2
@@ -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 ();
testcases/kernel/syscalls/move_pages/move_pages10.c +2 -2
@@ -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 ();
testcases/kernel/syscalls/move_pages/move_pages11.c +2 -2
@@ -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 ();
testcases/kernel/syscalls/move_pages/move_pages12.c +2 -2
@@ -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
Signature · 1 line
2.14.2