From nobody Sun Oct 5 19:09:40 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522161321886806.8349010837854; Tue, 27 Mar 2018 07:35:21 -0700 (PDT) Received: from localhost ([::1]:34629 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0ph3-0002cM-42 for importer@patchew.org; Tue, 27 Mar 2018 10:35:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0pcO-0007Uo-SK for qemu-devel@nongnu.org; Tue, 27 Mar 2018 10:30:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0pcN-0004zR-Ob for qemu-devel@nongnu.org; Tue, 27 Mar 2018 10:30:32 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49340 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0pcN-0004z4-EX for qemu-devel@nongnu.org; Tue, 27 Mar 2018 10:30:31 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 103914072CF5 for ; Tue, 27 Mar 2018 14:30:31 +0000 (UTC) Received: from red.redhat.com (ovpn-121-135.rdu2.redhat.com [10.10.121.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8837D76C0; Tue, 27 Mar 2018 14:30:30 +0000 (UTC) From: Eric Blake To: qemu-devel@nongnu.org Date: Tue, 27 Mar 2018 09:30:11 -0500 Message-Id: <20180327143014.1767669-12-eblake@redhat.com> In-Reply-To: <20180327143014.1767669-1-eblake@redhat.com> References: <20180327143014.1767669-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 27 Mar 2018 14:30:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 27 Mar 2018 14:30:31 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'eblake@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 11/14] monitor: new parameter "x-oob" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Dr. David Alan Gilbert" , Peter Xu , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Peter Xu Add new parameter to optionally enable Out-Of-Band for a QMP server. An example command line: ./qemu-system-x86_64 -chardev stdio,id=3Dchar0 \ -mon chardev=3Dchar0,mode=3Dcontrol,x-oob=3Don By default, Out-Of-Band is off. It is not allowed if either MUX or non-QMP is detected, since Out-Of-Band is currently only for QMP, and non-MUX chardev backends. Note that the client STILL has to request 'oob' during qmp_capabilities; in part because the x-oob command line option may disappear in the future if we decide the capabilities negotiation is sufficient. Signed-off-by: Peter Xu Message-Id: <20180326063901.27425-4-peterx@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau [eblake: enhance commit message] Tested-by: Christian Borntraeger Signed-off-by: Eric Blake --- include/monitor/monitor.h | 1 + vl.c | 5 +++++ monitor.c | 22 ++++++++++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 0cb0538a315..d6ab70cae23 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -13,6 +13,7 @@ extern Monitor *cur_mon; #define MONITOR_USE_READLINE 0x02 #define MONITOR_USE_CONTROL 0x04 #define MONITOR_USE_PRETTY 0x08 +#define MONITOR_USE_OOB 0x10 bool monitor_cur_is_qmp(void); diff --git a/vl.c b/vl.c index c81cc866079..5fd01bd5f69 100644 --- a/vl.c +++ b/vl.c @@ -2404,6 +2404,11 @@ static int mon_init_func(void *opaque, QemuOpts *opt= s, Error **errp) if (qemu_opt_get_bool(opts, "pretty", 0)) flags |=3D MONITOR_USE_PRETTY; + /* OOB is off by default */ + if (qemu_opt_get_bool(opts, "x-oob", 0)) { + flags |=3D MONITOR_USE_OOB; + } + chardev =3D qemu_opt_get(opts, "chardev"); chr =3D qemu_chr_find(chardev); if (chr =3D=3D NULL) { diff --git a/monitor.c b/monitor.c index 32d6114ac3a..51f4cf480f8 100644 --- a/monitor.c +++ b/monitor.c @@ -36,6 +36,7 @@ #include "net/slirp.h" #include "chardev/char-fe.h" #include "chardev/char-io.h" +#include "chardev/char-mux.h" #include "ui/qemu-spice.h" #include "sysemu/numa.h" #include "monitor/monitor.h" @@ -4562,12 +4563,26 @@ static void monitor_qmp_setup_handlers_bh(void *opa= que) void monitor_init(Chardev *chr, int flags) { Monitor *mon =3D g_malloc(sizeof(*mon)); + bool use_readline =3D flags & MONITOR_USE_READLINE; + bool use_oob =3D flags & MONITOR_USE_OOB; - monitor_data_init(mon, false, false); + if (use_oob) { + if (CHARDEV_IS_MUX(chr)) { + error_report("Monitor Out-Of-Band is not supported with " + "MUX typed chardev backend"); + exit(1); + } + if (use_readline) { + error_report("Monitor Out-Of-band is only supported by QMP"); + exit(1); + } + } + + monitor_data_init(mon, false, use_oob); qemu_chr_fe_init(&mon->chr, chr, &error_abort); mon->flags =3D flags; - if (flags & MONITOR_USE_READLINE) { + if (use_readline) { mon->rs =3D readline_init(monitor_readline_printf, monitor_readline_flush, mon, @@ -4663,6 +4678,9 @@ QemuOptsList qemu_mon_opts =3D { },{ .name =3D "pretty", .type =3D QEMU_OPT_BOOL, + },{ + .name =3D "x-oob", + .type =3D QEMU_OPT_BOOL, }, { /* end of list */ } }, --=20 2.14.3