]> git.proxmox.com Git - pve-qemu.git/blame - debian/patches/extra/0002-block-io_uring-revert-Use-io_uring_register_ring_fd-.patch
cherry-pick upstream fixes for 7.1.0
[pve-qemu.git] / debian / patches / extra / 0002-block-io_uring-revert-Use-io_uring_register_ring_fd-.patch
CommitLineData
73912aee
FE
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Sam Li <faithilikerun@gmail.com>
3Date: Sat, 24 Sep 2022 22:48:15 +0800
4Subject: [PATCH] block/io_uring: revert "Use io_uring_register_ring_fd() to
5 skip fd operations"
6
7Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1193
8
9The commit "Use io_uring_register_ring_fd() to skip fd operations" broke
10when booting a guest with iothread and io_uring. That is because the
11io_uring_register_ring_fd() call is made from the main thread instead of
12IOThread where io_uring_submit() is called. It can not be guaranteed
13to register the ring fd in the correct thread or unregister the same ring
14fd if the IOThread is disabled. This optimization is not critical so we
15will revert previous commit.
16
17This reverts commit e2848bc574fe2715c694bf8fe9a1ba7f78a1125a
18and 77e3f038af1764983087e3551a0fde9951952c4d.
19
20Signed-off-by: Sam Li <faithilikerun@gmail.com>
21---
22 block/io_uring.c | 13 +------------
23 meson.build | 1 -
24 2 files changed, 1 insertion(+), 13 deletions(-)
25
26diff --git a/block/io_uring.c b/block/io_uring.c
27index a1760152e0..973e15d876 100644
28--- a/block/io_uring.c
29+++ b/block/io_uring.c
30@@ -11,7 +11,6 @@
31 #include "qemu/osdep.h"
32 #include <liburing.h>
33 #include "block/aio.h"
34-#include "qemu/error-report.h"
35 #include "qemu/queue.h"
36 #include "block/block.h"
37 #include "block/raw-aio.h"
38@@ -19,7 +18,6 @@
39 #include "qapi/error.h"
40 #include "trace.h"
41
42-
43 /* io_uring ring size */
44 #define MAX_ENTRIES 128
45
46@@ -432,17 +430,8 @@ LuringState *luring_init(Error **errp)
47 }
48
49 ioq_init(&s->io_q);
50-#ifdef CONFIG_LIBURING_REGISTER_RING_FD
51- if (io_uring_register_ring_fd(&s->ring) < 0) {
52- /*
53- * Only warn about this error: we will fallback to the non-optimized
54- * io_uring operations.
55- */
56- warn_report("failed to register linux io_uring ring file descriptor");
57- }
58-#endif
59-
60 return s;
61+
62 }
63
64 void luring_cleanup(LuringState *s)
65diff --git a/meson.build b/meson.build
66index 20fddbd707..d5230eadd6 100644
67--- a/meson.build
68+++ b/meson.build
69@@ -1793,7 +1793,6 @@ config_host_data.set('CONFIG_LIBNFS', libnfs.found())
70 config_host_data.set('CONFIG_LIBSSH', libssh.found())
71 config_host_data.set('CONFIG_LINUX_AIO', libaio.found())
72 config_host_data.set('CONFIG_LINUX_IO_URING', linux_io_uring.found())
73-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))
74 config_host_data.set('CONFIG_LIBPMEM', libpmem.found())
75 config_host_data.set('CONFIG_NUMA', numa.found())
76 config_host_data.set('CONFIG_OPENGL', opengl.found())