Merge ~paelzer/ubuntu/+source/libvirt:post-disco-sru-set-bionic into ubuntu/+source/libvirt:ubuntu/bionic-devel

Proposed by Christian Ehrhardt 
Status: Merged
Approved by: Andreas Hasenack
Approved revision: 58e613625f497178aa2f511b9883af2372e92ae7
Merge reported by: Christian Ehrhardt 
Merged at revision: 35c9f07f1af41235a09f5ea2d42b4c55b624c137
Proposed branch: ~paelzer/ubuntu/+source/libvirt:post-disco-sru-set-bionic
Merge into: ubuntu/+source/libvirt:ubuntu/bionic-devel
Diff against target: 426 lines (+380/-0)
7 files modified
debian/changelog (+9/-0)
debian/patches/series (+5/-0)
debian/patches/ubuntu/lp-1771662-1-util-fixing-wrong-assumption-that-PF-has-to-have-net.patch (+62/-0)
debian/patches/ubuntu/lp-1771662-2-util-Code-simplification.patch (+104/-0)
debian/patches/ubuntu/lp-1771662-3-util-Fix-for-NULL-dereference.patch (+74/-0)
debian/patches/ubuntu/lp-1771662-4-util-Fixing-invalid-error-checking-from-virPCIGetNet.patch (+35/-0)
debian/patches/ubuntu/lp-1811198-utils-Remove-arbitrary-limit-on-socket_id-core_id.patch (+91/-0)
Reviewer Review Type Date Requested Status
Andreas Hasenack Approve
Canonical Server Pending
git-ubuntu developers Pending
Review via email: mp+362545@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

dep8 tests are only hitting known flaky tests, so they are ok

Also the automated virt regression tests ran fine on all architectures.

Remaining: I'm waiting for the bug reporters to confirm test-ability and the MP review here

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Just the incorrect bug number in the DEP3 header of lp-1811198-utils-Remove-arbitrary-limit-on-socket_id-core_id.patch.

+1

review: Approve
35c9f07... by Christian Ehrhardt 

d/p/ubuntu/lp-1811198-*: fix bug number

Signed-off-by: Christian Ehrhardt <email address hidden>

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

Thanks, I fixed the bug reference.

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 5950a9c..5e07e87 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,12 @@
6+libvirt (4.0.0-1ubuntu8.7) bionic; urgency=medium
7+
8+ * d/p/ubuntu/lp-1811198-utils-Remove-arbitrary-limit-on-socket_id-core_id
9+ .patch: fix arm servers with high core_id (LP: #1811198)
10+ * d/p/ubuntu/lp-1771662-*: fix assumption that all VFs have PFs assigned
11+ (LP: #1771662)
12+
13+ -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Thu, 31 Jan 2019 12:45:18 +0100
14+
15 libvirt (4.0.0-1ubuntu8.6) bionic; urgency=medium
16
17 * d/control: explicitly Build-dep on libwiretap-dev to fix FTBFS since
18diff --git a/debian/patches/series b/debian/patches/series
19index 80ff215..62ec37c 100644
20--- a/debian/patches/series
21+++ b/debian/patches/series
22@@ -120,3 +120,8 @@ ubuntu/lp1787405-0004-qemu-vfio-ap-device-support.patch
23 ubuntu/lp1787405-0005-qemu-domain-device-definition-hostdev-validation.patch
24 ubuntu/lp1787405-0006-conf-Move-VFIO-AP-validation-from-post-parse-to-QEMU.patch
25 ubuntu/lp1787405-0007-virt-aa-helper-mdevs-need-vfio.patch
26+ubuntu/lp-1811198-utils-Remove-arbitrary-limit-on-socket_id-core_id.patch
27+ubuntu/lp-1771662-1-util-fixing-wrong-assumption-that-PF-has-to-have-net.patch
28+ubuntu/lp-1771662-2-util-Code-simplification.patch
29+ubuntu/lp-1771662-3-util-Fix-for-NULL-dereference.patch
30+ubuntu/lp-1771662-4-util-Fixing-invalid-error-checking-from-virPCIGetNet.patch
31diff --git a/debian/patches/ubuntu/lp-1771662-1-util-fixing-wrong-assumption-that-PF-has-to-have-net.patch b/debian/patches/ubuntu/lp-1771662-1-util-fixing-wrong-assumption-that-PF-has-to-have-net.patch
32new file mode 100644
33index 0000000..a7944e1
34--- /dev/null
35+++ b/debian/patches/ubuntu/lp-1771662-1-util-fixing-wrong-assumption-that-PF-has-to-have-net.patch
36@@ -0,0 +1,62 @@
37+From 6452e2f5e1837bd753ee465e6607ed3c4f62b815 Mon Sep 17 00:00:00 2001
38+From: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
39+Date: Tue, 22 Jan 2019 12:26:12 -0700
40+Subject: [PATCH 1/4] util: fixing wrong assumption that PF has to have netdev
41+ assigned
42+
43+libvirt wrongly assumes that VF netdev has to have the
44+netdev assigned to PF. There is no such requirement in SRIOV standard.
45+This patch change the virNetDevSwitchdevFeature() function to deal
46+with SRIOV devices which does not have netdev on PF. Also corrects
47+one comment about PF netdev assumption.
48+
49+One example of such devices is ThunderX VNIC.
50+By applying this change, VF device is used for virNetlinkCommand() as
51+it is the only netdev assigned to VNIC.
52+
53+Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
54+Signed-off-by: dann frazier <dann.frazier@canonical.com>
55+Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
56+
57+Origin: upstream, https://libvirt.org/git/?p=libvirt.git;a=commit;h=6452e2f5e1837bd753ee465e6607ed3c4f62b815
58+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1771662
59+Last-Update: 2019-01-31
60+
61+---
62+ src/util/virnetdev.c | 13 ++++++++-----
63+ 1 file changed, 8 insertions(+), 5 deletions(-)
64+
65+diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
66+index 2111b3ada9..d3e69b6f60 100644
67+--- a/src/util/virnetdev.c
68++++ b/src/util/virnetdev.c
69+@@ -1355,9 +1355,8 @@ virNetDevGetPhysicalFunction(const char *ifname, char **pfname)
70+ }
71+
72+ if (!*pfname) {
73+- /* this shouldn't be possible. A VF can't exist unless its
74+- * PF device is bound to a network driver
75+- */
76++ /* The SRIOV standard does not require VF netdevs to have
77++ * the netdev assigned to a PF. */
78+ virReportError(VIR_ERR_INTERNAL_ERROR,
79+ _("The PF device for VF %s has no network device name"),
80+ ifname);
81+@@ -3178,8 +3177,12 @@ virNetDevSwitchdevFeature(const char *ifname,
82+ if ((is_vf = virNetDevIsVirtualFunction(ifname)) < 0)
83+ return ret;
84+
85+- if (is_vf == 1 && virNetDevGetPhysicalFunction(ifname, &pfname) < 0)
86+- goto cleanup;
87++ if (is_vf == 1) {
88++ /* Ignore error if PF does not have netdev assigned.
89++ * In that case pfname == NULL. */
90++ if (virNetDevGetPhysicalFunction(ifname, &pfname) < 0)
91++ virResetLastError();
92++ }
93+
94+ pci_device_ptr = pfname ? virNetDevGetPCIDevice(pfname) :
95+ virNetDevGetPCIDevice(ifname);
96+--
97+2.17.1
98+
99diff --git a/debian/patches/ubuntu/lp-1771662-2-util-Code-simplification.patch b/debian/patches/ubuntu/lp-1771662-2-util-Code-simplification.patch
100new file mode 100644
101index 0000000..bcb8a6f
102--- /dev/null
103+++ b/debian/patches/ubuntu/lp-1771662-2-util-Code-simplification.patch
104@@ -0,0 +1,104 @@
105+From 10bca495e040ef834760a244a31f8b87391c2378 Mon Sep 17 00:00:00 2001
106+From: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
107+Date: Tue, 22 Jan 2019 12:26:13 -0700
108+Subject: [PATCH 2/4] util: Code simplification
109+
110+Removing redundant sections of the code
111+
112+Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
113+Signed-off-by: dann frazier <dann.frazier@canonical.com>
114+Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
115+
116+Origin: upstream, https://libvirt.org/git/?p=libvirt.git;a=commit;h=10bca495e040ef834760a244a31f8b87391c2378
117+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1771662
118+Last-Update: 2019-01-31
119+
120+---
121+ src/util/virnetdev.c | 33 ++++++---------------------------
122+ 1 file changed, 6 insertions(+), 27 deletions(-)
123+
124+diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
125+index d3e69b6f60..92ef008ca1 100644
126+--- a/src/util/virnetdev.c
127++++ b/src/util/virnetdev.c
128+@@ -1443,29 +1443,20 @@ int
129+ virNetDevGetVirtualFunctionInfo(const char *vfname, char **pfname,
130+ int *vf)
131+ {
132+- char *pf_sysfs_path = NULL, *vf_sysfs_path = NULL;
133+ int ret = -1;
134+
135+ *pfname = NULL;
136+
137+ if (virNetDevGetPhysicalFunction(vfname, pfname) < 0)
138+- return ret;
139+-
140+- if (virNetDevSysfsFile(&pf_sysfs_path, *pfname, "device") < 0)
141+- goto cleanup;
142++ return -1;
143+
144+- if (virNetDevSysfsFile(&vf_sysfs_path, vfname, "device") < 0)
145++ if (virNetDevGetVirtualFunctionIndex(*pfname, vfname, vf) < 0)
146+ goto cleanup;
147+
148+- ret = virPCIGetVirtualFunctionIndex(pf_sysfs_path, vf_sysfs_path, vf);
149+-
150++ ret = 0;
151+ cleanup:
152+ if (ret < 0)
153+ VIR_FREE(*pfname);
154+-
155+- VIR_FREE(vf_sysfs_path);
156+- VIR_FREE(pf_sysfs_path);
157+-
158+ return ret;
159+ }
160+
161+@@ -1861,13 +1852,9 @@ virNetDevSaveNetConfig(const char *linkdev, int vf,
162+ * it to PF + VFname
163+ */
164+
165+- if (virNetDevGetPhysicalFunction(linkdev, &pfDevOrig) < 0)
166++ if (virNetDevGetVirtualFunctionInfo(linkdev, &pfDevOrig, &vf) < 0)
167+ goto cleanup;
168+-
169+ pfDevName = pfDevOrig;
170+-
171+- if (virNetDevGetVirtualFunctionIndex(pfDevName, linkdev, &vf) < 0)
172+- goto cleanup;
173+ }
174+
175+ if (pfDevName) {
176+@@ -2019,13 +2006,9 @@ virNetDevReadNetConfig(const char *linkdev, int vf,
177+ * it to PF + VFname
178+ */
179+
180+- if (virNetDevGetPhysicalFunction(linkdev, &pfDevOrig) < 0)
181++ if (virNetDevGetVirtualFunctionInfo(linkdev, &pfDevOrig, &vf) < 0)
182+ goto cleanup;
183+-
184+ pfDevName = pfDevOrig;
185+-
186+- if (virNetDevGetVirtualFunctionIndex(pfDevName, linkdev, &vf) < 0)
187+- goto cleanup;
188+ }
189+
190+ /* if there is a PF, it's now in pfDevName, and linkdev is either
191+@@ -2224,13 +2207,9 @@ virNetDevSetNetConfig(const char *linkdev, int vf,
192+ * it to PF + VFname
193+ */
194+
195+- if (virNetDevGetPhysicalFunction(linkdev, &pfDevOrig) < 0)
196++ if (virNetDevGetVirtualFunctionInfo(linkdev, &pfDevOrig, &vf))
197+ goto cleanup;
198+-
199+ pfDevName = pfDevOrig;
200+-
201+- if (virNetDevGetVirtualFunctionIndex(pfDevName, linkdev, &vf) < 0)
202+- goto cleanup;
203+ }
204+
205+
206+--
207+2.17.1
208+
209diff --git a/debian/patches/ubuntu/lp-1771662-3-util-Fix-for-NULL-dereference.patch b/debian/patches/ubuntu/lp-1771662-3-util-Fix-for-NULL-dereference.patch
210new file mode 100644
211index 0000000..4a8cd91
212--- /dev/null
213+++ b/debian/patches/ubuntu/lp-1771662-3-util-Fix-for-NULL-dereference.patch
214@@ -0,0 +1,74 @@
215+From 8fac64db5e7941efb820626f0043f5e0a31c79ee Mon Sep 17 00:00:00 2001
216+From: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
217+Date: Tue, 22 Jan 2019 12:26:14 -0700
218+Subject: [PATCH 3/4] util: Fix for NULL dereference
219+
220+The device xml parser code does not set "model" while parsing the
221+following XML:
222+
223+ <interface type='hostdev'>
224+ <source>
225+ <address type='pci' domain='0x0002' bus='0x01' slot='0x00' function='0x2'/>
226+ </source>
227+ </interface>
228+
229+The net->model can be NULL and therefore must be compared using
230+STREQ_NULLABLE instead of plain STREQ.
231+
232+Fixes: ac47e4a6225 (qemu: replace "def->nets[i]" with "net" and "def->sounds[i]" with "sound")
233+Fixes: c7fc151eec7 (qemu: assign virtio devices to PCIe slot when appropriate)
234+Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
235+Signed-off-by: dann frazier <dann.frazier@canonical.com>
236+Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
237+
238+Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
239+Original-Author: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
240+Origin: backport, https://libvirt.org/git/?p=libvirt.git;a=commit;h=8fac64db5e7941efb820626f0043f5e0a31c79ee
241+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1771662
242+Last-Update: 2019-01-31
243+
244+---
245+ src/qemu/qemu_domain_address.c | 13 +++++--------
246+ 1 file changed, 5 insertions(+), 8 deletions(-)
247+
248+--- a/src/qemu/qemu_domain_address.c
249++++ b/src/qemu/qemu_domain_address.c
250+@@ -232,10 +232,8 @@ qemuDomainAssignSpaprVIOAddresses(virDom
251+ for (i = 0; i < def->nnets; i++) {
252+ virDomainNetDefPtr net = def->nets[i];
253+
254+- if (net->model &&
255+- STREQ(net->model, "spapr-vlan")) {
256++ if (STREQ_NULLABLE(net->model, "spapr-vlan"))
257+ net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
258+- }
259+
260+ if (qemuDomainAssignSpaprVIOAddress(def, &net->info, VIO_ADDR_NET) < 0)
261+ goto cleanup;
262+@@ -323,7 +321,7 @@ qemuDomainPrimeVirtioDeviceAddresses(vir
263+ for (i = 0; i < def->nnets; i++) {
264+ virDomainNetDefPtr net = def->nets[i];
265+
266+- if (STREQ(net->model, "virtio") &&
267++ if (STREQ_NULLABLE(net->model, "virtio") &&
268+ net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
269+ net->info.type = type;
270+ }
271+@@ -604,14 +602,14 @@ qemuDomainDeviceCalculatePCIConnectFlags
272+ * addresses for other hostdev devices.
273+ */
274+ if (net->type == VIR_DOMAIN_NET_TYPE_HOSTDEV ||
275+- STREQ(net->model, "usb-net")) {
276++ STREQ_NULLABLE(net->model, "usb-net")) {
277+ return 0;
278+ }
279+
280+- if (STREQ(net->model, "virtio"))
281++ if (STREQ_NULLABLE(net->model, "virtio"))
282+ return virtioFlags;
283+
284+- if (STREQ(net->model, "e1000e"))
285++ if (STREQ_NULLABLE(net->model, "e1000e"))
286+ return pcieFlags;
287+
288+ return pciFlags;
289diff --git a/debian/patches/ubuntu/lp-1771662-4-util-Fixing-invalid-error-checking-from-virPCIGetNet.patch b/debian/patches/ubuntu/lp-1771662-4-util-Fixing-invalid-error-checking-from-virPCIGetNet.patch
290new file mode 100644
291index 0000000..b4559f0
292--- /dev/null
293+++ b/debian/patches/ubuntu/lp-1771662-4-util-Fixing-invalid-error-checking-from-virPCIGetNet.patch
294@@ -0,0 +1,35 @@
295+From 04983c3c6a821f67994b1c65d4d6175f3ac49d69 Mon Sep 17 00:00:00 2001
296+From: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
297+Date: Tue, 22 Jan 2019 12:26:15 -0700
298+Subject: [PATCH 4/4] util: Fixing invalid error checking from
299+ virPCIGetNetname()
300+
301+The @linkdev is In/Out function parameter as second order
302+reference pointer so requires first order dereference for
303+checking NULL which can be the result of virPCIGetNetName().
304+
305+Fixes: d6ee56d7237 (util: change virPCIGetNetName() to not return error if device has no net name)
306+Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
307+Signed-off-by: dann frazier <dann.frazier@canonical.com>
308+
309+Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
310+Original-Author: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
311+Origin: backport, https://libvirt.org/git/?p=libvirt.git;a=commit;h=04983c3c6a821f67994b1c65d4d6175f3ac49d69
312+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1771662
313+Last-Update: 2019-01-31
314+
315+---
316+ src/util/virhostdev.c | 2 +-
317+ 1 file changed, 1 insertion(+), 1 deletion(-)
318+
319+--- a/src/util/virhostdev.c
320++++ b/src/util/virhostdev.c
321+@@ -332,7 +332,7 @@ virHostdevNetDevice(virDomainHostdevDefP
322+ if (virPCIGetNetName(sysfs_path, 0, NULL, linkdev) < 0)
323+ goto cleanup;
324+
325+- if (!linkdev) {
326++ if (!(*linkdev)) {
327+ virReportError(VIR_ERR_INTERNAL_ERROR,
328+ _("The device at %s has no network device name"),
329+ sysfs_path);
330diff --git a/debian/patches/ubuntu/lp-1811198-utils-Remove-arbitrary-limit-on-socket_id-core_id.patch b/debian/patches/ubuntu/lp-1811198-utils-Remove-arbitrary-limit-on-socket_id-core_id.patch
331new file mode 100644
332index 0000000..81ae0fd
333--- /dev/null
334+++ b/debian/patches/ubuntu/lp-1811198-utils-Remove-arbitrary-limit-on-socket_id-core_id.patch
335@@ -0,0 +1,91 @@
336+From ba35ac2ebbc7f94abc50ffbf1d681458e2406444 Mon Sep 17 00:00:00 2001
337+From: Andrea Bolognani <abologna@redhat.com>
338+Date: Fri, 3 Aug 2018 10:15:16 +0200
339+Subject: [PATCH] utils: Remove arbitrary limit on socket_id/core_id
340+
341+While in most cases the values are going to be much
342+smaller than our arbitrary 4096 limit, there is really
343+no guarantee that would be the case: in fact, a few
344+aarch64 servers have been spotted in the wild with
345+core_id as high as 6216.
346+
347+Take advantage of virBitmap's ability to automatically
348+alter its size at runtime to accomodate such values.
349+
350+Signed-off-by: Andrea Bolognani <abologna@redhat.com>
351+
352+Origin: upstream, https://libvirt.org/git/?p=libvirt.git;a=commit;h=ba35ac2ebbc7f94abc50ffbf1d681458e2406444
353+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1811198
354+Last-Update: 2019-01-31
355+
356+---
357+ src/util/virhostcpu.c | 23 ++++-------------------
358+ 1 file changed, 4 insertions(+), 19 deletions(-)
359+
360+diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
361+index 6e79445abc..2337ad7d61 100644
362+--- a/src/util/virhostcpu.c
363++++ b/src/util/virhostcpu.c
364+@@ -293,9 +293,6 @@ virHostCPUParseNode(const char *node,
365+ int *threads,
366+ int *offline)
367+ {
368+- /* Biggest value we can expect to be used as either socket id
369+- * or core id. Bitmaps will need to be sized accordingly */
370+- const int ID_MAX = 4095;
371+ int ret = -1;
372+ int processors = 0;
373+ DIR *cpudir = NULL;
374+@@ -324,7 +321,7 @@ virHostCPUParseNode(const char *node,
375+ goto cleanup;
376+
377+ /* enumerate sockets in the node */
378+- if (!(sockets_map = virBitmapNew(ID_MAX + 1)))
379++ if (!(sockets_map = virBitmapNewEmpty()))
380+ goto cleanup;
381+
382+ while ((direrr = virDirRead(cpudir, &cpudirent, node)) > 0) {
383+@@ -343,14 +340,8 @@ virHostCPUParseNode(const char *node,
384+
385+ if (virHostCPUGetSocket(cpu, &sock) < 0)
386+ goto cleanup;
387+- if (sock > ID_MAX) {
388+- virReportError(VIR_ERR_INTERNAL_ERROR,
389+- _("Socket %d can't be handled (max socket is %d)"),
390+- sock, ID_MAX);
391+- goto cleanup;
392+- }
393+
394+- if (virBitmapSetBit(sockets_map, sock) < 0)
395++ if (virBitmapSetBitExpand(sockets_map, sock) < 0)
396+ goto cleanup;
397+
398+ if (sock > sock_max)
399+@@ -367,7 +358,7 @@ virHostCPUParseNode(const char *node,
400+ goto cleanup;
401+
402+ for (i = 0; i < sock_max; i++)
403+- if (!(cores_maps[i] = virBitmapNew(ID_MAX + 1)))
404++ if (!(cores_maps[i] = virBitmapNewEmpty()))
405+ goto cleanup;
406+
407+ /* Iterate over all CPUs in the node, in ascending order */
408+@@ -411,14 +402,8 @@ virHostCPUParseNode(const char *node,
409+ if (virHostCPUGetCore(cpu, &core) < 0)
410+ goto cleanup;
411+ }
412+- if (core > ID_MAX) {
413+- virReportError(VIR_ERR_INTERNAL_ERROR,
414+- _("Core %d can't be handled (max core is %d)"),
415+- core, ID_MAX);
416+- goto cleanup;
417+- }
418+
419+- if (virBitmapSetBit(cores_maps[sock], core) < 0)
420++ if (virBitmapSetBitExpand(cores_maps[sock], core) < 0)
421+ goto cleanup;
422+
423+ if (!(siblings = virHostCPUCountThreadSiblings(cpu)))
424+--
425+2.17.1
426+

Subscribers

People subscribed via source and target branches