From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 3F499925D1 for ; Thu, 13 Oct 2022 14:45:01 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0E5F72F4B9 for ; Thu, 13 Oct 2022 14:44:31 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 13 Oct 2022 14:44:28 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 68224449AF for ; Thu, 13 Oct 2022 14:44:28 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Thu, 13 Oct 2022 14:44:21 +0200 Message-Id: <20221013124423.227141-2-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221013124423.227141-1-f.ebner@proxmox.com> References: <20221013124423.227141-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.348 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LOTSOFHASH 0.25 Emails with lots of hash-like gibberish KAM_NUMSUBJECT 0.5 Subject ends in numbers excluding current years SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH qemu 2/4] cherry-pick upstream fixes for 7.1.0 X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Oct 2022 12:45:01 -0000 Signed-off-by: Fiona Ebner --- ...evert-Use-io_uring_register_ring_fd-.patch | 76 +++++++++++++++++++ ...date_time_get_microsecond-to-get-sub.patch | 51 +++++++++++++ ...004-chardev-fix-segfault-in-finalize.patch | 56 ++++++++++++++ debian/patches/series | 3 + 4 files changed, 186 insertions(+) create mode 100644 debian/patches/extra/0002-block-io_uring-revert-Use-io_uring_register_ring_fd-.patch create mode 100644 debian/patches/extra/0003-virtiofsd-use-g_date_time_get_microsecond-to-get-sub.patch create mode 100644 debian/patches/extra/0004-chardev-fix-segfault-in-finalize.patch diff --git a/debian/patches/extra/0002-block-io_uring-revert-Use-io_uring_register_ring_fd-.patch b/debian/patches/extra/0002-block-io_uring-revert-Use-io_uring_register_ring_fd-.patch new file mode 100644 index 0000000..06d4b00 --- /dev/null +++ b/debian/patches/extra/0002-block-io_uring-revert-Use-io_uring_register_ring_fd-.patch @@ -0,0 +1,76 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Sam Li +Date: Sat, 24 Sep 2022 22:48:15 +0800 +Subject: [PATCH] block/io_uring: revert "Use io_uring_register_ring_fd() to + skip fd operations" + +Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1193 + +The commit "Use io_uring_register_ring_fd() to skip fd operations" broke +when booting a guest with iothread and io_uring. That is because the +io_uring_register_ring_fd() call is made from the main thread instead of +IOThread where io_uring_submit() is called. It can not be guaranteed +to register the ring fd in the correct thread or unregister the same ring +fd if the IOThread is disabled. This optimization is not critical so we +will revert previous commit. + +This reverts commit e2848bc574fe2715c694bf8fe9a1ba7f78a1125a +and 77e3f038af1764983087e3551a0fde9951952c4d. + +Signed-off-by: Sam Li +--- + block/io_uring.c | 13 +------------ + meson.build | 1 - + 2 files changed, 1 insertion(+), 13 deletions(-) + +diff --git a/block/io_uring.c b/block/io_uring.c +index a1760152e0..973e15d876 100644 +--- a/block/io_uring.c ++++ b/block/io_uring.c +@@ -11,7 +11,6 @@ + #include "qemu/osdep.h" + #include + #include "block/aio.h" +-#include "qemu/error-report.h" + #include "qemu/queue.h" + #include "block/block.h" + #include "block/raw-aio.h" +@@ -19,7 +18,6 @@ + #include "qapi/error.h" + #include "trace.h" + +- + /* io_uring ring size */ + #define MAX_ENTRIES 128 + +@@ -432,17 +430,8 @@ LuringState *luring_init(Error **errp) + } + + ioq_init(&s->io_q); +-#ifdef CONFIG_LIBURING_REGISTER_RING_FD +- if (io_uring_register_ring_fd(&s->ring) < 0) { +- /* +- * Only warn about this error: we will fallback to the non-optimized +- * io_uring operations. +- */ +- warn_report("failed to register linux io_uring ring file descriptor"); +- } +-#endif +- + return s; ++ + } + + void luring_cleanup(LuringState *s) +diff --git a/meson.build b/meson.build +index 20fddbd707..d5230eadd6 100644 +--- a/meson.build ++++ b/meson.build +@@ -1793,7 +1793,6 @@ config_host_data.set('CONFIG_LIBNFS', libnfs.found()) + config_host_data.set('CONFIG_LIBSSH', libssh.found()) + config_host_data.set('CONFIG_LINUX_AIO', libaio.found()) + config_host_data.set('CONFIG_LINUX_IO_URING', linux_io_uring.found()) +-config_host_data.set('CONFIG_LIBURING_REGISTER_RING_FD', cc.has_function('io_uring_register_ring_fd', prefix: '#include ', dependencies:linux_io_uring)) + config_host_data.set('CONFIG_LIBPMEM', libpmem.found()) + config_host_data.set('CONFIG_NUMA', numa.found()) + config_host_data.set('CONFIG_OPENGL', opengl.found()) diff --git a/debian/patches/extra/0003-virtiofsd-use-g_date_time_get_microsecond-to-get-sub.patch b/debian/patches/extra/0003-virtiofsd-use-g_date_time_get_microsecond-to-get-sub.patch new file mode 100644 index 0000000..87c73d7 --- /dev/null +++ b/debian/patches/extra/0003-virtiofsd-use-g_date_time_get_microsecond-to-get-sub.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Yusuke Okada +Date: Thu, 18 Aug 2022 14:46:19 -0400 +Subject: [PATCH] virtiofsd: use g_date_time_get_microsecond to get subsecond + +The "%f" specifier in g_date_time_format() is only available in glib +2.65.2 or later. If combined with older glib, the function returns null +and the timestamp displayed as "(null)". + +For backward compatibility, g_date_time_get_microsecond should be used +to retrieve subsecond. + +In this patch the g_date_time_format() leaves subsecond field as "%06d" +and let next snprintf to format with g_date_time_get_microsecond. + +Signed-off-by: Yusuke Okada +Reviewed-by: Dr. David Alan Gilbert +Message-id: 20220818184618.2205172-1-yokada.996@gmail.com +Signed-off-by: Stefan Hajnoczi +(cherry-picked from commit f16d15c9276bd8f501f861c39cbd4adc812d0c1d) +Signed-off-by: Fiona Ebner +--- + tools/virtiofsd/passthrough_ll.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c +index 371a7bead6..20f0f41f99 100644 +--- a/tools/virtiofsd/passthrough_ll.c ++++ b/tools/virtiofsd/passthrough_ll.c +@@ -4185,6 +4185,7 @@ static void setup_nofile_rlimit(unsigned long rlimit_nofile) + static void log_func(enum fuse_log_level level, const char *fmt, va_list ap) + { + g_autofree char *localfmt = NULL; ++ char buf[64]; + + if (current_log_level < level) { + return; +@@ -4197,9 +4198,11 @@ static void log_func(enum fuse_log_level level, const char *fmt, va_list ap) + fmt); + } else { + g_autoptr(GDateTime) now = g_date_time_new_now_utc(); +- g_autofree char *nowstr = g_date_time_format(now, "%Y-%m-%d %H:%M:%S.%f%z"); ++ g_autofree char *nowstr = g_date_time_format(now, ++ "%Y-%m-%d %H:%M:%S.%%06d%z"); ++ snprintf(buf, 64, nowstr, g_date_time_get_microsecond(now)); + localfmt = g_strdup_printf("[%s] [ID: %08ld] %s", +- nowstr, syscall(__NR_gettid), fmt); ++ buf, syscall(__NR_gettid), fmt); + } + fmt = localfmt; + } diff --git a/debian/patches/extra/0004-chardev-fix-segfault-in-finalize.patch b/debian/patches/extra/0004-chardev-fix-segfault-in-finalize.patch new file mode 100644 index 0000000..a2cb635 --- /dev/null +++ b/debian/patches/extra/0004-chardev-fix-segfault-in-finalize.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Maksim Davydov +Date: Thu, 25 Aug 2022 19:52:47 +0300 +Subject: [PATCH] chardev: fix segfault in finalize +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If finalize chardev-msmouse or chardev-wctable is called immediately after +init it cases QEMU to crash with segfault. This happens because of +QTAILQ_REMOVE in qemu_input_handler_unregister tries to dereference +NULL pointer. +For instance, this error can be reproduced via `qom-list-properties` +command. + +Signed-off-by: Maksim Davydov +Reviewed-by: Marc-André Lureau +Reviewed-by: Vladimir Sementsov-Ogievskiy +Message-Id: <20220825165247.33704-1-davydov-max@yandex-team.ru> +(trivial backport from fc0c128531ed55f058bfbad4f1348ebd9a0187f2) +Signed-off-by: Fiona Ebner +--- + chardev/msmouse.c | 4 +++- + chardev/wctablet.c | 4 +++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/chardev/msmouse.c b/chardev/msmouse.c +index eb9231dcdb..2cc1b16561 100644 +--- a/chardev/msmouse.c ++++ b/chardev/msmouse.c +@@ -146,7 +146,9 @@ static void char_msmouse_finalize(Object *obj) + { + MouseChardev *mouse = MOUSE_CHARDEV(obj); + +- qemu_input_handler_unregister(mouse->hs); ++ if (mouse->hs) { ++ qemu_input_handler_unregister(mouse->hs); ++ } + } + + static QemuInputHandler msmouse_handler = { +diff --git a/chardev/wctablet.c b/chardev/wctablet.c +index e8b292c43c..43bdf6b608 100644 +--- a/chardev/wctablet.c ++++ b/chardev/wctablet.c +@@ -319,7 +319,9 @@ static void wctablet_chr_finalize(Object *obj) + { + TabletChardev *tablet = WCTABLET_CHARDEV(obj); + +- qemu_input_handler_unregister(tablet->hs); ++ if (tablet->hs) { ++ qemu_input_handler_unregister(tablet->hs); ++ } + } + + static void wctablet_chr_open(Chardev *chr, diff --git a/debian/patches/series b/debian/patches/series index b45710f..326313b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,4 +1,7 @@ extra/0001-monitor-qmp-fix-race-with-clients-disconnecting-earl.patch +extra/0002-block-io_uring-revert-Use-io_uring_register_ring_fd-.patch +extra/0003-virtiofsd-use-g_date_time_get_microsecond-to-get-sub.patch +extra/0004-chardev-fix-segfault-in-finalize.patch bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch -- 2.30.2