]> git.proxmox.com Git - pve-qemu.git/commitdiff
merge monitor oob fixup
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 2 Oct 2019 08:10:27 +0000 (10:10 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 2 Oct 2019 08:16:40 +0000 (10:16 +0200)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
debian/patches/extra/0005-monitor-qmp-resume-monitor-when-clearing-its-queue.patch [new file with mode: 0644]
debian/patches/pve/0031-PVE-monitor-disable-oob-capability.patch [deleted file]
debian/patches/series

diff --git a/debian/patches/extra/0005-monitor-qmp-resume-monitor-when-clearing-its-queue.patch b/debian/patches/extra/0005-monitor-qmp-resume-monitor-when-clearing-its-queue.patch
new file mode 100644 (file)
index 0000000..96e78be
--- /dev/null
@@ -0,0 +1,69 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Wolfgang Bumiller <w.bumiller@proxmox.com>
+Date: Wed, 2 Oct 2019 09:41:34 +0200
+Subject: [PATCH] monitor/qmp: resume monitor when clearing its queue
+
+When a monitor's queue is filled up in handle_qmp_command()
+it gets suspended. It's the dispatcher bh's job currently to
+resume the monitor, which it does after processing an even
+from the queue. However, it is possible for a
+CHR_EVENT_CLOSED event to be processed before before the bh
+is scheduled, which will clear the queue without resuming
+the monitor, thereby preventing the dispatcher from reaching
+the resume() call.
+Fix this by resuming the monitor when clearing a queue which
+was filled up.
+
+Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
+---
+ monitor.c | 21 ++++++++++++++++-----
+ 1 file changed, 16 insertions(+), 5 deletions(-)
+
+diff --git a/monitor.c b/monitor.c
+index 4807bbe811..daadbcdede 100644
+--- a/monitor.c
++++ b/monitor.c
+@@ -356,12 +356,28 @@ static void qmp_request_free(QMPRequest *req)
+     g_free(req);
+ }
++static bool qmp_oob_enabled(Monitor *mon)
++{
++    return mon->qmp.capab[QMP_CAPABILITY_OOB];
++}
++
+ /* Caller must hold mon->qmp.qmp_queue_lock */
+ static void monitor_qmp_cleanup_req_queue_locked(Monitor *mon)
+ {
++    bool need_resume =
++        (!qmp_oob_enabled(mon) && mon->qmp.qmp_requests->length > 0)
++        || mon->qmp.qmp_requests->length == QMP_REQ_QUEUE_LEN_MAX;
+     while (!g_queue_is_empty(mon->qmp.qmp_requests)) {
+         qmp_request_free(g_queue_pop_head(mon->qmp.qmp_requests));
+     }
++    if (need_resume) {
++        /*
++         * Pairs with the monitor_suspend() in handle_qmp_command() in case the
++         * queue gets cleared from a CH_EVENT_CLOSED event before the dispatch
++         * bh got scheduled.
++         */
++        monitor_resume(mon);
++    }
+ }
+ static void monitor_qmp_cleanup_queues(Monitor *mon)
+@@ -1157,11 +1173,6 @@ static void monitor_init_qmp_commands(void)
+                          qmp_marshal_qmp_capabilities, QCO_ALLOW_PRECONFIG);
+ }
+-static bool qmp_oob_enabled(Monitor *mon)
+-{
+-    return mon->qmp.capab[QMP_CAPABILITY_OOB];
+-}
+-
+ static void monitor_qmp_caps_reset(Monitor *mon)
+ {
+     memset(mon->qmp.capab_offered, 0, sizeof(mon->qmp.capab_offered));
+-- 
+2.20.1
+
diff --git a/debian/patches/pve/0031-PVE-monitor-disable-oob-capability.patch b/debian/patches/pve/0031-PVE-monitor-disable-oob-capability.patch
deleted file mode 100644 (file)
index 31d7e9e..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Wolfgang Bumiller <w.bumiller@proxmox.com>
-Date: Tue, 25 Jun 2019 11:17:58 +0200
-Subject: [PATCH] PVE: monitor: disable oob capability
-
-A bisect revealed that commit 8258292e18c3
-("monitor: Remove "x-oob", offer capability "oob" unconditionally")
-causes unexpected hangs when restoring live snapshots from some
-types of block devices (particularly RBD).
-We need to figure out what's happnening there. For now, since we
-had this disabled before and probably don't need it now either,
-disable oob, so we can get a functioning qemu out...
-
-Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
-Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
----
- monitor.c | 5 +----
- 1 file changed, 1 insertion(+), 4 deletions(-)
-
-diff --git a/monitor.c b/monitor.c
-index 4807bbe811..f8d2338667 100644
---- a/monitor.c
-+++ b/monitor.c
-@@ -4605,10 +4605,7 @@ void monitor_init(Chardev *chr, int flags)
-     bool use_readline = flags & MONITOR_USE_READLINE;
-     /* Note: we run QMP monitor in I/O thread when @chr supports that */
--    monitor_data_init(mon, false,
--                      (flags & MONITOR_USE_CONTROL)
--                      && qemu_chr_has_feature(chr,
--                                              QEMU_CHAR_FEATURE_GCONTEXT));
-+    monitor_data_init(mon, false, false);
-     qemu_chr_fe_init(&mon->chr, chr, &error_abort);
-     mon->flags = flags;
--- 
-2.20.1
-
index ce96303d93896c28c63e1078650012c52ffceb85..97916fc922c9a120f58d06be077b442b9d54ba34 100644 (file)
@@ -2,6 +2,7 @@ extra/0001-target-i386-add-MDS-NO-feature.patch
 extra/0002-target-i386-define-md-clear-bit.patch
 extra/0003-virtio-balloon-fix-QEMU-4.0-config-size-migration-in.patch
 extra/0004-Fix-heap-overflow-in-ip_reass-on-big-packet-input.patch
+extra/0005-monitor-qmp-resume-monitor-when-clearing-its-queue.patch
 pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch
 pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch
 pve/0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch
@@ -32,4 +33,3 @@ pve/0027-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch
 pve/0028-docs-recommend-use-of-md-clear-feature-on-all-Intel-.patch
 pve/0029-PVE-savevm-async-kick-AIO-wait-on-block-state-write.patch
 pve/0030-PVE-move-snapshot-cleanup-into-bottom-half.patch
-pve/0031-PVE-monitor-disable-oob-capability.patch