summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRandy Witt <randy.e.witt@intel.com>2020-10-19 14:42:11 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-10-30 13:22:47 +0000
commit595d57bd460faae80ce6b443b136b1e60594fd3f (patch)
treec19714cc3e8b9e3a1bd57d935deff02f17690244
parente547cfcd906e57ac88431ac97df4c8f250d85749 (diff)
downloadpoky-595d57bd460faae80ce6b443b136b1e60594fd3f.tar.gz
numactl: Add the recipe for numactl
This is a direct copy of numactl from meta-openembedded. numactl is being moved to oe-core since the latest versions of rt-tests(which is in oe-core) require libnuma. (From OE-Core rev: dda815792b0939b2f233aa3ec7c140fc114a37d1) Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-support/numactl/numactl/0001-define-run-test-target.patch32
-rw-r--r--meta/recipes-support/numactl/numactl/0001-numademo-fix-error-on-32bit-system.patch100
-rw-r--r--meta/recipes-support/numactl/numactl/Fix-the-test-output-format.patch64
-rw-r--r--meta/recipes-support/numactl/numactl/Makefile7
-rwxr-xr-xmeta/recipes-support/numactl/numactl/run-ptest9
-rw-r--r--meta/recipes-support/numactl/numactl_git.bb60
6 files changed, 272 insertions, 0 deletions
diff --git a/meta/recipes-support/numactl/numactl/0001-define-run-test-target.patch b/meta/recipes-support/numactl/numactl/0001-define-run-test-target.patch
new file mode 100644
index 0000000000..78ffb22f89
--- /dev/null
+++ b/meta/recipes-support/numactl/numactl/0001-define-run-test-target.patch
@@ -0,0 +1,32 @@
1rename test target as run-test
2
3Upstream-Statue: Pending
4
5test target not only compile the test files, but also run them, which is
6not suitable for cross-compile environment, so rename it as run-test.
7
8and define test target to compile the test files.
9
10Signed-off-by: Roy Li <rongqing.li@windriver.com>
11---
12 Makefile.am | 4 +++-
13 1 file changed, 3 insertions(+), 1 deletion(-)
14
15diff --git a/Makefile.am b/Makefile.am
16index b6db339..de176c4 100644
17--- a/Makefile.am
18+++ b/Makefile.am
19@@ -124,7 +124,9 @@ regress2: $(check_PROGRAMS)
20 test_numademo: numademo
21 ./numademo -t -e 10M
22
23-test: all $(check_PROGRAMS) regress1 regress2 test_numademo
24+test: all $(check_PROGRAMS)
25+
26+run-test: all $(check_PROGRAMS) regress1 regress2 test_numademo
27
28 TESTS_ENVIRONMENT = builddir='$(builddir)'; export builddir;
29
30--
311.9.1
32
diff --git a/meta/recipes-support/numactl/numactl/0001-numademo-fix-error-on-32bit-system.patch b/meta/recipes-support/numactl/numactl/0001-numademo-fix-error-on-32bit-system.patch
new file mode 100644
index 0000000000..506101711a
--- /dev/null
+++ b/meta/recipes-support/numactl/numactl/0001-numademo-fix-error-on-32bit-system.patch
@@ -0,0 +1,100 @@
1From 68485f8516884377e54c623b0deff73f97321d96 Mon Sep 17 00:00:00 2001
2From: "Hongzhi.Song" <hongzhi.song@windriver.com>
3Date: Thu, 19 Sep 2019 04:32:31 -0400
4Subject: [PATCH] numademo: fix error on 32bit system
5
6Error Info on 32bit:
7root@intel-x86:~# numademo -t -e 1M
8Configured Nodes does not match available memory nodes
9
10That's because sizeof(long)=4Word, but sizeof(long long)=8Word
11on 32bit. So (long long) assigning to (long) maybe cause overflow.
12
13long numa_node_size(int node, long *freep)
14{
15 ...
16 long sz = numa_node_size64_int(node, &f2);
17 ~^^~
18 return sz;
19 ...
20}
21long long numa_node_size64(int node, long long *freep)
22~^^ ^^~
23{
24 ...
25}
26
27Unify the return type of above functions.
28
29Upstream-Status: Accepted [next version is after 2.0.13 or 2.0.14]
30[https://github.com/numactl/numactl/commit/a7c4bc790a191d3e42b63850b409c1a72b75a4e1]
31 Submitted [https://github.com/numactl/numactl/pull/79]
32[The first patch was merged but has a error, then the second fix it.]
33
34Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
35---
36 libnuma.c | 4 ++--
37 numa.h | 2 +-
38 numademo.c | 2 +-
39 test/move_pages.c | 2 +-
40 4 files changed, 5 insertions(+), 5 deletions(-)
41
42diff --git a/libnuma.c b/libnuma.c
43index cac8851..8b5c6aa 100644
44--- a/libnuma.c
45+++ b/libnuma.c
46@@ -791,10 +791,10 @@ long long numa_node_size64(int node, long long *freep)
47
48 make_internal_alias(numa_node_size64);
49
50-long numa_node_size(int node, long *freep)
51+long long numa_node_size(int node, long long *freep)
52 {
53 long long f2;
54- long sz = numa_node_size64_int(node, &f2);
55+ long long sz = numa_node_size64_int(node, &f2);
56 if (freep)
57 *freep = f2;
58 return sz;
59diff --git a/numa.h b/numa.h
60index 3a8c543..268fb1d 100644
61--- a/numa.h
62+++ b/numa.h
63@@ -143,7 +143,7 @@ int numa_preferred(void);
64
65 /* Return node size and free memory */
66 long long numa_node_size64(int node, long long *freep);
67-long numa_node_size(int node, long *freep);
68+long long numa_node_size(int node, long long *freep);
69
70 int numa_pagesize(void);
71
72diff --git a/numademo.c b/numademo.c
73index a720db0..8c56da8 100644
74--- a/numademo.c
75+++ b/numademo.c
76@@ -301,7 +301,7 @@ int max_node, numnodes;
77 int get_node_list(void)
78 {
79 int a, got_nodes = 0;
80- long free_node_sizes;
81+ long long free_node_sizes;
82
83 numnodes = numa_num_configured_nodes();
84 node_to_use = (int *)malloc(numnodes * sizeof(int));
85diff --git a/test/move_pages.c b/test/move_pages.c
86index d1d8436..f8ff25d 100644
87--- a/test/move_pages.c
88+++ b/test/move_pages.c
89@@ -26,7 +26,7 @@ int *node_to_use;
90 int get_node_list()
91 {
92 int a, got_nodes = 0, max_node, numnodes;
93- long free_node_sizes;
94+ long long free_node_sizes;
95
96 numnodes = numa_num_configured_nodes();
97 node_to_use = (int *)malloc(numnodes * sizeof(int));
98--
992.23.0
100
diff --git a/meta/recipes-support/numactl/numactl/Fix-the-test-output-format.patch b/meta/recipes-support/numactl/numactl/Fix-the-test-output-format.patch
new file mode 100644
index 0000000000..9812ecc8b3
--- /dev/null
+++ b/meta/recipes-support/numactl/numactl/Fix-the-test-output-format.patch
@@ -0,0 +1,64 @@
1From 59fd750a84bbe5874dec936d2bee9ef11a1b6505 Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Tue, 21 Jul 2015 02:01:22 +0900
4Subject: [PATCH] Fix the test output format
5
6Upstream-Status: Pending
7
8Signed-off-by: Roy Li <rongqing.li@windriver.com>
9Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
10---
11 test/regress | 6 +++---
12 test/regress2 | 11 +++++------
13 2 files changed, 8 insertions(+), 9 deletions(-)
14
15diff --git a/test/regress b/test/regress
16index 2ce1705..d086a47 100755
17--- a/test/regress
18+++ b/test/regress
19@@ -74,6 +74,7 @@ probe_hardware()
20 if [ $numnodes -lt 2 ] ; then
21 echo "need at least two nodes with at least $NEEDPAGES each of"
22 echo "free memory for mempolicy regression tests"
23+ echo "FAIL: numa regress"
24 exit 77 # Skip test
25 fi
26 }
27@@ -207,10 +208,9 @@ main()
28 rm A B
29
30 if [ "$EXIT" = 0 ] ; then
31- echo '========SUCCESS'
32+ echo 'PASS: numactl regress'
33 else
34- echo '========FAILURE'
35- exit 1
36+ echo 'FAIL: numactl regress'
37 fi
38 }
39
40diff --git a/test/regress2 b/test/regress2
41index aa6ea41..450c510 100755
42--- a/test/regress2
43+++ b/test/regress2
44@@ -9,12 +9,11 @@ testdir=`dirname "$0"`
45 export PATH=${builddir}:$PATH
46
47 T() {
48- echo "$@"
49- if ! $VALGRIND "$@" ; then
50- echo $1 FAILED!!!!
51- exit 1
52- fi
53- echo
54+ if ! $VALGRIND "$@" 2>&1 1>/dev/null; then
55+ echo "FAIL: $1"
56+ else
57+ echo "PASS: $1"
58+ fi
59 }
60
61 # still broken
62--
631.8.4.2
64
diff --git a/meta/recipes-support/numactl/numactl/Makefile b/meta/recipes-support/numactl/numactl/Makefile
new file mode 100644
index 0000000000..9a5134c3f2
--- /dev/null
+++ b/meta/recipes-support/numactl/numactl/Makefile
@@ -0,0 +1,7 @@
1.PHONY: regress1 regress2
2
3regress1:
4 cd test ; ./regress
5
6regress2:
7 cd test ; ./regress2
diff --git a/meta/recipes-support/numactl/numactl/run-ptest b/meta/recipes-support/numactl/numactl/run-ptest
new file mode 100755
index 0000000000..215f7c25b9
--- /dev/null
+++ b/meta/recipes-support/numactl/numactl/run-ptest
@@ -0,0 +1,9 @@
1#!/bin/sh
2make regress1
3make regress2
4if numademo -t -e 10M; then
5 echo "PASS: numademo"
6else
7 echo "FAIL: numademo"
8fi
9
diff --git a/meta/recipes-support/numactl/numactl_git.bb b/meta/recipes-support/numactl/numactl_git.bb
new file mode 100644
index 0000000000..20b7fed862
--- /dev/null
+++ b/meta/recipes-support/numactl/numactl_git.bb
@@ -0,0 +1,60 @@
1SUMMARY = "Development package for building Applications that use numa"
2HOMEPAGE = "http://oss.sgi.com/projects/libnuma/"
3DESCRIPTION = "Simple NUMA policy support. It consists of a numactl program \
4to run other programs with a specific NUMA policy and a libnuma to do \
5allocations with NUMA policy in applications."
6LICENSE = "GPL-2.0 & LGPL-2.1"
7SECTION = "apps"
8
9inherit autotools-brokensep ptest
10
11LIC_FILES_CHKSUM = "file://README.md;beginline=19;endline=32;md5=f8ff2391624f28e481299f3f677b21bb"
12
13SRCREV = "5d9f16722e3df49dc618a9f361bd482559695db7"
14PV = "2.0.13+git${SRCPV}"
15
16SRC_URI = "git://github.com/numactl/numactl \
17 file://Fix-the-test-output-format.patch \
18 file://Makefile \
19 file://run-ptest \
20 file://0001-define-run-test-target.patch \
21 file://0001-numademo-fix-error-on-32bit-system.patch \
22"
23
24S = "${WORKDIR}/git"
25
26# ARM does not currently support NUMA
27COMPATIBLE_HOST = "^((?!arm).*)$"
28
29do_install() {
30 oe_runmake DESTDIR=${D} prefix=${D}/usr install
31 #remove the empty man2 directory
32 rm -r ${D}${mandir}/man2
33}
34
35do_compile_ptest() {
36 oe_runmake test
37}
38
39do_install_ptest() {
40 #install tests binaries
41 local test_binaries="distance ftok mbind_mig_pages migrate_pages move_pages \
42 mynode nodemap node-parse pagesize prefered randmap realloc_test \
43 tbitmap tshared"
44
45 [ ! -d ${D}/${PTEST_PATH}/test ] && mkdir -p ${D}/${PTEST_PATH}/test
46 for i in $test_binaries; do
47 install -m 0755 ${B}/test/.libs/$i ${D}${PTEST_PATH}/test
48 done
49
50 local test_scripts="checktopology checkaffinity printcpu regress regress2 \
51 shmtest runltp bind_range"
52 for i in $test_scripts; do
53 install -m 0755 ${B}/test/$i ${D}${PTEST_PATH}/test
54 done
55
56 install -m 0755 ${WORKDIR}/Makefile ${D}${PTEST_PATH}/
57 install -m 0755 ${B}/.libs/numactl ${D}${PTEST_PATH}/
58}
59
60RDEPENDS_${PN}-ptest = "bash"