Skip to contentSkip to conversation

ltp-testsuite: Add upstream patch to fix build numa detection

PATCH Superseded Petr Vorel 3 participants 8 messages Jan 29, 2018 – Feb 7, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 ltp-testsuite: Add upstream patch to fix build numa detection

This removes fix added in commit 3c937807a3 ("ltp-testsuite: disable numa tests")

---
 ...x-numa-v2-detection-for-cross-compilation.patch | 37 ++++++++++++++++++++++
 package/ltp-testsuite/ltp-testsuite.mk             |  3 +-
 2 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 package/ltp-testsuite/0002-numa-Fix-numa-v2-detection-for-cross-compilation.patch
package/ltp-testsuite/0002-numa-Fix-numa-v2-detection-for-cross-compilation.patch new file +37 -0
new file mode 100644
index 0000000000..6ad1db046e
@@ -0,0 +1,37 @@
+From 01c134f30be755a43af12a4ae2c31177d04be790 Mon Sep 17 00:00:00 2001
+From: Petr Vorel <[email protected]>
+Date: Mon, 29 Jan 2018 10:31:40 +0100
+Subject: [PATCH] numa: Fix numa v2 detection for cross compilation
+
+Changed to AC_COMPILE_IFELSE as AC_RUN_IFELSE cannot be run while
+cross compiling.
+
+Bug found by Buildroot project.
+
+Signed-off-by: Petr Vorel <[email protected]>
+Reported-by: Baruch Siach <[email protected]>
+---
+ m4/ltp-numa.m4 | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/m4/ltp-numa.m4 b/m4/ltp-numa.m4
+index fc3383e97..633f54c18 100644
+--- a/m4/ltp-numa.m4
++++ b/m4/ltp-numa.m4
+@@ -28,11 +28,11 @@ AC_DEFUN([LTP_CHECK_SYSCALL_NUMA], [
+ 	AC_CHECK_HEADERS([numa.h numaif.h], [], [have_numa_headers=no])
+ 
+ 	if test "x$have_numa_headers" != "xno"; then
+-		AC_RUN_IFELSE([AC_LANG_PROGRAM([
++		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
+ #include <numa.h>
+ 		], [
+ #if LIBNUMA_API_VERSION < 2
+-exit(1);
++# error Required numa headers >= 2
+ #endif
+ 		])], [have_numa_headers_v2=yes])
+ 	fi
+-- 
+2.16.0
+
package/ltp-testsuite/ltp-testsuite.mk +1 -2
index 28dc24749e..87854568d8 100644
@@ -56,8 +56,7 @@ LTP_TESTSUITE_CONF_ENV += \
 	CFLAGS="$(LTP_TESTSUITE_CFLAGS)" \
 	CPPFLAGS="$(LTP_TESTSUITE_CPPFLAGS)" \
 	LIBS="$(LTP_TESTSUITE_LIBS)" \
-	SYSROOT="$(STAGING_DIR)" \
-	have_numa_headers=no
+	SYSROOT="$(STAGING_DIR)"
 
 # Requires uClibc fts and bessel support, normally not enabled
 ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
Signature · 1 line
2.16.0
#1 lore raw

PATCH 1/1 ltp-testsuite: Add upstream patch to fix build numa detection

Hello,

Quoted 3 lines · Petr Vorel

This removes fix added in commit 3c937807a3 ("ltp-testsuite: disable numa tests")

Thanks for this update. There is however an issue, see below.

Quoted 17 lines
---
 ...x-numa-v2-detection-for-cross-compilation.patch | 37 ++++++++++++++++++++++
 package/ltp-testsuite/ltp-testsuite.mk             |  3 +-
 2 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 package/ltp-testsuite/0002-numa-Fix-numa-v2-detection-for-cross-compilation.patch
package/ltp-testsuite/0002-numa-Fix-numa-v2-detection-for-cross-compilation.patch new file +5 -0
new file mode 100644
index 0000000000..6ad1db046e
@@ -0,0 +1,37 @@
+From 01c134f30be755a43af12a4ae2c31177d04be790 Mon Sep 17 00:00:00 2001
+From: Petr Vorel <[email protected]>
+Date: Mon, 29 Jan 2018 10:31:40 +0100
+Subject: [PATCH] numa: Fix numa v2 detection for cross compilation
+

package/ltp-testsuite/0002-numa-Fix-numa-v2-detection-for-cross-compilation.patch line 15

Quoted 10 lines
package/ltp-testsuite/0002-numa-Fix-numa-v2-detection-for-cross-compilation.patch new file +10 -0
+Changed to AC_COMPILE_IFELSE as AC_RUN_IFELSE cannot be run while
+cross compiling.
+
+Bug found by Buildroot project.
+
+Signed-off-by: Petr Vorel <[email protected]>
+Reported-by: Baruch Siach <[email protected]>
+---
+ m4/ltp-numa.m4 | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)

You are changing m4 files, which requires regenerating the configure script. Therefore, the package should have LTP_TESTSUITE_AUTORECONF = YES, with a comment above it that says it's needed for patch 0002-numa-Fix-numa-v2-detection-for-cross-compilation.patch.

Could you check this, and submit an updated version?

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 ltp-testsuite: Add upstream patch to fix build numa detection

In reply to Petr Vorel

Hi Petr,

Quoted 8 lines · Petr Vorel

This removes fix added in commit 3c937807a3 ("ltp-testsuite: disable numa tests")

---
 ...x-numa-v2-detection-for-cross-compilation.patch | 37 ++++++++++++++++++++++
 package/ltp-testsuite/ltp-testsuite.mk             |  3 +-
 2 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 package/ltp-testsuite/0002-numa-Fix-numa-v2-detection-for-cross-compilation.patch

[...]

Quoted 5 lines
package/ltp-testsuite/ltp-testsuite.mk +0 -0
index 28dc24749e..87854568d8 100644

package/ltp-testsuite/ltp-testsuite.mk LTP_TESTSUITE_CONF_ENV += \ · line 62

Quoted 9 lines
package/ltp-testsuite/ltp-testsuite.mk +1 -2
@@ -56,8 +56,7 @@ LTP_TESTSUITE_CONF_ENV += \
 	CFLAGS="$(LTP_TESTSUITE_CFLAGS)" \
 	CPPFLAGS="$(LTP_TESTSUITE_CPPFLAGS)" \
 	LIBS="$(LTP_TESTSUITE_LIBS)" \
-	SYSROOT="$(STAGING_DIR)" \
-	have_numa_headers=no
+	SYSROOT="$(STAGING_DIR)"
 
 # Requires uClibc fts and bessel support, normally not enabled
 ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)

You should also make numactl an optional dependency to make the build more reproducible.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
author
#3 lore raw

PATCH 1/1 ltp-testsuite: Add upstream patch to fix build numa detection

Hi Baruch,

Quoted 24 lines · Petr Vorel
Quoted 8 lines

This removes fix added in commit 3c937807a3 ("ltp-testsuite: disable numa tests")

---
 ...x-numa-v2-detection-for-cross-compilation.patch | 37 ++++++++++++++++++++++
 package/ltp-testsuite/ltp-testsuite.mk             |  3 +-
 2 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 package/ltp-testsuite/0002-numa-Fix-numa-v2-detection-for-cross-compilation.patch

[...]

Quoted 11 lines
package/ltp-testsuite/ltp-testsuite.mk +1 -2
index 28dc24749e..87854568d8 100644
@@ -56,8 +56,7 @@ LTP_TESTSUITE_CONF_ENV += \
 	CFLAGS="$(LTP_TESTSUITE_CFLAGS)" \
 	CPPFLAGS="$(LTP_TESTSUITE_CPPFLAGS)" \
 	LIBS="$(LTP_TESTSUITE_LIBS)" \
-	SYSROOT="$(STAGING_DIR)" \
-	have_numa_headers=no
+	SYSROOT="$(STAGING_DIR)"
Quoted 5 lines

package/ltp-testsuite/ltp-testsuite.mk LTP_TESTSUITE_CONF_ENV += \ · line 62

Quoted 2 lines
package/ltp-testsuite/ltp-testsuite.mk +0 -0
 # Requires uClibc fts and bessel support, normally not enabled
 ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)

You should also make numactl an optional dependency to make the build more reproducible.

Can you be more specific, what you mean? numactl is required as a command in numa based tests (used by testcases/kernel/numa/numa01.sh). But that's not build dependency, it's a runtime dependency.

Quoted 1 line

baruch

Kind regards,
Petr

#4 lore raw

PATCH 1/1 ltp-testsuite: Add upstream patch to fix build numa detection

Hi Petr,

Quoted 27 lines · Petr Vorel
Quoted 26 lines · Petr Vorel
Quoted 8 lines

This removes fix added in commit 3c937807a3 ("ltp-testsuite: disable numa tests")

---
 ...x-numa-v2-detection-for-cross-compilation.patch | 37 ++++++++++++++++++++++
 package/ltp-testsuite/ltp-testsuite.mk             |  3 +-
 2 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 package/ltp-testsuite/0002-numa-Fix-numa-v2-detection-for-cross-compilation.patch

[...]

Quoted 14 lines
package/ltp-testsuite/ltp-testsuite.mk +1 -2
index 28dc24749e..87854568d8 100644
@@ -56,8 +56,7 @@ LTP_TESTSUITE_CONF_ENV += \
 	CFLAGS="$(LTP_TESTSUITE_CFLAGS)" \
 	CPPFLAGS="$(LTP_TESTSUITE_CPPFLAGS)" \
 	LIBS="$(LTP_TESTSUITE_LIBS)" \
-	SYSROOT="$(STAGING_DIR)" \
-	have_numa_headers=no
+	SYSROOT="$(STAGING_DIR)"
 
 # Requires uClibc fts and bessel support, normally not enabled
 ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
Quoted 6 lines
Quoted 2 lines

You should also make numactl an optional dependency to make the build more reproducible.

Can you be more specific, what you mean? numactl is required as a command in numa based tests (used by testcases/kernel/numa/numa01.sh). But that's not build dependency, it's a runtime dependency.

numactl is also an optional build time dependency of ltp-testsuite. When the ltp-testsuite configure script detects libnuma some additional tests are built. Currently when the numactl package is enabled, ltp-testsuite would detect libnuma only if numactl happens to build before ltp-testsuite. To make builds consistent we need to make sure that numactl always build before ltp-testsuite by adding it to _DEPENDENCIES. Here is how the hwloc package does that:

ifeq ($(BR2_PACKAGE_NUMACTL),y)
HWLOC_CONF_OPTS += --enable-libnuma
HWLOC_DEPENDENCIES += numactl
else
HWLOC_CONF_OPTS += --disable-libnuma
endif

ltp-testsuite needs something similar.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
author
#5 lore raw

PATCH 1/1 ltp-testsuite: Add upstream patch to fix build numa detection

Hi Baruch,

thanks for your explanation!

Quoted 3 lines

numactl is also an optional build time dependency of ltp-testsuite. When the ltp-testsuite configure script detects libnuma some additional tests are built.

I was thinking some time ago to add this support, but it's not how it works. All sources which depends on NUMA have a preprocessor condition like his: [1] #ifdef HAVE_NUMA_V2
...

#else
	TST_TEST_TCONF("test requires libnuma >= 2 and it's development packages");

#endif
(These are using new LTP test API, tests using old API or not using API at all have it implemented differently.)

I added HAVE_NUMA_V2 in commit bf3441268 ("numa: Check for API >= v2 with autoconf"), but it the check has always been like that (*) all the tests are actually being build regardless of NUMA support on SUT. I mean, there is no rule in Makefile which would prevent build them because missing NUMA. This is unusual, but the reason why tests are build just to say "you need libnuma support", that these files are expected in runtest files (files in $LTPROOT/runtest).

(*) This approach was added in the sources in 2010.

Quoted 6 lines

Currently when the numactl package is enabled, ltp-testsuite would detect libnuma only if numactl happens to build before ltp-testsuite. To make builds consistent we need to make sure that numactl always build before ltp-testsuite by adding it to _DEPENDENCIES. Here is how the hwloc package does that:

Quoted 6 lines

ifeq ($(BR2_PACKAGE_NUMACTL),y)
HWLOC_CONF_OPTS += --enable-libnuma
HWLOC_DEPENDENCIES += numactl
else
HWLOC_CONF_OPTS += --disable-libnuma
endif

So this is not needed.

Quoted 4 lines

ltp-testsuite needs something similar.

baruch

Kind regards,
Petr

[1] https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/mem/cpuset/cpuset01.c

#6 lore raw

PATCH 1/1 ltp-testsuite: Add upstream patch to fix build numa detection

Hi Petr,

Quoted 9 lines · Petr Vorel

thanks for your explanation!

Quoted 3 lines

numactl is also an optional build time dependency of ltp-testsuite. When the ltp-testsuite configure script detects libnuma some additional tests are built.

I was thinking some time ago to add this support, but it's not how it works. All sources which depends on NUMA have a preprocessor condition like his: [1] #ifdef HAVE_NUMA_V2
...

Quoted 5 lines
#else
	TST_TEST_TCONF("test requires libnuma >= 2 and it's development packages");

#endif
(These are using new LTP test API, tests using old API or not using API at all have it implemented differently.)

So the behaviour of ltp-testsuite changes when its configure script detects libnuma, right? We want this change to be consistent whenever numactl is enabled in buildroot, so that ltp-testsuite would always detect libnuma when it is available. We don't want to leave it up to the pseudo-random packages build order.

Quoted 15 lines

I added HAVE_NUMA_V2 in commit bf3441268 ("numa: Check for API >= v2 with autoconf"), but it the check has always been like that (*) all the tests are actually being build regardless of NUMA support on SUT. I mean, there is no rule in Makefile which would prevent build them because missing NUMA. This is unusual, but the reason why tests are build just to say "you need libnuma support", that these files are expected in runtest files (files in $LTPROOT/runtest).

(*) This approach was added in the sources in 2010.

Quoted 5 lines

Currently when the numactl package is enabled, ltp-testsuite would detect libnuma only if numactl happens to build before ltp-testsuite. To make builds consistent we need to make sure that numactl always build before ltp-testsuite by adding it to _DEPENDENCIES. Here is how the hwloc package does that:

Quoted 7 lines
Quoted 6 lines

ifeq ($(BR2_PACKAGE_NUMACTL),y)
HWLOC_CONF_OPTS += --enable-libnuma
HWLOC_DEPENDENCIES += numactl
else
HWLOC_CONF_OPTS += --disable-libnuma
endif

So this is not needed.

So this is needed to make the build consistent, IMO.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
author
#7 lore raw

PATCH 1/1 ltp-testsuite: Add upstream patch to fix build numa detection

Hi Baruch,

thanks for info!

Quoted 5 lines

So the behaviour of ltp-testsuite changes when its configure script detects libnuma, right? We want this change to be consistent whenever numactl is enabled in buildroot, so that ltp-testsuite would always detect libnuma when it is available. We don't want to leave it up to the pseudo-random packages build order.

Understand. I'm sorry I didn't realize that numactl is not name of binary package, but name of the whole library. I didn't know that upstream uses it as name of the whole project.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

Currently when the numactl package is enabled, ltp-testsuite would detect libnuma only if numactl happens to build before ltp-testsuite. To make builds consistent we need to make sure that numactl always build before ltp-testsuite by adding it to _DEPENDENCIES. Here is how the hwloc package does that:

ifeq ($(BR2_PACKAGE_NUMACTL),y)
HWLOC_CONF_OPTS += --enable-libnuma
HWLOC_DEPENDENCIES += numactl
else
HWLOC_CONF_OPTS += --disable-libnuma
endif

Quoted 3 lines
Quoted 1 line

So this is not needed.

So this is needed to make the build consistent, IMO.

This makes sense. Would you please prepare patch?

Kind regards,
Petr