From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 qemu 2/4] cherry-pick upstream fixes for 7.1.0
Date: Fri, 14 Oct 2022 14:07:14 +0200 [thread overview]
Message-ID: <20221014120716.111804-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20221014120716.111804-1-f.ebner@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
...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 <faithilikerun@gmail.com>
+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 <faithilikerun@gmail.com>
+---
+ 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 <liburing.h>
+ #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 <liburing.h>', 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 <okada.yusuke@jp.fujitsu.com>
+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 <okada.yusuke@jp.fujitsu.com>
+Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
+Message-id: 20220818184618.2205172-1-yokada.996@gmail.com
+Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
+(cherry-picked from commit f16d15c9276bd8f501f861c39cbd4adc812d0c1d)
+Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
+---
+ 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 <davydov-max@yandex-team.ru>
+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 <davydov-max@yandex-team.ru>
+Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
+Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
+Message-Id: <20220825165247.33704-1-davydov-max@yandex-team.ru>
+(trivial backport from fc0c128531ed55f058bfbad4f1348ebd9a0187f2)
+Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
+---
+ 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
next prev parent reply other threads:[~2022-10-14 12:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-14 12:07 [pve-devel] [PATCH v2 qemu 1/4] update submodule and patches to 7.1.0 Fiona Ebner
2022-10-14 12:07 ` Fiona Ebner [this message]
2022-10-14 12:07 ` [pve-devel] [PATCH v2 qemu 3/4] savevm async: cleaner initialization of target_close_wait member Fiona Ebner
2022-10-14 12:07 ` [pve-devel] [PATCH v2 qemu 4/4] {alloc track, pbs} block driver: bdrv_co_preadv: adapt return values Fiona Ebner
2022-10-14 13:41 ` [pve-devel] applied-series: [PATCH v2 qemu 1/4] update submodule and patches to 7.1.0 Wolfgang Bumiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221014120716.111804-2-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal