OSDN Git Service

monitor: separate QMP parser and dispatcher
authorPeter Xu <peterx@redhat.com>
Fri, 9 Mar 2018 08:59:57 +0000 (16:59 +0800)
committerEric Blake <eblake@redhat.com>
Mon, 19 Mar 2018 19:58:37 +0000 (14:58 -0500)
commit71da4667db6568220619e5dc21f1e7b4b379076e
tree59651635cdac70fe4153c15ac8b2f60307c177b7
parente3e977d45b0750d7e4b8f9cac4b89e8082235188
monitor: separate QMP parser and dispatcher

Originally QMP goes through these steps:

  JSON Parser --> QMP Dispatcher --> Respond
      /|\    (2)                (3)     |
   (1) |                               \|/ (4)
       +---------  main thread  --------+

This patch does this:

  JSON Parser     QMP Dispatcher --> Respond
      /|\ |           /|\       (4)     |
       |  | (2)        | (3)            |  (5)
   (1) |  +----->      |               \|/
       +---------  main thread  <-------+

So the parsing job and the dispatching job is isolated now.  It gives us
a chance in follow up patches to totally move the parser outside.

The isolation is done using one QEMUBH. Only one dispatcher QEMUBH is
used for all the monitors.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20180309090006.10018-15-peterx@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: grammar tweaks, rebase to qobject_to()]
Signed-off-by: Eric Blake <eblake@redhat.com>
monitor.c