Merge ~paelzer/ubuntu/+source/qemu:bug-1841066-fix-arch_cap-detection into ubuntu/+source/qemu:ubuntu/eoan-devel

Proposed by Christian Ehrhardt 
Status: Merged
Approved by: Christian Ehrhardt 
Approved revision: 8e32cd4613c190ef332ecfc785c1546b0a93600d
Merged at revision: 8e32cd4613c190ef332ecfc785c1546b0a93600d
Proposed branch: ~paelzer/ubuntu/+source/qemu:bug-1841066-fix-arch_cap-detection
Merge into: ubuntu/+source/qemu:ubuntu/eoan-devel
Diff against target: 184 lines (+156/-0)
4 files modified
debian/changelog (+7/-0)
debian/patches/series (+2/-0)
debian/patches/ubuntu/lp-1841066-i386-unavailable-features-QOM-property.patch (+64/-0)
debian/patches/ubuntu/lp-1841066-i386-x86_cpu_list_feature_names-function.patch (+83/-0)
Reviewer Review Type Date Requested Status
Christian Ehrhardt  (community) Approve
Rafael David Tinoco (community) Approve
Canonical Server Pending
Canonical Server packageset reviewers Pending
Review via email: mp+371796@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

A PPA with the fix can be found at [1].

With it libvirt (as it is in Eoan) can properly detect those features:

$ virsh domcapabilities | grep -e rdctl-no -e ibrs-all -e skip-l1dfl-vmentry -e mds-no
      <feature policy='require' name='rdctl-no'/>
      <feature policy='require' name='ibrs-all'/>
      <feature policy='require' name='skip-l1dfl-vmentry'/>
      <feature policy='require' name='mds-no'/>

[1]: https://launchpad.net/~paelzer/+archive/ubuntu/experimental-eoan-archcap-detection

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Code looks good, upstream code is the same, will test in AMD (from PPA). For now, gcc-9 from -proposed seems to brake build as we've spoken.

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

/home/inaddy/work/sources/ubuntu/qemu/hw/display/qxl.c:50:19: error: taking address of packed member of ‘struct QXLReleaseRing_ring_el’ may result in an unaligned pointer value [-Werror=address-of-packed-member]

likely related to previous warnings being treated as errors by default now.

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

In file included from /usr/include/string.h:494,
                 from /home/inaddy/work/sources/ubuntu/qemu/include/qemu/osdep.h:101,
                 from /home/inaddy/work/sources/ubuntu/qemu/util/qemu-sockets.c:18:
In function ‘strncpy’,
    inlined from ‘unix_connect_saddr.isra.0’ at /home/inaddy/work/sources/ubuntu/qemu/util/qemu-sockets.c:925:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 108 equals destination size [-Werror=stringop-truncation]
  106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) :
review: Needs Fixing
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

As we said, this is likely something in my building environment (which Ill check). I have checked PPA in an AMD machine and it works good, including nested KVM. +1 for that. Sorry for the noise!

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

Yep as the ppa re-upload with proposed enabled worked just fine.
I'll sponsor and we wills see.

review: Approve
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Christian,

revisiting this, because of previous building errors, I opened the following bug:

https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1841457

and the cause for the bug is this:

https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1841457/comments/1

I'm not quite sure why this is happening now, it did not happen before in my environment, for sure... AND, as demonstrated.. its not related to my environment, just related to existing .git directory (as it appears).

Best,
Rafael

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 a48d48f..b049e78 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+qemu (1:4.0+dfsg-0ubuntu6) eoan; urgency=medium
7+
8+ * d/p/ubuntu/lp-1841066-*: fix detection of arch_capability flags
9+ (LP: #1841066)
10+
11+ -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Mon, 26 Aug 2019 12:08:04 +0200
12+
13 qemu (1:4.0+dfsg-0ubuntu5) eoan; urgency=medium
14
15 * d/p/ubuntu/lp-1836154-*: further fixups for HW CPU model for newer
16diff --git a/debian/patches/series b/debian/patches/series
17index 06f87a5..1382ff0 100644
18--- a/debian/patches/series
19+++ b/debian/patches/series
20@@ -28,3 +28,5 @@ ubuntu/lp-1836066-s390-cpumodel-fix-description-for-the-new-vector-fac.patch
21 ubuntu/lp-1836159-fix-with-latest-kernel.patch
22 ubuntu/lp-1836154-s390x-cpumodel-remove-esort-from-the-default-model.patch
23 ubuntu/lp-1836154-s390x-cpumodel-also-change-name-of-vxbeh.patch
24+ubuntu/lp-1841066-i386-x86_cpu_list_feature_names-function.patch
25+ubuntu/lp-1841066-i386-unavailable-features-QOM-property.patch
26diff --git a/debian/patches/ubuntu/lp-1841066-i386-unavailable-features-QOM-property.patch b/debian/patches/ubuntu/lp-1841066-i386-unavailable-features-QOM-property.patch
27new file mode 100644
28index 0000000..dc73297
29--- /dev/null
30+++ b/debian/patches/ubuntu/lp-1841066-i386-unavailable-features-QOM-property.patch
31@@ -0,0 +1,64 @@
32+From 506174bf8219dc6d56d2b1f7e66e8cf39157466f Mon Sep 17 00:00:00 2001
33+From: Eduardo Habkost <ehabkost@redhat.com>
34+Date: Mon, 22 Apr 2019 20:47:42 -0300
35+Subject: [PATCH] i386: "unavailable-features" QOM property
36+
37+Add a "unavailable-features" QOM property to X86CPU objects that
38+have the same semantics of "unavailable-features" on
39+query-cpu-definitions. The new property has the same goal of
40+"filtered-features", but is generic enough to let any kind of CPU
41+feature to be listed there without relying on low level details
42+like CPUID leaves or MSR numbers.
43+
44+Message-Id: <20190422234742.15780-3-ehabkost@redhat.com>
45+Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
46+
47+Origin: upstream, https://git.qemu.org/?p=qemu.git;a=commit;h=506174bf8219dc6d56d2b1f7e66e8cf39157466f
48+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1841066
49+Last-Update: 2019-08-26
50+
51+---
52+ target/i386/cpu.c | 20 ++++++++++++++++++++
53+ 1 file changed, 20 insertions(+)
54+
55+diff --git a/target/i386/cpu.c b/target/i386/cpu.c
56+index 36589adb1f..7e5b545005 100644
57+--- a/target/i386/cpu.c
58++++ b/target/i386/cpu.c
59+@@ -3692,6 +3692,17 @@ static void x86_cpu_list_feature_names(FeatureWordArray features,
60+ }
61+ }
62+
63++static void x86_cpu_get_unavailable_features(Object *obj, Visitor *v,
64++ const char *name, void *opaque,
65++ Error **errp)
66++{
67++ X86CPU *xc = X86_CPU(obj);
68++ strList *result = NULL;
69++
70++ x86_cpu_list_feature_names(xc->filtered_features, &result);
71++ visit_type_strList(v, "unavailable-features", &result, errp);
72++}
73++
74+ /* Check for missing features that may prevent the CPU class from
75+ * running using the current machine and accelerator.
76+ */
77+@@ -5632,6 +5643,15 @@ static void x86_cpu_initfn(Object *obj)
78+ object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo",
79+ x86_cpu_get_feature_words,
80+ NULL, NULL, (void *)cpu->filtered_features, NULL);
81++ /*
82++ * The "unavailable-features" property has the same semantics as
83++ * CpuDefinitionInfo.unavailable-features on the "query-cpu-definitions"
84++ * QMP command: they list the features that would have prevented the
85++ * CPU from running if the "enforce" flag was set.
86++ */
87++ object_property_add(obj, "unavailable-features", "strList",
88++ x86_cpu_get_unavailable_features,
89++ NULL, NULL, NULL, &error_abort);
90+
91+ object_property_add(obj, "crash-information", "GuestPanicInformation",
92+ x86_cpu_get_crash_info_qom, NULL, NULL, NULL, NULL);
93+--
94+2.22.0
95+
96diff --git a/debian/patches/ubuntu/lp-1841066-i386-x86_cpu_list_feature_names-function.patch b/debian/patches/ubuntu/lp-1841066-i386-x86_cpu_list_feature_names-function.patch
97new file mode 100644
98index 0000000..4d67bc7
99--- /dev/null
100+++ b/debian/patches/ubuntu/lp-1841066-i386-x86_cpu_list_feature_names-function.patch
101@@ -0,0 +1,83 @@
102+From 5a853fc57a0860da4a55d1448a77845f97e7a9be Mon Sep 17 00:00:00 2001
103+From: Eduardo Habkost <ehabkost@redhat.com>
104+Date: Mon, 22 Apr 2019 20:47:41 -0300
105+Subject: [PATCH] i386: x86_cpu_list_feature_names() function
106+
107+Extract feature name listing code from
108+x86_cpu_class_check_missing_features(). It will be reused to
109+return information about CPU filtered features at runtime.
110+
111+Message-Id: <20190422234742.15780-2-ehabkost@redhat.com>
112+Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
113+
114+Origin: upstream, https://git.qemu.org/?p=qemu.git;a=commit;h=5a853fc57a0860da4a55d1448a77845f97e7a9be
115+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1841066
116+Last-Update: 2019-08-26
117+
118+---
119+ target/i386/cpu.c | 35 ++++++++++++++++++++++-------------
120+ 1 file changed, 22 insertions(+), 13 deletions(-)
121+
122+diff --git a/target/i386/cpu.c b/target/i386/cpu.c
123+index b21ecaac17..36589adb1f 100644
124+--- a/target/i386/cpu.c
125++++ b/target/i386/cpu.c
126+@@ -3671,6 +3671,27 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features,
127+ static void x86_cpu_expand_features(X86CPU *cpu, Error **errp);
128+ static int x86_cpu_filter_features(X86CPU *cpu);
129+
130++/* Build a list with the name of all features on a feature word array */
131++static void x86_cpu_list_feature_names(FeatureWordArray features,
132++ strList **feat_names)
133++{
134++ FeatureWord w;
135++ strList **next = feat_names;
136++
137++ for (w = 0; w < FEATURE_WORDS; w++) {
138++ uint32_t filtered = features[w];
139++ int i;
140++ for (i = 0; i < 32; i++) {
141++ if (filtered & (1UL << i)) {
142++ strList *new = g_new0(strList, 1);
143++ new->value = g_strdup(x86_cpu_feature_name(w, i));
144++ *next = new;
145++ next = &new->next;
146++ }
147++ }
148++ }
149++}
150++
151+ /* Check for missing features that may prevent the CPU class from
152+ * running using the current machine and accelerator.
153+ */
154+@@ -3678,7 +3699,6 @@ static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
155+ strList **missing_feats)
156+ {
157+ X86CPU *xc;
158+- FeatureWord w;
159+ Error *err = NULL;
160+ strList **next = missing_feats;
161+
162+@@ -3705,18 +3725,7 @@ static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
163+
164+ x86_cpu_filter_features(xc);
165+
166+- for (w = 0; w < FEATURE_WORDS; w++) {
167+- uint32_t filtered = xc->filtered_features[w];
168+- int i;
169+- for (i = 0; i < 32; i++) {
170+- if (filtered & (1UL << i)) {
171+- strList *new = g_new0(strList, 1);
172+- new->value = g_strdup(x86_cpu_feature_name(w, i));
173+- *next = new;
174+- next = &new->next;
175+- }
176+- }
177+- }
178++ x86_cpu_list_feature_names(xc->filtered_features, next);
179+
180+ object_unref(OBJECT(xc));
181+ }
182+--
183+2.22.0
184+

Subscribers

People subscribed via source and target branches