Skip to contentSkip to conversation

package/numactl: make available on all architectures

PATCH New Thomas Petazzoni 3 participants 3 messages Apr 18, 2021 – Apr 26, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/numactl: make available on all architectures

Since its introduction in commit b05e74ff92b6728369e1540fc0a2bd60025f2146 in 2013, numactl has had an explicit list of architectures that it supports. Interestingly, this list does not include ARM, and now that rt-tests unconditionally needs numactl, it meant the rt-tests package was no longer available on ARM.

Further investigation revealed that there is nothing in recent versions of numactl that appears to be architecture-specific. It does build with all of Buildroot toolchains currently used in the autobuilders.

The only necessary changes are:

* Exclude no-MMU architectures, as madvise() is used in the code base, and this is not available on no-MMU architectures.

* Make sure to use -latomic when needed, as some atomic operations are used.

* Backport a patch that fixes the .symver usage, which only affects really old gcc versions: only the old ARM Sourcery toolchain was affected by this. Newer gcc versions support the gcc "symver" attribute, so that the code that directly emits the assembly .symver directive is not invoked.

With these changes, numactl builds successfully on all our supported toolchains.

---
 ...0001-Do-not-stringify-SYMVER-symbols.patch | 25 +++++++++++++++++++
 package/numactl/Config.in                     | 11 +-------
 package/numactl/numactl.mk                    |  4 +++
 package/rt-tests/Config.in                    |  4 +--
 4 files changed, 31 insertions(+), 13 deletions(-)
 create mode 100644 package/numactl/0001-Do-not-stringify-SYMVER-symbols.patch
package/numactl/0001-Do-not-stringify-SYMVER-symbols.patch new file +25 -0
new file mode 100644
index 0000000000..c6981aaf73
@@ -0,0 +1,25 @@
+From f96c96af7fbf2779b15f66f03b10315a24fb4f5a Mon Sep 17 00:00:00 2001
+From: Scott McMillan <[email protected]>
+Date: Fri, 9 Oct 2020 08:56:52 -0500
+Subject: [PATCH] Do not stringify SYMVER symbols
+
+Upstream: f96c96af7fbf2779b15f66f03b10315a24fb4f5a
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ util.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/util.h b/util.h
+index 99ada33..f2a20ac 100644
+--- a/util.h
++++ b/util.h
+@@ -22,5 +22,5 @@ extern char *policy_name(int policy);
+ #if HAVE_ATTRIBUTE_SYMVER
+ #define SYMVER(a,b) __attribute__ ((symver (b)))
+ #else
+-#define SYMVER(a,b) __asm__ (".symver " #a "," #b);
++#define SYMVER(a,b) __asm__ (".symver " a "," b);
+ #endif
+-- 
+2.30.2
+
package/numactl/Config.in +1 -10
index cd47f2f9a9..23cf7facb0 100644
@@ -1,15 +1,6 @@
-config BR2_PACKAGE_NUMACTL_ARCH_SUPPORTS
-	bool
-	# numactl uses some system calls that are not available on all
-	# architectures.
-	default y if BR2_aarch64
-	default y if BR2_i386 || BR2_x86_64
-	default y if BR2_mips || BR2_mipsel ||  BR2_mips64 || BR2_mips64el
-	default y if BR2_powerpc
-
 config BR2_PACKAGE_NUMACTL
 	bool "numactl"
-	depends on BR2_PACKAGE_NUMACTL_ARCH_SUPPORTS
+	depends on BR2_USE_MMU # madvise()
 	help
 	  numactl allows you to run your application on specific cpus
 	  and memory nodes. It does this by supplying a NUMA memory
package/numactl/numactl.mk +4 -0
index cf9c759693..3364f6c5c3 100644
@@ -12,4 +12,8 @@ NUMACTL_INSTALL_STAGING = YES
 NUMACTL_AUTORECONF = YES
 NUMACTL_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -fPIC"
 
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+NUMACTL_CONF_ENV += LDFLAGS="$(TARGET_LDFLAGS) -latomic"
+endif
+
 $(eval $(autotools-package))
package/rt-tests/Config.in +1 -3
index cc9b14dccb..477fa288d7 100644
@@ -2,10 +2,9 @@ config BR2_PACKAGE_RT_TESTS
 	bool "rt-tests"
 	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_14 # deadline scheduler syscall
-	depends on BR2_USE_MMU # fork()
+	depends on BR2_USE_MMU # fork(), numactl
 	depends on !BR2_STATIC_LIBS # dlopen
 	depends on !BR2_TOOLCHAIN_USES_MUSL # cyclictest
-	depends on BR2_PACKAGE_NUMACTL_ARCH_SUPPORTS
 	select BR2_PACKAGE_NUMACTL
 	help
 	  Set of utilities for testing the real-time behaviour of a
@@ -34,4 +33,3 @@ comment "rt-tests needs a uClibc or glibc toolchain w/ NPTL, headers >= 3.14, dy
 	depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL || BR2_STATIC_LIBS \
 		|| BR2_TOOLCHAIN_USES_MUSL || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_14
 	depends on BR2_USE_MMU
-	depends on BR2_PACKAGE_NUMACTL_ARCH_SUPPORTS
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/1 package/numactl: make available on all architectures

Thomas, All,

On 2021-04-18 18:23 +0200, Thomas Petazzoni spake thusly:

Quoted 25 lines

Since its introduction in commit b05e74ff92b6728369e1540fc0a2bd60025f2146 in 2013, numactl has had an explicit list of architectures that it supports. Interestingly, this list does not include ARM, and now that rt-tests unconditionally needs numactl, it meant the rt-tests package was no longer available on ARM.

Further investigation revealed that there is nothing in recent versions of numactl that appears to be architecture-specific. It does build with all of Buildroot toolchains currently used in the autobuilders.

The only necessary changes are:

* Exclude no-MMU architectures, as madvise() is used in the code base, and this is not available on no-MMU architectures.

* Make sure to use -latomic when needed, as some atomic operations are used.

* Backport a patch that fixes the .symver usage, which only affects really old gcc versions: only the old ARM Sourcery toolchain was affected by this. Newer gcc versions support the gcc "symver" attribute, so that the code that directly emits the assembly .symver directive is not invoked.

Quoted 4 lines

With these changes, numactl builds successfully on all our supported toolchains.

Applied to master, thanks.

Regards,
Yann E. MORIN.

Quoted 101 lines
---
 ...0001-Do-not-stringify-SYMVER-symbols.patch | 25 +++++++++++++++++++
 package/numactl/Config.in                     | 11 +-------
 package/numactl/numactl.mk                    |  4 +++
 package/rt-tests/Config.in                    |  4 +--
 4 files changed, 31 insertions(+), 13 deletions(-)
 create mode 100644 package/numactl/0001-Do-not-stringify-SYMVER-symbols.patch
package/numactl/0001-Do-not-stringify-SYMVER-symbols.patch new file +25 -0
new file mode 100644
index 0000000000..c6981aaf73
@@ -0,0 +1,25 @@
+From f96c96af7fbf2779b15f66f03b10315a24fb4f5a Mon Sep 17 00:00:00 2001
+From: Scott McMillan <[email protected]>
+Date: Fri, 9 Oct 2020 08:56:52 -0500
+Subject: [PATCH] Do not stringify SYMVER symbols
+
+Upstream: f96c96af7fbf2779b15f66f03b10315a24fb4f5a
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ util.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/util.h b/util.h
+index 99ada33..f2a20ac 100644
+--- a/util.h
++++ b/util.h
+@@ -22,5 +22,5 @@ extern char *policy_name(int policy);
+ #if HAVE_ATTRIBUTE_SYMVER
+ #define SYMVER(a,b) __attribute__ ((symver (b)))
+ #else
+-#define SYMVER(a,b) __asm__ (".symver " #a "," #b);
++#define SYMVER(a,b) __asm__ (".symver " a "," b);
+ #endif
+-- 
+2.30.2
+
package/numactl/Config.in +1 -10
index cd47f2f9a9..23cf7facb0 100644
@@ -1,15 +1,6 @@
-config BR2_PACKAGE_NUMACTL_ARCH_SUPPORTS
-	bool
-	# numactl uses some system calls that are not available on all
-	# architectures.
-	default y if BR2_aarch64
-	default y if BR2_i386 || BR2_x86_64
-	default y if BR2_mips || BR2_mipsel ||  BR2_mips64 || BR2_mips64el
-	default y if BR2_powerpc
-
 config BR2_PACKAGE_NUMACTL
 	bool "numactl"
-	depends on BR2_PACKAGE_NUMACTL_ARCH_SUPPORTS
+	depends on BR2_USE_MMU # madvise()
 	help
 	  numactl allows you to run your application on specific cpus
 	  and memory nodes. It does this by supplying a NUMA memory
package/numactl/numactl.mk +4 -0
index cf9c759693..3364f6c5c3 100644
@@ -12,4 +12,8 @@ NUMACTL_INSTALL_STAGING = YES
 NUMACTL_AUTORECONF = YES
 NUMACTL_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -fPIC"
 
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+NUMACTL_CONF_ENV += LDFLAGS="$(TARGET_LDFLAGS) -latomic"
+endif
+
 $(eval $(autotools-package))
package/rt-tests/Config.in +1 -3
index cc9b14dccb..477fa288d7 100644
@@ -2,10 +2,9 @@ config BR2_PACKAGE_RT_TESTS
 	bool "rt-tests"
 	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_14 # deadline scheduler syscall
-	depends on BR2_USE_MMU # fork()
+	depends on BR2_USE_MMU # fork(), numactl
 	depends on !BR2_STATIC_LIBS # dlopen
 	depends on !BR2_TOOLCHAIN_USES_MUSL # cyclictest
-	depends on BR2_PACKAGE_NUMACTL_ARCH_SUPPORTS
 	select BR2_PACKAGE_NUMACTL
 	help
 	  Set of utilities for testing the real-time behaviour of a
@@ -34,4 +33,3 @@ comment "rt-tests needs a uClibc or glibc toolchain w/ NPTL, headers >= 3.14, dy
 	depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL || BR2_STATIC_LIBS \
 		|| BR2_TOOLCHAIN_USES_MUSL || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_14
 	depends on BR2_USE_MMU
-	depends on BR2_PACKAGE_NUMACTL_ARCH_SUPPORTS
Signature · 6 lines
2.30.2

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 package/numactl: make available on all architectures

In reply to Thomas Petazzoni
Quoted 27 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Since its introduction in commit b05e74ff92b6728369e1540fc0a2bd60025f2146 in 2013, numactl has had an explicit list of architectures that it supports. Interestingly, this list does not include ARM, and now that rt-tests unconditionally needs numactl, it meant the rt-tests package was no longer available on ARM.

Further investigation revealed that there is nothing in recent versions of numactl that appears to be architecture-specific. It does build with all of Buildroot toolchains currently used in the autobuilders.

The only necessary changes are:

* Exclude no-MMU architectures, as madvise() is used in the code base, and this is not available on no-MMU architectures.

* Make sure to use -latomic when needed, as some atomic operations are used.

* Backport a patch that fixes the .symver usage, which only affects really old gcc versions: only the old ARM Sourcery toolchain was affected by this. Newer gcc versions support the gcc "symver" attribute, so that the code that directly emits the assembly .symver directive is not invoked.

Quoted 4 lines

With these changes, numactl builds successfully on all our supported toolchains.

I hesitated a bit as this is kind of a feature patch, but you can also argue that the removal of rt-tests on E.G. ARM in 2021.02 is a regression, so committed to 2021.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard