diff options
author | Kevin Wolf <kwolf@redhat.com> | 2020-10-05 17:58:50 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-10-09 07:08:20 +0200 |
commit | 9ce44e2ce267caf5559904a201aa1986b0a8326b (patch) | |
tree | 7435b0a31a7b52eedfaa544c39d13e186b4175b9 /monitor/monitor-internal.h | |
parent | 04f22362f14b028c2632ce01e74e6a78c2b45e89 (diff) | |
download | qemu-9ce44e2ce267caf5559904a201aa1986b0a8326b.zip qemu-9ce44e2ce267caf5559904a201aa1986b0a8326b.tar.gz qemu-9ce44e2ce267caf5559904a201aa1986b0a8326b.tar.bz2 |
qmp: Move dispatcher to a coroutine
This moves the QMP dispatcher to a coroutine and runs all QMP command
handlers that declare 'coroutine': true in coroutine context so they
can avoid blocking the main loop while doing I/O or waiting for other
events.
For commands that are not declared safe to run in a coroutine, the
dispatcher drops out of coroutine context by calling the QMP command
handler from a bottom half.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20201005155855.256490-10-kwolf@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'monitor/monitor-internal.h')
-rw-r--r-- | monitor/monitor-internal.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index b39e03b..b55d6df 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -155,7 +155,9 @@ static inline bool monitor_is_qmp(const Monitor *mon) typedef QTAILQ_HEAD(MonitorList, Monitor) MonitorList; extern IOThread *mon_iothread; -extern QEMUBH *qmp_dispatcher_bh; +extern Coroutine *qmp_dispatcher_co; +extern bool qmp_dispatcher_co_shutdown; +extern bool qmp_dispatcher_co_busy; extern QmpCommandList qmp_commands, qmp_cap_negotiation_commands; extern QemuMutex monitor_lock; extern MonitorList mon_list; @@ -173,7 +175,7 @@ void monitor_fdsets_cleanup(void); void qmp_send_response(MonitorQMP *mon, const QDict *rsp); void monitor_data_destroy_qmp(MonitorQMP *mon); -void monitor_qmp_bh_dispatcher(void *data); +void coroutine_fn monitor_qmp_dispatcher_co(void *data); int get_monitor_def(int64_t *pval, const char *name); void help_cmd(Monitor *mon, const char *name); |