Merge ~paelzer/ubuntu/+source/numactl:lp1817258-bionic into ubuntu/+source/numactl:ubuntu/bionic-devel

Proposed by Christian Ehrhardt 
Status: Merged
Approved by: Robie Basak
Approved revision: 36eb483c5588de54df0c5e992d204c5aeb6597ba
Merged at revision: 36eb483c5588de54df0c5e992d204c5aeb6597ba
Proposed branch: ~paelzer/ubuntu/+source/numactl:lp1817258-bionic
Merge into: ubuntu/+source/numactl:ubuntu/bionic-devel
Diff against target: 223 lines (+197/-0)
4 files modified
debian/changelog (+12/-0)
debian/patches/Allow-building-on-ARM-systems.patch (+47/-0)
debian/patches/lp1817258-Segment-fault-when-numa-nodes-not-sequential-or-cont.patch (+136/-0)
debian/patches/series (+2/-0)
Reviewer Review Type Date Requested Status
Robie Basak Approve
Canonical Server Pending
git-ubuntu developers Pending
Review via email: mp+363777@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Robie Basak (racb) wrote :

lgtm with one minor comment inline.

review: Approve
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

It was modified to their former upstreaming in the last bug - adapted the patch headers thanks!

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Fixed tagged and pushed

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index dd0f2e1..0deec3e 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,15 @@
6+numactl (2.0.11-2.1ubuntu0.1) bionic; urgency=medium
7+
8+ * d/p/lp1817258-Segment-fault-when-numa-nodes-not-sequential-or-cont.patch:
9+ fix segfault on uncommon numa node setups (LP: #1817258)
10+ * debian/patches/Allow-building-on-ARM-systems.patch:
11+ - add __arm__ to avoid failure due to missing syscalls.
12+ - return -1 and set errno to ENOSYS on migrate_pages function
13+ if __NR_migrate_pages is undefined, thanks Uwe Kleine-König
14+ and Tiago Stürmer Daitx (LP: #1711478).
15+
16+ -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Wed, 20 Jun 2018 16:36:20 +0200
17+
18 numactl (2.0.11-2.1) unstable; urgency=medium
19
20 * Non-maintainer upload.
21diff --git a/debian/patches/Allow-building-on-ARM-systems.patch b/debian/patches/Allow-building-on-ARM-systems.patch
22new file mode 100644
23index 0000000..c606113
24--- /dev/null
25+++ b/debian/patches/Allow-building-on-ARM-systems.patch
26@@ -0,0 +1,47 @@
27+Description: Allow building on ARM systems
28+ While 32-bit ARM systems do not support NUMA, it is useful to be able
29+ to build libnuma for these systems. Distributions would then not need to
30+ special case ARM builds for software that uses libnuma when available.
31+ libnuma's API requires users to check for NUMA support at runtime using
32+ numa_available() which will just always return -1 on ARM.
33+ .
34+ numactl build fails on arm because arm does not define __NR_migrate_pages.
35+ In order to build it on arm the arch must be added to the syscalls check
36+ and the migrate_pages must return with -1 and set errno to ENOSYS.
37+Origin: upstream, https://github.com/numactl/numactl/commit/e13c9a8417360b16a586226f3b80db0d0aebc248
38+Author: Uwe Kleine-König <uwe+debian@kleine-koenig.org>
39+Author: Tiago Stürmer Daitx <tiago.daitx@ubuntu.com>
40+Author: dann frazier <dannf@ubuntu.com>
41+Bug-Debian: https://bugs.debian.org/796802
42+Bug-Ubuntu: https://launchpad.net/bugs/1711478
43+Last-Update: 2018-04-17
44+
45+--- a/syscall.c
46++++ b/syscall.c
47+@@ -109,6 +109,10 @@
48+
49+ #define __NR_migrate_pages 272
50+
51++#elif defined(__arm__)
52++/* https://bugs.debian.org/796802 */
53++#warning "ARM does not implement the migrate_pages() syscall"
54++
55+ #elif !defined(DEPS_RUN)
56+ #error "Add syscalls for your architecture or update kernel headers"
57+ #endif
58+@@ -211,7 +215,12 @@ long WEAK set_mempolicy(int mode, const unsigned long *nmask,
59+ long WEAK migrate_pages(int pid, unsigned long maxnode,
60+ const unsigned long *frommask, const unsigned long *tomask)
61+ {
62++#if defined(__NR_migrate_pages)
63+ return syscall(__NR_migrate_pages, pid, maxnode, frommask, tomask);
64++#else
65++ errno = ENOSYS;
66++ return -1;
67++#endif
68+ }
69+
70+ long WEAK move_pages(int pid, unsigned long count,
71+--
72+2.17.0
73+
74diff --git a/debian/patches/lp1817258-Segment-fault-when-numa-nodes-not-sequential-or-cont.patch b/debian/patches/lp1817258-Segment-fault-when-numa-nodes-not-sequential-or-cont.patch
75new file mode 100644
76index 0000000..1f68a7b
77--- /dev/null
78+++ b/debian/patches/lp1817258-Segment-fault-when-numa-nodes-not-sequential-or-cont.patch
79@@ -0,0 +1,136 @@
80+From b608687037d873ad82d6318f231b3d6612e8601d Mon Sep 17 00:00:00 2001
81+From: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
82+Date: Wed, 21 Dec 2016 12:48:11 +0530
83+Subject: [PATCH] Segment fault when numa nodes not sequential or contiguous
84+
85+While trying to get stat of the guest process (configured with hugepages), numastat fails
86+
87+====================
88+Environment details
89+====================
90+Linux lep8b 4.8.0-30-generic #32-Ubuntu SMP Fri Dec 2 03:43:46 UTC 2016 ppc64le ppc64le ppc64le GNU/Linu
91+
92+=====
93+Issue
94+=====
95+2016-12-14 07:02:56,396 process L0368 INFO | Running 'numastat 61257'
96+2016-12-14 07:02:56,402 process L0462 DEBUG| [stderr] *** Error in `numastat': double free or corruption (out): 0x00000100265005a0 ***
97+2016-12-14 07:02:56,403 process L0462 DEBUG| [stdout]
98+2016-12-14 07:02:56,403 process L0482 INFO | Command 'numastat 61257' finished with -6 after 0.00309896469116s
99+2016-12-14 07:02:56,403 process L0462 DEBUG| [stdout] Per-node process memory usage (in MBs) for PID 61257 (qemu-system-ppc)
100+2016-12-14 07:02:56,404 process L0462 DEBUG| [stderr] ======= Backtrace: =========
101+2016-12-14 07:02:56,404 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(+0x86d54)[0x3fff9a736d54]
102+2016-12-14 07:02:56,404 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(+0x93c30)[0x3fff9a743c30]
103+2016-12-14 07:02:56,404 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(cfree+0x68)[0x3fff9a748218]
104+2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(fclose+0x1c8)[0x3fff9a727d68]
105+2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] numastat(+0x7aa4)[0x401d7aa4]
106+2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] numastat(+0x2388)[0x401d2388]
107+2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(+0x2291c)[0x3fff9a6d291c]
108+2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] /lib/powerpc64le-linux-gnu/libc.so.6(__libc_start_main+0xb8)[0x3fff9a6d2b18]
109+2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] ======= Memory map: ========
110+2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] 401d0000-401e0000 r-xp 00000000 08:92 40325510 /usr/bin/numastat
111+2016-12-14 07:02:56,405 process L0462 DEBUG| [stderr] 401e0000-401f0000 r--p 00000000 08:92 40325510 /usr/bin/numastat
112+2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 401f0000-40200000 rw-p 00010000 08:92 40325510 /usr/bin/numastat
113+2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 10026500000-10026530000 rw-p 00000000 00:00 0 [heap]
114+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
115+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
116+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
117+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
118+2016-12-14 07:02:56,406 process L0462 DEBUG| [stderr] 3fff9a8b0000-3fff9a8c0000 rw-p 00000000 00:00 0
119+2016-12-14 07:02:56,407 process L0462 DEBUG| [stderr] 3fff9a8c0000-3fff9a8e0000 r-xp 00000000 00:00 0 [vdso]
120+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
121+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
122+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
123+2016-12-14 07:02:56,407 process L0462 DEBUG| [stderr] 3fffdd320000-3fffdd350000 rw-p 00000000 00:00 0 [stack]
124+
125+=============
126+Recreation Steps
127+=============
128+1. Configure host with hugepages
129+2. Start a guest and attach following memory device xml,
130+<?xml version='1.0' encoding='UTF-8'?>
131+<memory model="dimm"><target><size unit="KiB">8388608</size><node>0</node></target><source><pagesize unit="KiB">16384</pagesize><nodemask>0</nodemask></source></memory>
132+3. Set the rules in guest
133+4. execute numastat of guest pid
134+
135+Expected Result :
136+Provide PID numastat
137+
138+Per-node process memory usage (in MBs) for PID 55119 (qemu-system-ppc)
139+Node 0 Node 1 Node 16
140+--------------- --------------- ---------------
141+Huge 0.00 0.00 0.00
142+Heap 2.00 0.38 0.00
143+Stack 0.00 0.00 0.00
144+Private 31800.12 183.06 0.00
145+---------------- --------------- --------------- ---------------
146+Total 31802.12 183.44 0.00
147+
148+Node 17 Total
149+--------------- ---------------
150+Huge 0.00 0.00
151+Heap 0.00 15.25
152+Stack 0.00 0.06
153+Private 0.00 33169.31
154+---------------- --------------- ---------------
155+Total 0.00 34345.00
156+*** Error in `numastat': free(): invalid next size (fast): 0x000001003f2c0580 ***
157+======= Backtrace: =========
158+/lib/powerpc64le-linux-gnu/libc.so.6(+0x86d54)[0x3fff82866d54]
159+/lib/powerpc64le-linux-gnu/libc.so.6(+0x93c30)[0x3fff82873c30]
160+/lib/powerpc64le-linux-gnu/libc.so.6(cfree+0x68)[0x3fff82878218]
161+numastat(+0x4244)[0x5adc4244]
162+numastat(+0x7d24)[0x5adc7d24]
163+numastat(+0x2388)[0x5adc2388]
164+/lib/powerpc64le-linux-gnu/libc.so.6(+0x2291c)[0x3fff8280291c]
165+/lib/powerpc64le-linux-gnu/libc.so.6(__libc_start_main+0xb8)[0x3fff82802b18]
166+======= Memory map: ========
167+5adc0000-5add0000 r-xp 00000000 08:92 40325510 /usr/bin/numastat
168+5add0000-5ade0000 r--p 00000000 08:92 40325510 /usr/bin/numastat
169+5ade0000-5adf0000 rw-p 00010000 08:92 40325510 /usr/bin/numastat
170+1003f2c0000-1003f2f0000 rw-p 00000000 00:00 0 [heap]
171+3fff827e0000-3fff82990000 r-xp 00000000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so
172+3fff82990000-3fff829a0000 ---p 001b0000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so
173+3fff829a0000-3fff829b0000 r--p 001b0000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so
174+3fff829b0000-3fff829c0000 rw-p 001c0000 08:92 25745199 /lib/powerpc64le-linux-gnu/libc-2.24.so
175+3fff829e0000-3fff829f0000 rw-p 00000000 00:00 0
176+3fff829f0000-3fff82a10000 r-xp 00000000 00:00 0 [vdso]
177+3fff82a10000-3fff82a50000 r-xp 00000000 08:92 25745195 /lib/powerpc64le-linux-gnu/ld-2.24.so
178+3fff82a50000-3fff82a60000 r--p 00030000 08:92 25745195 /lib/powerpc64le-linux-gnu/ld-2.24.so
179+3fff82a60000-3fff82a70000 rw-p 00040000 08:92 25745195 /lib/powerpc64le-linux-gnu/ld-2.24.so
180+3fffc3b90000-3fffc3bc0000 rw-p 00000000 00:00 0 [stack]
181+Aborted
182+
183+Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
184+Signed-off-by: Andi Kleen <ak@linux.intel.com>
185+
186+Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
187+Original-Author: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
188+Origin: backport, https://github.com/numactl/numactl/commit/b608687037d873ad82d6318f231b3d6612e8601d
189+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1817258
190+Last-Update: 2019-02-28
191+---
192+ numastat.c | 7 ++++++-
193+ 1 file changed, 6 insertions(+), 1 deletion(-)
194+
195+diff --git a/numastat.c b/numastat.c
196+index 1924dba..e0a5639 100644
197+--- a/numastat.c
198++++ b/numastat.c
199+@@ -1054,7 +1054,12 @@ void show_process_info() {
200+ } else {
201+ tmp_row = header_rows + pid_ix;
202+ }
203+- int tmp_col = header_cols + node_num;
204++ // Don't assume nodes are sequential or contiguous.
205++ // Need to find correct tmp_col from node_ix_map
206++ int i = 0;
207++ while(node_ix_map[i++] != node_num)
208++ ;
209++ int tmp_col = header_cols + i - 1;
210+ double_addto(&table, tmp_row, tmp_col, value);
211+ double_addto(&table, tmp_row, total_col_ix, value);
212+ double_addto(&table, total_row_ix, tmp_col, value);
213+--
214+2.17.1
215+
216diff --git a/debian/patches/series b/debian/patches/series
217new file mode 100644
218index 0000000..20fa623
219--- /dev/null
220+++ b/debian/patches/series
221@@ -0,0 +1,2 @@
222+Allow-building-on-ARM-systems.patch
223+lp1817258-Segment-fault-when-numa-nodes-not-sequential-or-cont.patch

Subscribers

People subscribed via source and target branches