Browse Source

numactl package update

Signed-off-by: basebuilder_pel7ppc64bebuilder0 <basebuilder@powerel.org>
master
basebuilder_pel7ppc64bebuilder0 6 years ago
parent
commit
b8ec4808e0
  1. 50
      SOURCES/numactl-2.0.10-numa_node_to_cpu_skip_over_nonexisting.patch
  2. 130
      SOURCES/numactl-2.0.11-Segment-fault-when-numa-nodes-not-sequential-or-cont.patch
  3. 59
      SOURCES/numactl-2.0.11-libnuma-supress-warnings-for-non-existing-node.patch
  4. 17
      SOURCES/numactl-2.0.8-localalloc-man.patch
  5. 30
      SOURCES/numactl-2.0.9-hw-detect-segfault.patch
  6. 312
      SOURCES/numactl-2.0.9-mpol-bind-preferred.patch
  7. 295
      SPECS/numactl.spec

50
SOURCES/numactl-2.0.10-numa_node_to_cpu_skip_over_nonexisting.patch

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
From 32075635db57c3d5efe12f8fb569af857e01ccad Mon Sep 17 00:00:00 2001
From: Petr Holasek <pholasek@redhat.com>
Date: Wed, 14 Jan 2015 09:53:47 +0100
Subject: [PATCH] libnuma: add check for return value of numa_node_to_cpus

When numa_node_to_cpu() has been called on machine with non-contiguous
nodes, it returned the first node which wasn't present on machine.
Now, return code is checked and code skips over non-existing nodes to
the right one.

Also, caching of numa_node_to_cpus_v2() result while non-zero error had
been returned was disabled.

Signed-off-by: Petr Holasek <pholasek@redhat.com>

Tested by Cliff Wickman (on attica.sgi.com)
---
libnuma.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff -up numactl-2.0.9/libnuma.c.orig numactl-2.0.9/libnuma.c
--- numactl-2.0.9/libnuma.c.orig 2013-10-08 23:34:57.000000000 +0200
+++ numactl-2.0.9/libnuma.c 2015-07-01 15:14:44.937178134 +0200
@@ -1380,8 +1380,12 @@ numa_node_to_cpus_v2(int node, struct bi
if (mask != buffer)
numa_bitmask_free(mask);
} else {
- node_cpu_mask_v2[node] = mask;
- }
+ /* we don't want to cache faulty result */
+ if (!err)
+ node_cpu_mask_v2[node] = mask;
+ else
+ numa_bitmask_free(mask);
+ }
return err;
}
__asm__(".symver numa_node_to_cpus_v2,numa_node_to_cpus@@libnuma_1.2");
@@ -1403,7 +1407,10 @@ int numa_node_of_cpu(int cpu)
bmp = numa_bitmask_alloc(ncpus);
nnodes = numa_max_node();
for (node = 0; node <= nnodes; node++){
- numa_node_to_cpus_v2_int(node, bmp);
+ if (numa_node_to_cpus_v2_int(node, bmp) < 0) {
+ /* It's possible for the node to not exist */
+ continue;
+ }
if (numa_bitmask_isbitset(bmp, cpu)){
ret = node;
goto end;

130
SOURCES/numactl-2.0.11-Segment-fault-when-numa-nodes-not-sequential-or-cont.patch

@ -0,0 +1,130 @@ @@ -0,0 +1,130 @@
From b608687037d873ad82d6318f231b3d6612e8601d Mon Sep 17 00:00:00 2001
From: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Date: Wed, 21 Dec 2016 12:48:11 +0530
Subject: [PATCH 1/1] Segment fault when numa nodes not sequential or
contiguous

While trying to get stat of the guest process (configured with hugepages), numastat fails

====================
Environment details
====================
Linux lep8b 4.8.0-30-generic #32-Ubuntu SMP Fri Dec 2 03:43:46 UTC 2016 ppc64le ppc64le ppc64le GNU/Linu

=====
Issue
=====
2016-12-14 07:02:56,396 process L0368 INFO | Running 'numastat 61257'
2016-12-14 07:02:56,402 process L0462 DEBUG| [stderr] *** Error in `numastat': double free or corruption (out): 0x00000100265005a0 ***
2016-12-14 07:02:56,403 process L0462 DEBUG| [stdout]
2016-12-14 07:02:56,403 process L0482 INFO | Command 'numastat 61257' finished with -6 after 0.00309896469116s
2016-12-14 07:02:56,403 process L0462 DEBUG| [stdout] Per-node process memory usage (in MBs) for PID 61257 (qemu-system-ppc)
2016-12-14 07:02:56,404 process L0462 DEBUG| [stderr] ======= Backtrace: =========
2016-12-14 07:02:56,404 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(+0x86d54)[0x3fff9a736d54]
2016-12-14 07:02:56,404 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(+0x93c30)[0x3fff9a743c30]
2016-12-14 07:02:56,404 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(cfree+0x68)[0x3fff9a748218]
2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(fclose+0x1c8)[0x3fff9a727d68]
2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] numastat(+0x7aa4)[0x401d7aa4]
2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] numastat(+0x2388)[0x401d2388]
2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(+0x2291c)[0x3fff9a6d291c]
2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(__libc_start_main+0xb8)[0x3fff9a6d2b18]
2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] ======= Memory map: ========
2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] 401d0000-401e0000 r-xp 00000000 08:92 40325510 /usr/bin/numastat
2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] 401e0000-401f0000 r--p 00000000 08:92 40325510 /usr/bin/numastat
2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 401f0000-40200000 rw-p 00010000 08:92 40325510 /usr/bin/numastat
2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 10026500000-10026530000 rw-p 00000000 00:00 0 [heap]
2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 3fff9a6b0000-3fff9a860000 r-xp 00000000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so
2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 3fff9a860000-3fff9a870000 ---p 001b0000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so
2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 3fff9a870000-3fff9a880000 r--p 001b0000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so
2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 3fff9a880000-3fff9a890000 rw-p 001c0000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so
2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 3fff9a8b0000-3fff9a8c0000 rw-p 00000000 00:00 0
2016-12-14 07:02:56,407 process L0462 DEBUG| [stderr] 3fff9a8c0000-3fff9a8e0000 r-xp 00000000 00:00 0 [vdso]
2016-12-14 07:02:56,407 process L0462 DEBUG| [stderr] 3fff9a8e0000-3fff9a920000 r-xp 00000000 08:92 25745195 /lib/powerpc64le-linux-gnu/ld-2.24.so
2016-12-14 07:02:56,407 process L0462 DEBUG| [stderr] 3fff9a920000-3fff9a930000 r--p 00030000 08:92 25745195 /lib/powerpc64le-linux-gnu/ld-2.24.so
2016-12-14 07:02:56,407 process L0462 DEBUG| [stderr] 3fff9a930000-3fff9a940000 rw-p 00040000 08:92 25745195 /lib/powerpc64le-linux-gnu/ld-2.24.so
2016-12-14 07:02:56,407 process L0462 DEBUG| [stderr] 3fffdd320000-3fffdd350000 rw-p 00000000 00:00 0 [stack]

=============
Recreation Steps
=============
1. Configure host with hugepages
2. Start a guest and attach following memory device xml,
<?xml version='1.0' encoding='UTF-8'?>
<memory model="dimm"><target><size unit="KiB">8388608</size><node>0</node></target><source><pagesize unit="KiB">16384</pagesize><nodemask>0</nodemask></source></memory>
3. Set the rules in guest
4. execute numastat of guest pid

Expected Result :
Provide PID numastat

Per-node process memory usage (in MBs) for PID 55119 (qemu-system-ppc)
Node 0 Node 1 Node 16
--------------- --------------- ---------------
Huge 0.00 0.00 0.00
Heap 2.00 0.38 0.00
Stack 0.00 0.00 0.00
Private 31800.12 183.06 0.00
---------------- --------------- --------------- ---------------
Total 31802.12 183.44 0.00

Node 17 Total
--------------- ---------------
Huge 0.00 0.00
Heap 0.00 15.25
Stack 0.00 0.06
Private 0.00 33169.31
---------------- --------------- ---------------
Total 0.00 34345.00
*** Error in `numastat': free(): invalid next size (fast): 0x000001003f2c0580 ***
======= Backtrace: =========
/lib/powerpc64le-linux-gnu/libc.so.6(+0x86d54)[0x3fff82866d54]
/lib/powerpc64le-linux-gnu/libc.so.6(+0x93c30)[0x3fff82873c30]
/lib/powerpc64le-linux-gnu/libc.so.6(cfree+0x68)[0x3fff82878218]
numastat(+0x4244)[0x5adc4244]
numastat(+0x7d24)[0x5adc7d24]
numastat(+0x2388)[0x5adc2388]
/lib/powerpc64le-linux-gnu/libc.so.6(+0x2291c)[0x3fff8280291c]
/lib/powerpc64le-linux-gnu/libc.so.6(__libc_start_main+0xb8)[0x3fff82802b18]
======= Memory map: ========
5adc0000-5add0000 r-xp 00000000 08:92 40325510 /usr/bin/numastat
5add0000-5ade0000 r--p 00000000 08:92 40325510 /usr/bin/numastat
5ade0000-5adf0000 rw-p 00010000 08:92 40325510 /usr/bin/numastat
1003f2c0000-1003f2f0000 rw-p 00000000 00:00 0 [heap]
3fff827e0000-3fff82990000 r-xp 00000000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so
3fff82990000-3fff829a0000 ---p 001b0000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so
3fff829a0000-3fff829b0000 r--p 001b0000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so
3fff829b0000-3fff829c0000 rw-p 001c0000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so
3fff829e0000-3fff829f0000 rw-p 00000000 00:00 0
3fff829f0000-3fff82a10000 r-xp 00000000 00:00 0 [vdso]
3fff82a10000-3fff82a50000 r-xp 00000000 08:92 25745195 /lib/powerpc64le-linux-gnu/ld-2.24.so
3fff82a50000-3fff82a60000 r--p 00030000 08:92 25745195 /lib/powerpc64le-linux-gnu/ld-2.24.so
3fff82a60000-3fff82a70000 rw-p 00040000 08:92 25745195 /lib/powerpc64le-linux-gnu/ld-2.24.so
3fffc3b90000-3fffc3bc0000 rw-p 00000000 00:00 0 [stack]
Aborted

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
numastat.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/numastat.c b/numastat.c
index 1924dba..e0a5639 100644
--- a/numastat.c
+++ b/numastat.c
@@ -1054,7 +1054,12 @@ void show_process_info() {
} else {
tmp_row = header_rows + pid_ix;
}
- int tmp_col = header_cols + node_num;
+ // Don't assume nodes are sequential or contiguous.
+ // Need to find correct tmp_col from node_ix_map
+ int i = 0;
+ while(node_ix_map[i++] != node_num)
+ ;
+ int tmp_col = header_cols + i - 1;
double_addto(&table, tmp_row, tmp_col, value);
double_addto(&table, tmp_row, total_col_ix, value);
double_addto(&table, total_row_ix, tmp_col, value);
--
2.14.0

59
SOURCES/numactl-2.0.11-libnuma-supress-warnings-for-non-existing-node.patch

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
From a69169698c4c086b7a74602938b329fb055fdf60 Mon Sep 17 00:00:00 2001
From: Petr Holasek <pholasek@redhat.com>
Date: Mon, 7 Dec 2015 15:32:29 +0100
Subject: [PATCH] libnuma: supress warnings for non-existing node

When calling numa_node_to_cpus on non-existing node number (e.g. for
non-contiguous node numbers), a bit confusing warning is supressed. Since
warnings are implemented as weak functions they cannot be overriden when
using dlsym interface.

Signed-off-by: Petr Holasek <pholasek@redhat.com>
---
libnuma.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/libnuma.c b/libnuma.c
index 3717d5b..549525c 100644
--- a/libnuma.c
+++ b/libnuma.c
@@ -1276,11 +1276,13 @@ numa_node_to_cpus_v1(int node, unsigned long *buffer, int bufferlen)
sprintf(fn, "/sys/devices/system/node/node%d/cpumap", node);
f = fopen(fn, "r");
if (!f || getdelim(&line, &len, '\n', f) < 1) {
- numa_warn(W_nosysfs2,
- "/sys not mounted or invalid. Assuming one node: %s",
- strerror(errno));
- numa_warn(W_nosysfs2,
- "(cannot open or correctly parse %s)", fn);
+ if (numa_bitmask_isbitset(numa_nodes_ptr, node)) {
+ numa_warn(W_nosysfs2,
+ "/sys not mounted or invalid. Assuming one node: %s",
+ strerror(errno));
+ numa_warn(W_nosysfs2,
+ "(cannot open or correctly parse %s)", fn);
+ }
bitmask.maskp = (unsigned long *)mask;
bitmask.size = buflen_needed * 8;
numa_bitmask_setall(&bitmask);
@@ -1355,11 +1357,13 @@ numa_node_to_cpus_v2(int node, struct bitmask *buffer)
sprintf(fn, "/sys/devices/system/node/node%d/cpumap", node);
f = fopen(fn, "r");
if (!f || getdelim(&line, &len, '\n', f) < 1) {
- numa_warn(W_nosysfs2,
- "/sys not mounted or invalid. Assuming one node: %s",
- strerror(errno));
- numa_warn(W_nosysfs2,
- "(cannot open or correctly parse %s)", fn);
+ if (numa_bitmask_isbitset(numa_nodes_ptr, node)) {
+ numa_warn(W_nosysfs2,
+ "/sys not mounted or invalid. Assuming one node: %s",
+ strerror(errno));
+ numa_warn(W_nosysfs2,
+ "(cannot open or correctly parse %s)", fn);
+ }
numa_bitmask_setall(mask);
err = -1;
}
--
2.4.3

17
SOURCES/numactl-2.0.8-localalloc-man.patch

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
diff -up numactl-2.0.8/numactl.8.orig numactl-2.0.8/numactl.8
--- numactl-2.0.8/numactl.8.orig 2013-08-19 18:09:06.810007252 +0200
+++ numactl-2.0.8/numactl.8 2013-08-19 18:09:36.746029049 +0200
@@ -153,7 +153,11 @@ A !N-N notation indicates the inverse of
except N-N. If used with + notation, specify !+N-N.
.TP
.B \-\-localalloc, \-l
-Always allocate on the current node.
+Falls back to the system default which is local allocation by using
+.I MPOL_DEFAULT
+policy. See
+.I mbind(2)
+for details.
.TP
.B \-\-preferred=node
Preferably allocate memory on
diff -up numactl-2.0.8/numactl.8.orig.orig numactl-2.0.8/numactl.8.orig

30
SOURCES/numactl-2.0.9-hw-detect-segfault.patch

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
From: Elena Ufimtseva <ufimtseva@gmail.com>
To: linux-numa@vger.kernel.org
Cc: cpw@sgi.com, Elena Ufimtseva <ufimtseva@gmail.com>
Subject: [PATCH] numactl: checks for numa when showing hardware
Date: Sat, 23 Nov 2013 03:10:41 -0500

Checks if NUMA is available before printing hardware,
otherwise segfault occurs.

Signed-off-by: Elena Ufimtseva <ufimtseva@gmail.com>
---
numactl.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/numactl.c b/numactl.c
index 97955a4..f30b53c 100755
--- a/numactl.c
+++ b/numactl.c
@@ -242,6 +242,11 @@ void hardware(void)
int prevnode=-1;
int skip=0;
int maxnode = numa_max_node();
+
+ if (numa_available() < 0) {
+ printf("No NUMA available on this system\n");
+ exit(1);
+ }

for (i=0; i<=maxnode; i++)
if (numa_bitmask_isbitset(numa_nodes_ptr, i))

312
SOURCES/numactl-2.0.9-mpol-bind-preferred.patch

@ -0,0 +1,312 @@ @@ -0,0 +1,312 @@
Date: Tue, 15 Jul 2014 13:53:14 -0400
From: Bill Gray <bgray@redhat.com>
To: linux-numa@vger.kernel.org
Cc: Cliff Wickman <cpw@sgi.com>
Subject: [PATCH] Fix numactl --show preferred node for case MPOL_BIND

This patch is mostly to fix an issue in "numactl --show" which did not
print the correct preferred node:

# for i in 0 1 2 3 4 5 6 7 ; do numactl -N$i -m$i numactl -s; done |
grep preferred
preferred node: 4
preferred node: 4
preferred node: 4
preferred node: 4
preferred node: 4
preferred node: 4
preferred node: 4
preferred node: 4

# for i in 0 1 2 3 4 5 6 7 ; do ./numactl -N$i -m$i ./numactl -s; done |
grep preferred
preferred node: 0
preferred node: 1
preferred node: 2
preferred node: 3
preferred node: 4
preferred node: 5
preferred node: 6
preferred node: 7

Patch Changes:
- eliminated bitops.[cho]
- eliminated redundant printcpumask() (which duplicated printmask())
- added find_first() to util.[ch]
- fixed some compiler warnings

These files can be deleted:
- Only in numactl-2.0.9-orig/: bitops.c
- Only in numactl-2.0.9-orig/: bitops.h
- Only in numactl-2.0.9-orig/: numastat
- Only in numactl-2.0.9-orig/test: move_pages

diffstats:
Makefile | 12 ++++++------
bitops.c | 13 -------------
bitops.h | 13 -------------
migspeed.c | 4 +---
numactl.c | 5 ++---
numaint.h | 2 +-
test/move_pages |binary
Makefile | 12 ++++++------
bitops.c | 13 -------------
bitops.h | 13 -------------
migspeed.c | 4 +---
numactl.c | 5 ++---
numaint.h | 2 +-
test/nodemap.c | 1 -
test/tbitmap.c | 10 +++++++++-
util.c | 14 +++++---------
util.h | 2 +-
10 files changed, 25 insertions(+), 51 deletions(-)

Signed-off-by: Bill Gray <bgray@redhat.com>

Index: numactl-dev/bitops.c
===================================================================
--- numactl-dev.orig/bitops.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "bitops.h"
-
-/* extremly dumb */
-int find_first_bit(void *m, int max)
-{
- unsigned long *mask = m;
- int i;
- for (i = 0; i < max; i++) {
- if (test_bit(i, mask))
- break;
- }
- return i;
-}
Index: numactl-dev/bitops.h
===================================================================
--- numactl-dev.orig/bitops.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef BITOPS_H
-#define BITOPS_H 1
-
-#define BITS_PER_LONG (sizeof(unsigned long) * 8)
-#define BYTES_PER_LONG (sizeof(long))
-
-#define test_bit(i,p) ((p)[(i) / BITS_PER_LONG] & (1UL << ((i)%BITS_PER_LONG)))
-#define set_bit(i,p) ((p)[(i) / BITS_PER_LONG] |= (1UL << ((i)%BITS_PER_LONG)))
-#define clear_bit(i,p) ((p)[(i) / BITS_PER_LONG] &= ~(1UL << ((i)%BITS_PER_LONG)))
-
-extern int find_first_bit(void *mask, int max);
-
-#endif
Index: numactl-dev/Makefile
===================================================================
--- numactl-dev.orig/Makefile
+++ numactl-dev/Makefile
@@ -23,7 +23,7 @@ ifeq ($(THREAD_SUPPORT),yes)
endif

CLEANFILES := numactl.o libnuma.o numactl numademo numademo.o distance.o \
- memhog libnuma.so libnuma.so.1 numamon numamon.o syscall.o bitops.o \
+ memhog libnuma.so libnuma.so.1 numamon numamon.o syscall.o \
memhog.o util.o stream_main.o stream_lib.o shm.o stream clearcache.o \
test/pagesize test/tshared test/mynode.o test/tshared.o mt.o empty.o empty.c \
test/mynode test/ftok test/prefered test/randmap \
@@ -32,8 +32,8 @@ CLEANFILES := numactl.o libnuma.o numact
test/mbind_mig_pages test/migrate_pages \
migratepages migspeed migspeed.o libnuma.a \
test/move_pages test/realloc_test sysfs.o affinity.o \
- test/node-parse rtnetlink.o test/A numastat
-SOURCES := bitops.c libnuma.c distance.c memhog.c numactl.c numademo.c \
+ test/node-parse rtnetlink.o test/A numastat numastat.o
+SOURCES := libnuma.c distance.c memhog.c numactl.c numademo.c \
numamon.c shm.c stream_lib.c stream_main.c syscall.c util.c mt.c \
clearcache.c test/*.c affinity.c sysfs.c rtnetlink.c numastat.c

@@ -51,11 +51,11 @@ all: numactl migratepages migspeed libnu
test/mbind_mig_pages test/migrate_pages test/realloc_test libnuma.a \
test/node-parse numastat

-numactl: numactl.o util.o shm.o bitops.o libnuma.so
+numactl: numactl.o util.o shm.o libnuma.so

numastat: CFLAGS += -std=gnu99

-migratepages: migratepages.c util.o bitops.o libnuma.so
+migratepages: migratepages.c util.o libnuma.so

migspeed: LDLIBS += -lrt
migspeed: migspeed.o util.o libnuma.so
@@ -129,7 +129,7 @@ test/nodemap: test/nodemap.c libnuma.so

test/distance: test/distance.c libnuma.so

-test/tbitmap: test/tbitmap.c libnuma.so
+test/tbitmap: test/tbitmap.c libnuma.so util.o

test/move_pages: test/move_pages.c libnuma.so

Index: numactl-dev/migspeed.c
===================================================================
--- numactl-dev.orig/migspeed.c
+++ numactl-dev/migspeed.c
@@ -65,7 +65,6 @@ int main(int argc, char *argv[])
{
char *p;
int option;
- int error = 0;
struct timespec result;
unsigned long bytes;
double duration, mbytes;
@@ -82,8 +81,7 @@ int main(int argc, char *argv[])
switch (option) {
case 'h' :
case '?' :
- error = 1;
- break;
+ usage();
case 'v' :
verbose++;
break;
Index: numactl-dev/numactl.c
===================================================================
--- numactl-dev.orig/numactl.c
+++ numactl-dev/numactl.c
@@ -119,7 +119,7 @@ void show_physcpubind(void)
}
err("sched_get_affinity");
}
- printcpumask("physcpubind", cpubuf);
+ printmask("physcpubind", cpubuf);
break;
}
}
@@ -130,7 +130,6 @@ void show(void)
struct bitmask *membind, *interleave, *cpubind;
unsigned long cur;
int policy;
- int numa_num_nodes = numa_num_possible_nodes();

if (numa_available() < 0) {
show_physcpubind();
@@ -166,7 +165,7 @@ void show(void)
printf("%ld (interleave next)\n",cur);
break;
case MPOL_BIND:
- printf("%d\n", find_first_bit(&membind, numa_num_nodes));
+ printf("%d\n", find_first(membind));
break;
}
if (policy == MPOL_INTERLEAVE) {
Index: numactl-dev/numaint.h
===================================================================
--- numactl-dev.orig/numaint.h
+++ numactl-dev/numaint.h
@@ -1,5 +1,4 @@
/* Internal interfaces of libnuma */
-#include "bitops.h"

extern int numa_sched_setaffinity_v1(pid_t pid, unsigned len, const unsigned long *mask);
extern int numa_sched_getaffinity_v1(pid_t pid, unsigned len, const unsigned long *mask);
@@ -12,6 +11,7 @@ extern int numa_sched_getaffinity_v2_int

#define SHM_HUGETLB 04000 /* segment will use huge TLB pages */

+#define BITS_PER_LONG (sizeof(unsigned long) * 8)
#define CPU_BYTES(x) (round_up(x, BITS_PER_LONG)/8)
#define CPU_LONGS(x) (CPU_BYTES(x) / sizeof(long))

Index: numactl-dev/test/nodemap.c
===================================================================
--- numactl-dev.orig/test/nodemap.c
+++ numactl-dev/test/nodemap.c
@@ -1,5 +1,4 @@
#include "numa.h"
-#include "bitops.h"
#include <stdio.h>
#include <stdlib.h>

Index: numactl-dev/test/tbitmap.c
===================================================================
--- numactl-dev.orig/test/tbitmap.c
+++ numactl-dev/test/tbitmap.c
@@ -7,6 +7,13 @@
#include <stdlib.h>
#include <ctype.h>
#include "numa.h"
+#include "util.h"
+
+/* For util.c. Fixme. */
+void usage(void)
+{
+ exit(1);
+}

#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))

@@ -81,11 +88,12 @@ int main(void)
numa_bitmask_clearall(mask);
numa_bitmask_clearall(mask2);
numa_bitmask_setbit(mask, i);
+ assert(find_first(mask) == i);
bitmap_scnprintf(buf, sizeof(buf), mask);
strcat(buf,"\n");
if (numa_parse_bitmap(buf, mask2) < 0)
assert(0);
- if (memcmp(mask, mask2, sizeof(mask))) {
+ if (memcmp(mask->maskp, mask2->maskp, numa_bitmask_nbytes(mask))) {
bitmap_scnprintf(buf, sizeof(buf), mask2);
printf("mask2 differs: %s\n", buf);
assert(0);
Index: numactl-dev/util.c
===================================================================
--- numactl-dev.orig/util.c
+++ numactl-dev/util.c
@@ -16,7 +16,6 @@
#include "numa.h"
#include "numaif.h"
#include "util.h"
-#include "bitops.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -28,23 +27,20 @@
void printmask(char *name, struct bitmask *mask)
{
int i;
-
printf("%s: ", name);
- for (i = 0; i <= mask->size; i++)
+ for (i = 0; i < mask->size; i++)
if (numa_bitmask_isbitset(mask, i))
printf("%d ", i);
putchar('\n');
}

-void printcpumask(char *name, struct bitmask *mask)
+int find_first(struct bitmask *mask)
{
int i;
- printf("%s: ", name);
- for (i = 0; i < mask->size; i++) {
+ for (i = 0; i < mask->size; i++)
if (numa_bitmask_isbitset(mask, i))
- printf("%d ", i);
- }
- putchar('\n');
+ return i;
+ return -1;
}

void complain(char *fmt, ...)
Index: numactl-dev/util.h
===================================================================
--- numactl-dev.orig/util.h
+++ numactl-dev/util.h
@@ -1,5 +1,5 @@
extern void printmask(char *name, struct bitmask *mask);
-extern void printcpumask(char *name, struct bitmask *mask);
+extern int find_first(struct bitmask *mask);
extern struct bitmask *nodemask(char *s);
extern struct bitmask *cpumask(char *s, int *ncpus);
extern int read_sysctl(char *name);

295
SPECS/numactl.spec

@ -0,0 +1,295 @@ @@ -0,0 +1,295 @@
Name: numactl
Summary: Library for tuning for Non Uniform Memory Access machines
Version: 2.0.9
Release: 7%{?dist}
# libnuma is LGPLv2 and GPLv2
# numactl binaries are GPLv2 only
License: GPLv2
Group: System Environment/Base
URL: ftp://oss.sgi.com/www/projects/libnuma/download
Source0: ftp://oss.sgi.com/www/projects/libnuma/download/numactl-%{version}.tar.gz
Buildroot: %{_tmppath}/%{name}-buildroot

ExcludeArch: s390 s390x %{arm}

Patch1: numactl-2.0.8-localalloc-man.patch
Patch2: numactl-2.0.9-hw-detect-segfault.patch
Patch3: numactl-2.0.9-mpol-bind-preferred.patch
Patch4: numactl-2.0.10-numa_node_to_cpu_skip_over_nonexisting.patch
Patch5: numactl-2.0.11-libnuma-supress-warnings-for-non-existing-node.patch
Patch6: numactl-2.0.11-Segment-fault-when-numa-nodes-not-sequential-or-cont.patch

%description
Simple NUMA policy support. It consists of a numactl program to run
other programs with a specific NUMA policy.

%package libs
Summary: libnuma libraries
# There is a tiny bit of GPLv2 code in libnuma.c
License: LGPLv2 and GPLv2
Group: System Environment/Libraries

%description libs
numactl-libs provides libnuma, a library to do allocations with
NUMA policy in applications.

%package devel
Summary: Development package for building Applications that use numa
Group: System Environment/Libraries
Requires: %{name}-libs = %{version}-%{release}
License: LGPLv2 and GPLv2

%description devel
Provides development headers for numa library calls

%prep
%setup -q -n %{name}-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1

%build
make clean
make CFLAGS="$RPM_OPT_FLAGS -I."

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_bindir}
mkdir -p $RPM_BUILD_ROOT%{_libdir}
mkdir -p $RPM_BUILD_ROOT%{_includedir}
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8

make prefix=$RPM_BUILD_ROOT/usr libdir=$RPM_BUILD_ROOT/%{_libdir} install

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig
%post libs -p /sbin/ldconfig

%postun -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc README
%{_bindir}/numactl
%{_bindir}/numademo
%{_bindir}/numastat
%{_bindir}/memhog
%{_bindir}/migspeed
%{_bindir}/migratepages
%{_mandir}/man8/*.8*

%files libs
%defattr(-,root,root,-)
%{_libdir}/libnuma.so.1

%files devel
%defattr(-,root,root,-)
%{_libdir}/libnuma.so
%exclude %{_libdir}/libnuma.a
%{_includedir}/numa.h
%{_includedir}/numaif.h
%{_includedir}/numacompat1.h
%{_mandir}/man3/*.3*

%changelog
* Tue Aug 8 2017 Petr Oros <poros@redhat.com> - 2.0.9-7
- Segment fault when numa nodes not sequential or contiguous
- Resolves: #1219445

* Mon Dec 14 2015 Petr Holasek <pholasek@redhat.com> - 2.0.9-6
- confusing warning supressed (bz1270734)

* Wed Jul 01 2015 Petr Holasek <pholasek@redhat.com> - 2.0.9-5
- numa_node_to_cpu skips over non-existing nodes (bz1180415)

* Mon Nov 10 2014 Petr Holasek <pholasek@redhat.com> - 2.0.9-4
- Fixed missing question mark in dist macro

* Thu Jul 31 2014 Petr Holasek <pholasek@redhat.com> - 2.0.9-3
- Fixed hw detect segfault (bz1061874)
- Fixed printing of preferred node for MPOL_BIND (bz1119887)

* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 2.0.9-2
- Mass rebuild 2013-12-27

* Fri Oct 25 2013 Petr Holasek <pholasek@redhat.com> - 2.0.9-1
- rebased to version 2.0.9 (bz1017053)

* Mon Aug 19 2013 Petr Holasek <pholasek@redhat.com> - 2.0.8-6
- localalloc manpage option is more verbose (bz881779)

* Tue Jul 30 2013 Petr Holasek <pholasek@redhat.com> - 2.0.8-5
- numastat minor bugfixes
- manpage and usage fixes (bz948377)

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.8-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Tue Jan 22 2013 Petr Holasek <pholasek@redhat.com> - 2.0.8-3
- deleted empty numastat file

* Thu Nov 1 2012 Tom Callaway <spot@fedoraproject.org> - 2.0.8-2
- fix license issues

* Fri Oct 26 2012 Petr Holasek <pholasek@redhat.com> - 2.0.8-1
- Rebased to version 2.0.8

* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.7-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Sat May 19 2012 Petr Holasek <pholasek@redhat.com> - 2.0.7-6
- numademo segfault fix (bz823125, bz823127)

* Sun Apr 15 2012 Petr Holasek <pholasek@redhat.com> - 2.0.7-5
- Library splitted out of numactl package to numactl-libs

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.7-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Sun Jan 01 2012 Anton Arapov <anton@redhat.com> - 2.0.7-3
- Include missing manpages

* Sat Jun 18 2011 Peter Robinson <pbrobinson@gmail.com> - 2.0.7-2
- Exclude ARM platforms

* Fri Apr 15 2011 Anton Arapov <anton@redhat.com> - 2.0.7-1
- Update to latest upstream stable version (bz 696703)

* Tue Mar 22 2011 Anton Arapov <anton@redhat.com> - 2.0.6-2
- Better manpages (bz 673613)

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Tue Jan 04 2011 Neil Horman <nhorman@redhat.com> - 2.0.6-1
- Update to latest upstream stable version (bz 666379)

* Mon Oct 18 2010 Neil Horman <nhorman@redhat.com> - 2.0.5-1
- Update to latest stable upstream source

* Mon Feb 15 2010 Neil Horman <nhorman@redhat.com> - 2.0.3-8
- Remove static libs from numactl (bz 556088)

* Mon Aug 10 2009 Neil Horman <nhorman@redhat.com> - 2.0.3-7
- Add destructor to libnuma.so to free allocated memory (bz 516227)

* Mon Aug 10 2009 Neil Horman <nhorman@redhat.com> - 2.0.3-6
- Fix obo in nodes_allowed_list strncpy (bz 516223)

* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Fri Jun 26 2009 Neil Horman <nhorman@redhat.com>
- Update to full 2.0.3 version (bz 506795)

* Wed Jun 17 2009 Neil Horman <nhorman@redhat.com>
- Fix silly libnuma warnings again (bz 499633)

* Fri May 08 2009 Neil Horman <nhorman@redhat.com>
- Update to 2.0.3-rc3 (bz 499633)

* Wed Mar 25 2009 Mark McLoughlin <markmc@redhat.com> - 2.0.2-4
- Remove warning from libnuma (bz 484552)

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Mon Sep 29 2008 Neil Horman <nhorman@redhat.com> - 2.0.2-2
- Fix build break due to register selection in asm

* Mon Sep 29 2008 Neil Horman <nhorman@redhat.com> - 2.0.2-1
- Update rawhide to version 2.0.2 of numactl

* Fri Apr 25 2008 Neil Horman <nhorman@redhat.com> - 1.0.2-6
- Fix buffer size passing and arg sanity check for physcpubind (bz 442521)

* Fri Mar 14 2008 Neil Horman <nhorman@redhat.com> - 1.0.2-5
- Fixing spec file to actually apply alpha patch :)

* Fri Mar 14 2008 Neil Horman <nhorman@redhat.com> - 1.0.2-4
- Add alpha syscalls (bz 396361)

* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.0.2-3
- Autorebuild for GCC 4.3

* Thu Dec 20 2007 Neil Horman <nhorman@redhat.com> - 1.0.2-1
- Update numactl to fix get_mempolicy signature (bz 418551)

* Fri Dec 14 2007 Neil Horman <nhorman@redhat.com> - 1.0.2-1
- Update numactl to latest version (bz 425281)

* Tue Aug 07 2007 Neil Horman <nhorman@redhat.com> - 0.9.8-4
- Fixing some remaining merge review issues (bz 226207)

* Fri Aug 03 2007 Neil Horman <nhorman@redhat.com> - 0.9.8-3
- fixing up merge review (bz 226207)

* Fri Jan 12 2007 Neil Horman <nhorman@redhat.com> - 0.9.8-2
- Properly fixed bz 221982
- Updated revision string to include %{dist}

* Thu Jan 11 2007 Neil Horman <nhorman@redhat.com> - 0.9.8-1.38
- Fixed -devel to depend on base package so libnuma.so resolves

* Thu Sep 21 2006 Neil Horman <nhorman@redhat.com> - 0.9.8-1.36
- adding nodebind patch for bz 207404

* Fri Aug 25 2006 Neil Horman <nhorman@redhat.com> - 0.9.8-1.35
- moving over libnuma.so to -devel package as well

* Fri Aug 25 2006 Neil Horman <nhorman@redhat.com> - 0.9.8-1.34
- split out headers/devel man pages to a devel subpackage

* Tue Aug 15 2006 Neil Horman <nhorman@redhat.com> - 0.9.8-1.32
- add patch for broken cpu/nodebind output (bz 201906)

* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 0.9.8-1.31
- rebuild

* Tue Jun 13 2006 Neil Horman <nhorman@redhat.com>
- Rebased numactl to version 0.9.8 for FC6/RHEL5

* Wed Apr 26 2006 Neil Horman <nhorman@redhat.com>
- Added patches for 64 bit overflows and cpu mask problem

* Fri Mar 10 2006 Bill Nottingham <notting@redhat.com>
- rebuild for ppc TLS issue (#184446)

* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 0.6.4-1.25.2
- bump again for double-long bug on ppc(64)

* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com>
- rebuilt for new gcc4.1 snapshot and glibc changes

* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt

* Thu Jul 7 2005 Dave Jones <davej@redhat.com>
- numactl doesn't own the manpage dirs. (#161547)

* Tue Mar 1 2005 Dave Jones <davej@redhat.com>
- Rebuild for gcc4

* Tue Feb 8 2005 Dave Jones <davej@redhat.com>
- rebuild with -D_FORTIFY_SOURCE=2

* Wed Nov 10 2004 David Woodhouse <dwmw2@redhat.com>
- Fix build on x86_64

* Thu Oct 21 2004 David Woodhouse <dwmw2@redhat.com>
- Add PPC support

* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt

* Sat Jun 05 2004 Warren Togami <wtogami@redhat.com>
- spec cleanup

* Sat Jun 05 2004 Arjan van de Ven <arjanv@redhat.com>
- initial packaging
Loading…
Cancel
Save