Skip to contentSkip to conversation

Misc: build fixes for Fedora 35, Ubuntu et al

PATCH In review John Snow 3 participants 9 messages Dec 7, 2021 – Dec 15, 2021

lore
Share & tools
lore

John Snow

author
#0 lore raw

v2 cover Misc: build fixes for Fedora 35, Ubuntu et al

I didn't push this through in time for 6.2, so this series just worries about the little fixes necessary for building QEMU under Fedora 35 and the latest Ubuntu distributions.

The actual container changes have been cut off of this series in favor of Dan's larger series that switches us over to using lcitool.

John Snow (2):
spice: Update QXLInterface for spice >= 0.15.0 ui/clipboard: Don't use g_autoptr just to free a variable

 include/ui/qemu-spice.h |  6 ++++++
 hw/display/qxl.c        | 14 +++++++++++++-
 ui/clipboard.c          |  3 +--
 ui/spice-display.c      | 11 +++++++++++
 4 files changed, 31 insertions(+), 3 deletions(-)
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH v2 1/2 spice: Update QXLInterface for spice >= 0.15.0

spice updated the spelling (and arguments) of "attache_worker" in 0.15.0. Update QEMU to match, preventing -Wdeprecated-declarations compilations from reporting build errors.

See also:
https://gitlab.freedesktop.org/spice/spice/-/commit/974692bda1e77af92b71ed43b022439448492cb9

---
 include/ui/qemu-spice.h |  6 ++++++
 hw/display/qxl.c        | 14 +++++++++++++-
 ui/spice-display.c      | 11 +++++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)
include/ui/qemu-spice.h +6 -0
index 71ecd6cfd1..21fe195e18 100644
@@ -40,6 +40,12 @@ int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
 #define SPICE_NEEDS_SET_MM_TIME 0
 #endif
 
+#if defined(SPICE_SERVER_VERSION) && (SPICE_SERVER_VERSION >= 0x000f00)
+#define SPICE_HAS_ATTACHED_WORKER 1
+#else
+#define SPICE_HAS_ATTACHED_WORKER 0
+#endif
+
 #else  /* CONFIG_SPICE */
 
 #include "qemu/error-report.h"
hw/display/qxl.c +13 -1
index 29c80b4289..1da6703e44 100644
@@ -517,13 +517,20 @@ static int qxl_track_command(PCIQXLDevice *qxl, struct QXLCommandExt *ext)
 
 /* spice display interface callbacks */
 
-static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker)
+static void interface_attached_worker(QXLInstance *sin)
 {
     PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl);
 
     trace_qxl_interface_attach_worker(qxl->id);
 }
 
+#if !(SPICE_HAS_ATTACHED_WORKER)
+static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker)
+{
+    interface_attached_worker(sin);
+}
+#endif
+
 static void interface_set_compression_level(QXLInstance *sin, int level)
 {
     PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl);
@@ -1131,7 +1138,12 @@ static const QXLInterface qxl_interface = {
     .base.major_version      = SPICE_INTERFACE_QXL_MAJOR,
     .base.minor_version      = SPICE_INTERFACE_QXL_MINOR,
 
+#if SPICE_HAS_ATTACHED_WORKER
+    .attached_worker         = interface_attached_worker,
+#else
     .attache_worker          = interface_attach_worker,
+#endif
+
     .set_compression_level   = interface_set_compression_level,
 #if SPICE_NEEDS_SET_MM_TIME
     .set_mm_time             = interface_set_mm_time,
ui/spice-display.c +11 -0
index f59c69882d..1a60cebb7d 100644
@@ -500,10 +500,17 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd)
 
 /* spice display interface callbacks */
 
+#if SPICE_HAS_ATTACHED_WORKER
+static void interface_attached_worker(QXLInstance *sin)
+{
+    /* nothing to do */
+}
+#else
 static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker)
 {
     /* nothing to do */
 }
+#endif
 
 static void interface_set_compression_level(QXLInstance *sin, int level)
 {
@@ -702,7 +709,11 @@ static const QXLInterface dpy_interface = {
     .base.major_version      = SPICE_INTERFACE_QXL_MAJOR,
     .base.minor_version      = SPICE_INTERFACE_QXL_MINOR,
 
+#if SPICE_HAS_ATTACHED_WORKER
+    .attached_worker         = interface_attached_worker,
+#else
     .attache_worker          = interface_attach_worker,
+#endif
     .set_compression_level   = interface_set_compression_level,
 #if SPICE_NEEDS_SET_MM_TIME
     .set_mm_time             = interface_set_mm_time,
Signature · 1 line
2.31.1
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] spice: Update QXLInterface for spice >= 0.15.0

Quoted 7 lines · John Snow

spice updated the spelling (and arguments) of "attache_worker" in 0.15.0. Update QEMU to match, preventing -Wdeprecated-declarations compilations from reporting build errors.

See also:
https://gitlab.freedesktop.org/spice/spice/-/commit/974692bda1e77af92b71ed43b022439448492cb9

Quoted 7 lines
---
 include/ui/qemu-spice.h |  6 ++++++
 hw/display/qxl.c        | 14 +++++++++++++-
 ui/spice-display.c      | 11 +++++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#3 lore raw

Re: [PATCH v2 1/2] spice: Update QXLInterface for spice >= 0.15.0

In reply to John Snow
Quoted 96 lines · John Snow

spice updated the spelling (and arguments) of "attache_worker" in 0.15.0. Update QEMU to match, preventing -Wdeprecated-declarations compilations from reporting build errors.

See also:
https://gitlab.freedesktop.org/spice/spice/-/commit/974692bda1e77af92b71ed43b022439448492cb9

---
 include/ui/qemu-spice.h |  6 ++++++
 hw/display/qxl.c        | 14 +++++++++++++-
 ui/spice-display.c      | 11 +++++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)
include/ui/qemu-spice.h +6 -0
index 71ecd6cfd1..21fe195e18 100644
@@ -40,6 +40,12 @@ int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
 #define SPICE_NEEDS_SET_MM_TIME 0
 #endif
 
+#if defined(SPICE_SERVER_VERSION) && (SPICE_SERVER_VERSION >= 0x000f00)
+#define SPICE_HAS_ATTACHED_WORKER 1
+#else
+#define SPICE_HAS_ATTACHED_WORKER 0
+#endif
+
 #else  /* CONFIG_SPICE */
 
 #include "qemu/error-report.h"
hw/display/qxl.c +13 -1
index 29c80b4289..1da6703e44 100644
@@ -517,13 +517,20 @@ static int qxl_track_command(PCIQXLDevice *qxl, struct QXLCommandExt *ext)
 
 /* spice display interface callbacks */
 
-static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker)
+static void interface_attached_worker(QXLInstance *sin)
 {
     PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl);
 
     trace_qxl_interface_attach_worker(qxl->id);
 }
 
+#if !(SPICE_HAS_ATTACHED_WORKER)
+static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker)
+{
+    interface_attached_worker(sin);
+}
+#endif
+
 static void interface_set_compression_level(QXLInstance *sin, int level)
 {
     PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl);
@@ -1131,7 +1138,12 @@ static const QXLInterface qxl_interface = {
     .base.major_version      = SPICE_INTERFACE_QXL_MAJOR,
     .base.minor_version      = SPICE_INTERFACE_QXL_MINOR,
 
+#if SPICE_HAS_ATTACHED_WORKER
+    .attached_worker         = interface_attached_worker,
+#else
     .attache_worker          = interface_attach_worker,
+#endif
+
     .set_compression_level   = interface_set_compression_level,
 #if SPICE_NEEDS_SET_MM_TIME
     .set_mm_time             = interface_set_mm_time,
ui/spice-display.c +7 -0
index f59c69882d..1a60cebb7d 100644
@@ -500,10 +500,17 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd)
 
 /* spice display interface callbacks */
 
+#if SPICE_HAS_ATTACHED_WORKER
+static void interface_attached_worker(QXLInstance *sin)
+{
+    /* nothing to do */
+}
+#else
 static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker)
 {
     /* nothing to do */
 }
+#endif
 
 static void interface_set_compression_level(QXLInstance *sin, int level)
 {
@@ -702,7 +709,11 @@ static const QXLInterface dpy_interface = {
     .base.major_version      = SPICE_INTERFACE_QXL_MAJOR,

ui/spice-display.c static const QXLInterface dpy_interface = { · line 719

Quoted 10 lines
ui/spice-display.c +4 -0
     .base.minor_version      = SPICE_INTERFACE_QXL_MINOR,
 
+#if SPICE_HAS_ATTACHED_WORKER
+    .attached_worker         = interface_attached_worker,
+#else
     .attache_worker          = interface_attach_worker,
+#endif
     .set_compression_level   = interface_set_compression_level,
 #if SPICE_NEEDS_SET_MM_TIME
     .set_mm_time             = interface_set_mm_time,

Could we get this patch directly applied as a buildfix?

author
#4 lore raw

PATCH v2 2/2 ui/clipboard: Don't use g_autoptr just to free a variable

In reply to John Snow

Clang doesn't recognize that the variable is being "used" and will emit a warning:

../ui/clipboard.c:47:34: error: variable 'old' set but not used [-Werror,-Wunused-but-set-variable]

      g_autoptr(QemuClipboardInfo) old = NULL;
                                 ^

1 error generated.

OK, fine. Just do things the old way.

---
 ui/clipboard.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
ui/clipboard.c +1 -2
index d7b008d62a..9ab65efefb 100644
@@ -44,12 +44,11 @@ void qemu_clipboard_peer_release(QemuClipboardPeer *peer,
 
 void qemu_clipboard_update(QemuClipboardInfo *info)
 {
-    g_autoptr(QemuClipboardInfo) old = NULL;
     assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT);
 
     notifier_list_notify(&clipboard_notifiers, info);
 
-    old = cbinfo[info->selection];
+    g_free(cbinfo[info->selection]);
     cbinfo[info->selection] = qemu_clipboard_info_ref(info);
 }
 
Signature · 1 line
2.31.1
Reviewed-by on v2 2/2
#5 lore raw

Re: [PATCH v2 2/2] ui/clipboard: Don't use g_autoptr just to free a variable

Quoted 6 lines · John Snow

Clang doesn't recognize that the variable is being "used" and will emit a warning:

../ui/clipboard.c:47:34: error: variable 'old' set but not used [-Werror,-Wunused-but-set-variable]

      g_autoptr(QemuClipboardInfo) old = NULL;
                                 ^
Quoted 8 lines

1 error generated.

OK, fine. Just do things the old way.

---
 ui/clipboard.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
#6 lore raw

Re: [PATCH v2 2/2] ui/clipboard: Don't use g_autoptr just to free a variable

In reply to John Snow
Quoted 20 lines · John Snow

Clang doesn't recognize that the variable is being "used" and will emit a warning:

../ui/clipboard.c:47:34: error: variable 'old' set but not used [-Werror,-Wunused-but-set-variable]

      g_autoptr(QemuClipboardInfo) old = NULL;
                                 ^

1 error generated.

OK, fine. Just do things the old way.

---
 ui/clipboard.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
ui/clipboard.c +0 -0
index d7b008d62a..9ab65efefb 100644

ui/clipboard.c void qemu_clipboard_peer_release(QemuClipboardPeer *peer, · line 51

Quoted 10 lines
ui/clipboard.c +1 -2
@@ -44,12 +44,11 @@ void qemu_clipboard_peer_release(QemuClipboardPeer *peer,
 
 void qemu_clipboard_update(QemuClipboardInfo *info)
 {
-    g_autoptr(QemuClipboardInfo) old = NULL;
     assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT);
 
     notifier_list_notify(&clipboard_notifiers, info);
 
-    old = cbinfo[info->selection];
+    g_free(cbinfo[info->selection]);

This is a ref counted data type - it can't use g_free:

https://lists.gnu.org/archive/html/qemu-devel/2021-11/msg04890.html

ui/clipboard.c void qemu_clipboard_peer_release(QemuClipboardPeer *peer, · line 53

Quoted 2 lines
ui/clipboard.c +0 -0
     cbinfo[info->selection] = qemu_clipboard_info_ref(info);
 }

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#7 lore raw

Re: [PATCH v2 2/2] ui/clipboard: Don't use g_autoptr just to free a variable

Quoted 27 lines · Daniel P. Berrangé
Quoted 26 lines · John Snow

Clang doesn't recognize that the variable is being "used" and will emit a warning:

../ui/clipboard.c:47:34: error: variable 'old' set but not used [-Werror,-Wunused-but-set-variable]

      g_autoptr(QemuClipboardInfo) old = NULL;
                                 ^

1 error generated.

OK, fine. Just do things the old way.

---
 ui/clipboard.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
ui/clipboard.c +0 -1
index d7b008d62a..9ab65efefb 100644
@@ -44,12 +44,11 @@ void qemu_clipboard_peer_release(QemuClipboardPeer *peer,
 
 void qemu_clipboard_update(QemuClipboardInfo *info)
 {
-    g_autoptr(QemuClipboardInfo) old = NULL;
     assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT);
 
Quoted 8 lines

ui/clipboard.c void qemu_clipboard_peer_release(QemuClipboardPeer *peer, · line 51

Quoted 4 lines
ui/clipboard.c +1 -1
     notifier_list_notify(&clipboard_notifiers, info);
 
-    old = cbinfo[info->selection];
+    g_free(cbinfo[info->selection]);

This is a ref counted data type - it can't use g_free:

https://lists.gnu.org/archive/html/qemu-devel/2021-11/msg04890.html

Doh, I vaguely remembered having already reviewed this then only found John's v1 and finally mis-reviewed it :/ Thanks for noticing.

author
#8 lore raw

Re: [PATCH v2 2/2] ui/clipboard: Don't use g_autoptr just to free a variable

In reply to Daniel P. Berrangé
Quoted 36 lines · Daniel P. Berrangé
Quoted 4 lines · John Snow

Clang doesn't recognize that the variable is being "used" and will emit a warning:

../ui/clipboard.c:47:34: error: variable 'old' set but not used

[-Werror,-Wunused-but-set-variable]

ui/clipboard.c void qemu_clipboard_peer_release(QemuClipboardPeer

Quoted 16 lines
      g_autoptr(QemuClipboardInfo) old = NULL;
                                 ^

1 error generated.

OK, fine. Just do things the old way.

---
 ui/clipboard.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
ui/clipboard.c +0 -0
index d7b008d62a..9ab65efefb 100644
@@ -44,12 +44,11 @@ void qemu_clipboard_peer_release(QemuClipboardPeer

*peer,

ui/clipboard.c void qemu_clipboard_peer_release(QemuClipboardPeer *peer, · line 51

Quoted 10 lines
ui/clipboard.c +1 -2
 void qemu_clipboard_update(QemuClipboardInfo *info)
 {
-    g_autoptr(QemuClipboardInfo) old = NULL;
     assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT);
 
     notifier_list_notify(&clipboard_notifiers, info);
 
-    old = cbinfo[info->selection];
+    g_free(cbinfo[info->selection]);

This is a ref counted data type - it can't use g_free:

Quoted 8 lines

https://lists.gnu.org/archive/html/qemu-devel/2021-11/msg04890.html

ui/clipboard.c void qemu_clipboard_peer_release(QemuClipboardPeer *peer, · line 53

Quoted 2 lines
ui/clipboard.c +0 -0
     cbinfo[info->selection] = qemu_clipboard_info_ref(info);
 }

Regards,
Daniel

Whoops, sorry. I saw free being used elsewhere and assumed it was safe. That's what I get for assuming things...