qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v3 05/38] monitor: further simplify previous patch


From: Marc-André Lureau
Subject: [Qemu-devel] [PATCH v3 05/38] monitor: further simplify previous patch
Date: Mon, 26 Mar 2018 17:08:43 +0200

Move the resume code to the non-oob path. This patch could eventually
be squashed with the previous patch.

Signed-off-by: Marc-André Lureau <address@hidden>
---
 monitor.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/monitor.c b/monitor.c
index 2428c7fcd4..a8dcfa283e 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3957,16 +3957,14 @@ typedef struct QMPRequest QMPRequest;
  * Dispatch one single QMP request. The function will free the req_obj
  * and objects inside it before return.
  */
-static void monitor_qmp_dispatch_one(QMPRequest *req_obj, bool oob_cmd)
+static void monitor_qmp_dispatch_one(QMPRequest *req_obj)
 {
     Monitor *mon, *old_mon;
     QObject *req, *rsp = NULL, *id;
-    bool need_resume;
 
     req = req_obj->req;
     mon = req_obj->mon;
     id = req_obj->id;
-    need_resume = !oob_cmd && !qmp_oob_enabled(mon);
 
     g_free(req_obj);
 
@@ -3986,11 +3984,6 @@ static void monitor_qmp_dispatch_one(QMPRequest 
*req_obj, bool oob_cmd)
     /* Respond if necessary */
     monitor_qmp_respond(mon, rsp, NULL, id);
 
-    /* This pairs with the monitor_suspend() in handle_qmp_command(). */
-    if (need_resume) {
-        monitor_resume(mon);
-    }
-
     qobject_decref(req);
 }
 
@@ -4036,8 +4029,14 @@ static void monitor_qmp_bh_dispatcher(void *data)
     QMPRequest *req_obj = monitor_qmp_requests_pop_one();
 
     if (req_obj) {
+        Monitor *mon = req_obj->mon;
+        bool need_resume = !qmp_oob_enabled(mon);
         trace_monitor_qmp_cmd_in_band(qobject_get_try_str(req_obj->id) ?: "");
-        monitor_qmp_dispatch_one(req_obj, false);
+        monitor_qmp_dispatch_one(req_obj);
+        /* This pairs with the monitor_suspend() in handle_qmp_command(). */
+        if (need_resume) {
+            monitor_resume(mon);
+        }
         /* Reschedule instead of looping so the main loop stays responsive */
         qemu_bh_schedule(mon_global.qmp_dispatcher_bh);
     }
@@ -4095,7 +4094,7 @@ static void handle_qmp_command(JSONMessageParser *parser, 
GQueue *tokens)
         /* Out-Of-Band (OOB) requests are executed directly in parser. */
         trace_monitor_qmp_cmd_out_of_band(qobject_get_try_str(req_obj->id)
                                           ?: "");
-        monitor_qmp_dispatch_one(req_obj, true);
+        monitor_qmp_dispatch_one(req_obj);
         return;
     }
 
-- 
2.17.0.rc1.1.g4c4f2b46a3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]