qemu-patch-raspberry4/qapi
Peter Xu 9ab84470ff monitor: Suspend monitor instead dropping commands
When a QMP client sends in-band commands more quickly that we can
process them, we can either queue them without limit (QUEUE), drop
commands when the queue is full (DROP), or suspend receiving commands
when the queue is full (SUSPEND).  None of them is ideal:

* QUEUE lets a misbehaving client make QEMU eat memory without bounds.
Not such a hot idea.

* With DROP, the client has to cope with dropped in-band commands.  To
inform the client, we send a COMMAND_DROPPED event then.  The event is
flawed by design in two ways: it's ambiguous (see commit d621cfe0a1),
and it brings back the "eat memory without bounds" problem.

* With SUSPEND, the client has to manage the flow of in-band commands to
keep the monitor available for out-of-band commands.

We currently DROP.  Switch to SUSPEND.

Managing the flow of in-band commands to keep the monitor available for
out-of-band commands isn't really hard: just count the number of
"outstanding" in-band commands (commands sent minus replies received),
and if it exceeds the limit, hold back additional ones until it drops
below the limit again.

Note that we need to be careful pairing the suspend with a resume, or
else the monitor will hang, possibly forever.  And here since we need to
make sure both:

     (1) popping request from the req queue, and
     (2) reading length of the req queue

will be in the same critical section, we let the pop function take the
corresponding queue lock when there is a request, then we release the
lock from the caller.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20181009062718.1914-2-peterx@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-12-12 09:55:57 +01:00
..
block-core.json block: Add auto-read-only option 2018-11-05 15:09:55 +01:00
block.json pr-manager-helper: report event on connection/disconnection 2018-06-28 19:05:35 +02:00
char.json chardev: Add websocket support 2018-11-01 12:12:58 +04:00
common.json Record history of ppcemb target in common.json 2018-09-25 11:12:22 +10:00
crypto.json qapi: remove empty flat union branches and types 2018-06-22 16:33:46 +02:00
introspect.json json: Update references to RFC 7159 to RFC 8259 2018-08-24 20:27:14 +02:00
job.json qapi/job: The next release will be 3.0 2018-06-29 14:20:56 +02:00
Makefile.objs qapi: rename *qmp-*-visitor* to *qobject-*-visitor* 2016-10-25 16:25:48 +02:00
migration.json qapi: Fix COLOStatus and query-colo-status since version 2018-10-31 09:38:59 +00:00
misc.json monitor: Suspend monitor instead dropping commands 2018-12-12 09:55:57 +01:00
net.json slirp: Implement RFC2132 TFTP server name 2018-10-21 21:24:55 +02:00
opts-visitor.c qapi: Fix QemuOpts visitor regression on unvisited input 2017-03-22 19:24:34 +01:00
qapi-clone-visitor.c qapi/qnull: Add own header 2017-11-17 18:21:30 +01:00
qapi-dealloc-visitor.c qobject: Replace qobject_incref/QINCREF qobject_decref/QDECREF 2018-05-04 08:27:53 +02:00
qapi-schema.json job: Introduce qapi/job.json 2018-05-23 14:30:51 +02:00
qapi-util.c qapi: Change data type of the FOO_lookup generated for enum FOO 2017-09-04 13:09:13 +02:00
qapi-visit-core.c Include qapi/qmp/qobject.h exactly where needed 2018-02-09 13:52:15 +01:00
qmp-dispatch.c qmp: constify qmp_is_oob() 2018-08-30 16:08:47 +02:00
qmp-event.c qmp: Switch timestamp_put() to qdict_from_jsonf_nofail() 2018-07-03 23:18:56 +02:00
qmp-registry.c qapi: Support multiple command registries per program 2017-03-05 09:12:25 +01:00
qobject-input-visitor.c qjson: Have qobject_from_json() & friends reject empty and blank 2018-08-24 20:26:37 +02:00
qobject-output-visitor.c qobject: Modify qobject_ref() to return obj 2018-05-04 08:27:53 +02:00
rocker.json qapi: The #optional tag is redundant, drop 2017-03-16 07:13:02 +01:00
run-state.json qapi: introduce new cmd option "allow-preconfig" 2018-05-30 13:19:09 -03:00
sockets.json sockets: allow SocketAddress 'fd' to reference numeric file descriptors 2018-03-13 18:06:06 +00:00
string-input-visitor.c qapi/qnull: Add own header 2017-11-17 18:21:30 +01:00
string-output-visitor.c qapi: Use QNull for a more regular visit_type_null() 2017-07-24 13:35:11 +02:00
tpm.json tpm: add CRB device 2018-01-29 14:22:50 -05:00
trace-events trace: forbid floating point types 2018-06-27 11:09:29 +01:00
trace.json qapi-schema: Improve section headings 2017-09-04 13:09:12 +02:00
transaction.json qapi: add transaction support for x-block-dirty-bitmap-merge 2018-10-29 16:23:15 -04:00
ui.json qapi: add query-display-options command 2018-11-27 07:47:57 +01:00