From nobody Sat Apr 27 18:35:32 2024 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529480095422819.7893744177218; Wed, 20 Jun 2018 00:34:55 -0700 (PDT) Received: from localhost ([::1]:46467 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVXdb-000644-I6 for importer@patchew.org; Wed, 20 Jun 2018 03:34:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVXbk-0005JK-VR for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:32:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVXbk-0002Hb-1E for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:32:48 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:44514 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 1fVXbj-0002H4-Rp for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:32:47 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5D3F14022909; Wed, 20 Jun 2018 07:32:47 +0000 (UTC) Received: from xz-mi.nay.redhat.com (dhcp-14-142.nay.redhat.com [10.66.14.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40A741117626; Wed, 20 Jun 2018 07:32:40 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 20 Jun 2018 15:32:17 +0800 Message-Id: <20180620073223.31964-2-peterx@redhat.com> In-Reply-To: <20180620073223.31964-1-peterx@redhat.com> References: <20180620073223.31964-1-peterx@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 20 Jun 2018 07:32:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 20 Jun 2018 07:32:47 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'peterx@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] [PATCH v5 1/7] chardev: comment details for CLOSED event 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: Kevin Wolf , Peter Maydell , Thomas Huth , Fam Zheng , Eric Auger , John Snow , peterx@redhat.com, Max Reitz , Christian Borntraeger , "Dr . David Alan Gilbert" , Stefan Hajnoczi , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , 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" It was unclear before on what does the CLOSED event mean. Meanwhile we add a TODO to fix up the CLOSED event in the future when the in/out ports are different for a chardev. CC: Paolo Bonzini CC: "Marc-Andr=C3=A9 Lureau" CC: Stefan Hajnoczi CC: Markus Armbruster Reviewed-by: Stefan Hajnoczi Signed-off-by: Peter Xu --- include/chardev/char.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/chardev/char.h b/include/chardev/char.h index 04de45795e..6f0576e214 100644 --- a/include/chardev/char.h +++ b/include/chardev/char.h @@ -22,7 +22,16 @@ typedef enum { CHR_EVENT_OPENED, /* new connection established */ CHR_EVENT_MUX_IN, /* mux-focus was set to this terminal */ CHR_EVENT_MUX_OUT, /* mux-focus will move on */ - CHR_EVENT_CLOSED /* connection closed */ + CHR_EVENT_CLOSED /* connection closed. NOTE: currently this event + * is only bound to the read port of the chardev. + * Normally the read port and write port of a + * chardev should be the same, but it can be + * different, e.g., for fd chardevs, when the two + * fds are different. So when we received the + * CLOSED event it's still possible that the out + * port is still open. TODO: we should only send + * the CLOSED event when both ports are closed. + */ } QEMUChrEvent; =20 #define CHR_READ_BUF_LEN 4096 --=20 2.17.1 From nobody Sat Apr 27 18:35:32 2024 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 15294802346231023.3620377785544; Wed, 20 Jun 2018 00:37:14 -0700 (PDT) Received: from localhost ([::1]:46481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVXg1-0000HY-W8 for importer@patchew.org; Wed, 20 Jun 2018 03:37:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVXc5-0005UL-Lq for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:33:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVXc1-0002On-NW for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:33:09 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53606 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 1fVXc1-0002Og-Hn for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:33:05 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1B18D80125CE; Wed, 20 Jun 2018 07:33:05 +0000 (UTC) Received: from xz-mi.nay.redhat.com (dhcp-14-142.nay.redhat.com [10.66.14.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id F30141117622; Wed, 20 Jun 2018 07:32:47 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 20 Jun 2018 15:32:18 +0800 Message-Id: <20180620073223.31964-3-peterx@redhat.com> In-Reply-To: <20180620073223.31964-1-peterx@redhat.com> References: <20180620073223.31964-1-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 20 Jun 2018 07:33:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 20 Jun 2018 07:33:05 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'peterx@redhat.com' RCPT:'' 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] [PATCH v5 2/7] monitor: rename *_pop_one to *_pop_any 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: Kevin Wolf , Peter Maydell , Thomas Huth , Fam Zheng , Eric Auger , John Snow , peterx@redhat.com, Max Reitz , Christian Borntraeger , "Dr . David Alan Gilbert" , Stefan Hajnoczi , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The old names are confusing since both of the old functions are popping an item from multiple queues rather than a single queue. In that sense, *_pop_any() suites better than *_pop_one(). Since at it, touch up the function monitor_qmp_response_pop_any() a bit to let the callers pass in a QMPResponse struct instead of returning a struct. Change the return value to boolean to mark whether we have popped a valid response instead. Suggested-by: Markus Armbruster Reviewed-by: Markus Armbruster Signed-off-by: Peter Xu --- monitor.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/monitor.c b/monitor.c index 885e000f9b..9c89c8695c 100644 --- a/monitor.c +++ b/monitor.c @@ -541,10 +541,10 @@ struct QMPResponse { typedef struct QMPResponse QMPResponse; =20 /* - * Return one QMPResponse. The response is only valid if - * response.data is not NULL. + * Pop a QMPResponse from any monitor's response queue into @response. + * Return false if all the queues are empty; else true. */ -static QMPResponse monitor_qmp_response_pop_one(void) +static bool monitor_qmp_response_pop_any(QMPResponse *response) { Monitor *mon; QObject *data =3D NULL; @@ -555,22 +555,20 @@ static QMPResponse monitor_qmp_response_pop_one(void) data =3D g_queue_pop_head(mon->qmp.qmp_responses); qemu_mutex_unlock(&mon->qmp.qmp_queue_lock); if (data) { + response->mon =3D mon; + response->data =3D data; break; } } qemu_mutex_unlock(&monitor_lock); - return (QMPResponse) { .mon =3D mon, .data =3D data }; + return data !=3D NULL; } =20 static void monitor_qmp_bh_responder(void *opaque) { QMPResponse response; =20 - while (true) { - response =3D monitor_qmp_response_pop_one(); - if (!response.data) { - break; - } + while (monitor_qmp_response_pop_any(&response)) { monitor_json_emitter_raw(response.mon, response.data); qobject_unref(response.data); } @@ -4172,7 +4170,7 @@ static void monitor_qmp_dispatch_one(QMPRequest *req_= obj) * when we process one request on a specific monitor, we put that * monitor to the end of mon_list queue. */ -static QMPRequest *monitor_qmp_requests_pop_one(void) +static QMPRequest *monitor_qmp_requests_pop_any(void) { QMPRequest *req_obj =3D NULL; Monitor *mon; @@ -4204,7 +4202,7 @@ static QMPRequest *monitor_qmp_requests_pop_one(void) =20 static void monitor_qmp_bh_dispatcher(void *data) { - QMPRequest *req_obj =3D monitor_qmp_requests_pop_one(); + QMPRequest *req_obj =3D monitor_qmp_requests_pop_any(); =20 if (req_obj) { trace_monitor_qmp_cmd_in_band(qobject_get_try_str(req_obj->id) ?: = ""); --=20 2.17.1 From nobody Sat Apr 27 18:35:32 2024 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 152948033086975.70748111903913; Wed, 20 Jun 2018 00:38:50 -0700 (PDT) Received: from localhost ([::1]:46488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVXha-0001JE-7q for importer@patchew.org; Wed, 20 Jun 2018 03:38:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVXcM-0005dL-Ca for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:33:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVXcI-0002ck-CR for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:33:26 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57866 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 1fVXcI-0002cY-4q for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:33:22 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 45D31401EF00; Wed, 20 Jun 2018 07:33:21 +0000 (UTC) Received: from xz-mi.nay.redhat.com (dhcp-14-142.nay.redhat.com [10.66.14.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id B049F1117622; Wed, 20 Jun 2018 07:33:05 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 20 Jun 2018 15:32:19 +0800 Message-Id: <20180620073223.31964-4-peterx@redhat.com> In-Reply-To: <20180620073223.31964-1-peterx@redhat.com> References: <20180620073223.31964-1-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 20 Jun 2018 07:33:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 20 Jun 2018 07:33:21 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'peterx@redhat.com' RCPT:'' 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] [PATCH v5 3/7] monitor: flush qmp responses when CLOSED 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: Kevin Wolf , Peter Maydell , Thomas Huth , Fam Zheng , Eric Auger , John Snow , peterx@redhat.com, Max Reitz , Christian Borntraeger , "Dr . David Alan Gilbert" , Stefan Hajnoczi , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Previously we clean up the queues when we got CLOSED event. It was used to make sure we won't send leftover replies/events of a old client to a new client which makes perfect sense. However this will also drop the replies/events even if the output port of the previous chardev backend is still open, which can lead to missing of the last replies/events. Now this patch does an extra operation to flush the response queue before cleaning up. In most cases, a QMP session will be based on a bidirectional channel (a TCP port, for example, we read/write to the same socket handle), so in port and out port of the backend chardev are fundamentally the same port. In these cases, it does not really matter much on whether we'll flush the response queue since flushing will fail anyway. However there can be cases where in & out ports of the QMP monitor's backend chardev are separated. Here is an example: cat $QMP_COMMANDS | qemu -qmp stdio ... | filter_commands In this case, the backend is fd-typed, and it is connected to stdio where in port is stdin and out port is stdout. Now if we drop all the events on the response queue then filter_command process might miss some events that it might expect. The thing is that, when stdin closes, stdout might still be there alive! In practice, I encountered SHUTDOWN event missing when running test with iotest 087 with Out-Of-Band enabled. Here is one of the ways that this can happen (after "quit" command is executed and QEMU quits the main loop): 1. [main thread] QEMU queues a SHUTDOWN event into response queue. 2. "cat" terminates (to distinguish it from the animal, I quote it). 3. [monitor iothread] QEMU's monitor iothread reads EOF from stdin. 4. [monitor iothread] QEMU's monitor iothread calls the CLOSED event hook for the monitor, which will destroy the response queue of the monitor, then the SHUTDOWN event is dropped. 5. [main thread] QEMU's main thread cleans up the monitors in monitor_cleanup(). When trying to flush pending responses, it sees nothing. SHUTDOWN is lost forever. Note that before the monitor iothread was introduced, step [4]/[5] could never happen since the main loop was the only place to detect the EOF event of stdin and run the CLOSED event hooks. Now things can happen in parallel in the iothread. Without this patch, iotest 087 will have ~10% chance to miss the SHUTDOWN event and fail when with Out-Of-Band enabled (the output is manually touched up to suite line width requirement): --- /home/peterx/git/qemu/tests/qemu-iotests/087.out +++ /home/peterx/git/qemu/bin/tests/qemu-iotests/087.out.bad @@ -8,7 +8,6 @@ {"return": {}} {"error": {"class": "GenericError", "desc": "'node-name' must be specified for the root node"}} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false}} =3D=3D=3D Duplicate ID =3D=3D=3D @@ -53,7 +52,6 @@ {"return": {}} {"return": {}} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false}} This patch fixes the problem. Fixes: 6d2d563f8c ("qmp: cleanup qmp queues properly", 2018-03-27) Suggested-by: Markus Armbruster Signed-off-by: Peter Xu Reviewed-by: Markus Armbruster --- monitor.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/monitor.c b/monitor.c index 9c89c8695c..ea93db4857 100644 --- a/monitor.c +++ b/monitor.c @@ -540,6 +540,27 @@ struct QMPResponse { }; typedef struct QMPResponse QMPResponse; =20 +static QObject *monitor_qmp_response_pop_one(Monitor *mon) +{ + QObject *data; + + qemu_mutex_lock(&mon->qmp.qmp_queue_lock); + data =3D g_queue_pop_head(mon->qmp.qmp_responses); + qemu_mutex_unlock(&mon->qmp.qmp_queue_lock); + + return data; +} + +static void monitor_qmp_response_flush(Monitor *mon) +{ + QObject *data; + + while ((data =3D monitor_qmp_response_pop_one(mon))) { + monitor_json_emitter_raw(mon, data); + qobject_unref(data); + } +} + /* * Pop a QMPResponse from any monitor's response queue into @response. * Return false if all the queues are empty; else true. @@ -551,9 +572,7 @@ static bool monitor_qmp_response_pop_any(QMPResponse *r= esponse) =20 qemu_mutex_lock(&monitor_lock); QTAILQ_FOREACH(mon, &mon_list, entry) { - qemu_mutex_lock(&mon->qmp.qmp_queue_lock); - data =3D g_queue_pop_head(mon->qmp.qmp_responses); - qemu_mutex_unlock(&mon->qmp.qmp_queue_lock); + data =3D monitor_qmp_response_pop_one(mon); if (data) { response->mon =3D mon; response->data =3D data; @@ -4429,6 +4448,14 @@ static void monitor_qmp_event(void *opaque, int even= t) mon_refcount++; break; case CHR_EVENT_CLOSED: + /* + * Note: this is only useful when the output of the chardev + * backend is still open. For example, when the backend is + * stdio, it's possible that stdout is still open when stdin + * is closed. After all, CHR_EVENT_CLOSED event is currently + * only bound to stdin. + */ + monitor_qmp_response_flush(mon); monitor_qmp_cleanup_queues(mon); json_message_parser_destroy(&mon->qmp.parser); json_message_parser_init(&mon->qmp.parser, handle_qmp_command); --=20 2.17.1 From nobody Sat Apr 27 18:35:32 2024 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 1529480149377379.270074276384; Wed, 20 Jun 2018 00:35:49 -0700 (PDT) Received: from localhost ([::1]:46470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVXea-0007NY-CB for importer@patchew.org; Wed, 20 Jun 2018 03:35:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVXcP-0005f5-Fl for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:33:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVXcO-0002f1-Cw for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:33:29 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53614 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 1fVXcO-0002es-7U for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:33:28 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AFB5B80125CE; Wed, 20 Jun 2018 07:33:27 +0000 (UTC) Received: from xz-mi.nay.redhat.com (dhcp-14-142.nay.redhat.com [10.66.14.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA8A51117622; Wed, 20 Jun 2018 07:33:21 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 20 Jun 2018 15:32:20 +0800 Message-Id: <20180620073223.31964-5-peterx@redhat.com> In-Reply-To: <20180620073223.31964-1-peterx@redhat.com> References: <20180620073223.31964-1-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 20 Jun 2018 07:33:27 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 20 Jun 2018 07:33:27 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'peterx@redhat.com' RCPT:'' 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] [PATCH v5 4/7] tests: iotests: drop some stderr line 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: Kevin Wolf , Peter Maydell , Thomas Huth , Fam Zheng , Eric Auger , John Snow , peterx@redhat.com, Max Reitz , Christian Borntraeger , "Dr . David Alan Gilbert" , Stefan Hajnoczi , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In my Out-Of-Band test, "check -qcow2 060" fail with this (the output is manually changed due to line width requirement): --- /home/peterx/git/qemu/tests/qemu-iotests/060.out +++ /home/peterx/git/qemu/bin/tests/qemu-iotests/060.out.bad @@ -427,8 +427,8 @@ QMP_VERSION {"return": {}} qcow2: Image is corrupt: L2 table offset 0x2a2a2a00 unaligned (L1 index: 0); further non-fatal corruption events will be suppressed -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_IMAGE_CORRUPTED", "data": {"device": "", "msg": "L2 table offset 0= x2a2a2a0 0 unaligned (L1 index: 0)", "node-name": "drive", "fatal": false}} read failed: Input/output error +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_IMAGE_CORRUPTED", "data": {"device": "", "msg": "L2 table offset 0= x2a2a2a0 0 unaligned (L1 index: 0)", "node-name": "drive", "fatal": false}} {"return": ""} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} The order of the event and the in/out error line is swapped. I didn't dig up the reason, but AFAIU what we want to verify is the event rather than stderr. Let's drop the stderr line directly for this test. Signed-off-by: Peter Xu --- tests/qemu-iotests/060 | 10 +++++++++- tests/qemu-iotests/060.out | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060 index 7bdf609f3f..74ad371885 100755 --- a/tests/qemu-iotests/060 +++ b/tests/qemu-iotests/060 @@ -33,6 +33,14 @@ _cleanup() } trap "_cleanup; exit \$status" 0 1 2 3 15 =20 +# Sometimes the error line might be dumped before/after an event +# randomly. Mask it out for specific test that may trigger this +# uncertainty for current test for now. +_filter_io_error() +{ + sed '/Input\/output error/d' +} + # get standard environment, filters and checks . ./common.rc . ./common.filter @@ -464,7 +472,7 @@ echo "{'execute': 'qmp_capabilities'} }}" \ -incoming exec:'cat /dev/null' \ 2>&1 \ - | _filter_qmp | _filter_qemu_io + | _filter_qmp | _filter_qemu_io | _filter_io_error =20 echo # Image should not have been marked corrupt diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out index bff023d889..d67c6234a4 100644 --- a/tests/qemu-iotests/060.out +++ b/tests/qemu-iotests/060.out @@ -428,7 +428,6 @@ QMP_VERSION {"return": {}} qcow2: Image is corrupt: L2 table offset 0x2a2a2a00 unaligned (L1 index: 0= ); further non-fatal corruption events will be suppressed {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_IMAGE_CORRUPTED", "data": {"device": "", "msg": "L2 table offset 0= x2a2a2a00 unaligned (L1 index: 0)", "node-name": "drive", "fatal": false}} -read failed: Input/output error {"return": ""} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false}} --=20 2.17.1 From nobody Sat Apr 27 18:35:32 2024 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 1529480159305216.0171776412982; Wed, 20 Jun 2018 00:35:59 -0700 (PDT) Received: from localhost ([::1]:46473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVXeo-0007du-82 for importer@patchew.org; Wed, 20 Jun 2018 03:35:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVXci-0005sC-L4 for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:33:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVXce-0002nR-Ct for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:33:48 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46308 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 1fVXce-0002nC-7N for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:33:44 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9883B79D36; Wed, 20 Jun 2018 07:33:43 +0000 (UTC) Received: from xz-mi.nay.redhat.com (dhcp-14-142.nay.redhat.com [10.66.14.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 516371117622; Wed, 20 Jun 2018 07:33:28 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 20 Jun 2018 15:32:21 +0800 Message-Id: <20180620073223.31964-6-peterx@redhat.com> In-Reply-To: <20180620073223.31964-1-peterx@redhat.com> References: <20180620073223.31964-1-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 20 Jun 2018 07:33:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 20 Jun 2018 07:33:43 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'peterx@redhat.com' RCPT:'' 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] [PATCH v5 5/7] docs: mention shared state protect for 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: Kevin Wolf , Peter Maydell , Thomas Huth , Fam Zheng , Eric Auger , John Snow , peterx@redhat.com, Max Reitz , Christian Borntraeger , "Dr . David Alan Gilbert" , Stefan Hajnoczi , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Out-Of-Band handlers need to protect shared state if there is any. Mention it in the document. Meanwhile, touch up some other places too, either with better English, or reordering of bullets. Suggested-by: Markus Armbruster Reviewed-by: Markus Armbruster Signed-off-by: Peter Xu --- docs/devel/qapi-code-gen.txt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt index 1366228b2a..fb486d4050 100644 --- a/docs/devel/qapi-code-gen.txt +++ b/docs/devel/qapi-code-gen.txt @@ -664,22 +664,27 @@ command: =20 - They are executed in order, - They run only in main thread of QEMU, -- They have the BQL taken during execution. +- They run with the BQL held. =20 When a command is executed with OOB, the following changes occur: =20 - They can be completed before a pending in-band command, - They run in a dedicated monitor thread, -- They do not take the BQL during execution. +- They run with the BQL not held. =20 OOB command handlers must satisfy the following conditions: =20 -- It executes extremely fast, -- It does not take any lock, or, it can take very small locks if all - critical regions also follow the rules for OOB command handler code, +- It terminates quickly, - It does not invoke system calls that may block, - It does not access guest RAM that may block when userfaultfd is - enabled for postcopy live migration. + enabled for postcopy live migration, +- It takes only "fast" locks, i.e. all critical sections protected by + any lock it takes also satisfy the conditions for OOB command + handler code. + +The restrictions on locking limit access to shared state. Such access +requires synchronization, but OOB commands can't take the BQL or any +other "slow" lock. =20 If in doubt, do not implement OOB execution support. =20 --=20 2.17.1 From nobody Sat Apr 27 18:35:32 2024 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 1529480406284592.3434057242416; Wed, 20 Jun 2018 00:40:06 -0700 (PDT) Received: from localhost ([::1]:46492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVXij-0002Yp-VM for importer@patchew.org; Wed, 20 Jun 2018 03:40:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVXcm-0005vC-2a for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:33:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVXck-0002sF-Ri for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:33:52 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46314 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 1fVXck-0002qv-Jh for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:33:50 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 060F59F72; Wed, 20 Jun 2018 07:33:50 +0000 (UTC) Received: from xz-mi.nay.redhat.com (dhcp-14-142.nay.redhat.com [10.66.14.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A62E1117622; Wed, 20 Jun 2018 07:33:43 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 20 Jun 2018 15:32:22 +0800 Message-Id: <20180620073223.31964-7-peterx@redhat.com> In-Reply-To: <20180620073223.31964-1-peterx@redhat.com> References: <20180620073223.31964-1-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 20 Jun 2018 07:33:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 20 Jun 2018 07:33:50 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'peterx@redhat.com' RCPT:'' 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] [PATCH v5 6/7] monitor: remove "x-oob", turn oob on by default 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: Kevin Wolf , Peter Maydell , Thomas Huth , Fam Zheng , Eric Auger , John Snow , peterx@redhat.com, Max Reitz , Christian Borntraeger , "Dr . David Alan Gilbert" , Stefan Hajnoczi , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" OOB commands were introduced in commit cf869d53172. Unfortunately, we ran into a regression, and had to disable them by default for 2.12 (commit be933ffc23). http://lists.gnu.org/archive/html/qemu-devel/2018-03/msg06231.html The regression has since been fixed (commit 951702f39c7 "monitor: bind dispatch bh to iohandler context"). Time to re-enable OOB. This patch partly reverts be933ffc23 (monitor: new parameter "x-oob"), and turns it on again for non-MUX QMPs. Note that we can't enable Out-Of-Band for monitors with MUX-typed chardev backends, because not all the chardev frontends can run without main thread, or can run in multiple threads. Some trivial touch-up in the test code is required to make sure qmp-test won't break. Reviewed-by: Markus Armbruster Signed-off-by: Peter Xu --- include/monitor/monitor.h | 1 - monitor.c | 22 ++++++---------------- tests/libqtest.c | 2 +- tests/qmp-test.c | 2 +- vl.c | 5 ----- 5 files changed, 8 insertions(+), 24 deletions(-) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index d6ab70cae2..0cb0538a31 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -13,7 +13,6 @@ extern Monitor *cur_mon; #define MONITOR_USE_READLINE 0x02 #define MONITOR_USE_CONTROL 0x04 #define MONITOR_USE_PRETTY 0x08 -#define MONITOR_USE_OOB 0x10 =20 bool monitor_cur_is_qmp(void); =20 diff --git a/monitor.c b/monitor.c index ea93db4857..99c5c902f9 100644 --- a/monitor.c +++ b/monitor.c @@ -4653,19 +4653,12 @@ 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; - - 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); - } - } + /* + * Note: we can't enable Out-Of-Band for monitors with MUX-typed + * chardev backends, because not all the chardev frontends can run + * without main thread, or can run in multiple threads. + */ + bool use_oob =3D (flags & MONITOR_USE_CONTROL) && !CHARDEV_IS_MUX(chr); =20 monitor_data_init(mon, false, use_oob); =20 @@ -4767,9 +4760,6 @@ 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 */ } }, diff --git a/tests/libqtest.c b/tests/libqtest.c index 098af6aec4..c5cb3f925c 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -213,7 +213,7 @@ QTestState *qtest_init_without_qmp_handshake(bool use_o= ob, "-display none " "%s", qemu_binary, socket_path, getenv("QTEST_LOG") ? "/dev/fd/2" : "/de= v/null", - qmp_socket_path, use_oob ? ",x-oob=3Don"= : "", + qmp_socket_path, "", extra_args ?: ""); execlp("/bin/sh", "sh", "-c", command, NULL); exit(1); diff --git a/tests/qmp-test.c b/tests/qmp-test.c index a49cbc6fde..3747bf7fbb 100644 --- a/tests/qmp-test.c +++ b/tests/qmp-test.c @@ -89,7 +89,7 @@ static void test_qmp_protocol(void) g_assert(q); test_version(qdict_get(q, "version")); capabilities =3D qdict_get_qlist(q, "capabilities"); - g_assert(capabilities && qlist_empty(capabilities)); + g_assert(capabilities); qobject_unref(resp); =20 /* Test valid command before handshake */ diff --git a/vl.c b/vl.c index b3426e03d0..8ecdd8a1a0 100644 --- a/vl.c +++ b/vl.c @@ -2307,11 +2307,6 @@ 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; =20 - /* 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) { --=20 2.17.1 From nobody Sat Apr 27 18:35:32 2024 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 1529480269225118.2826039333903; Wed, 20 Jun 2018 00:37:49 -0700 (PDT) Received: from localhost ([::1]:46482 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVXga-0000bn-IH for importer@patchew.org; Wed, 20 Jun 2018 03:37:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVXd5-0006Ae-UB for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:34:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVXd1-0002wb-VA for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:34:11 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50656 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 1fVXd1-0002wN-P3 for qemu-devel@nongnu.org; Wed, 20 Jun 2018 03:34:07 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 597328790A; Wed, 20 Jun 2018 07:34:07 +0000 (UTC) Received: from xz-mi.nay.redhat.com (dhcp-14-142.nay.redhat.com [10.66.14.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B4141117622; Wed, 20 Jun 2018 07:33:50 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 20 Jun 2018 15:32:23 +0800 Message-Id: <20180620073223.31964-8-peterx@redhat.com> In-Reply-To: <20180620073223.31964-1-peterx@redhat.com> References: <20180620073223.31964-1-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 20 Jun 2018 07:34:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 20 Jun 2018 07:34:07 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'peterx@redhat.com' RCPT:'' 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] [PATCH v5 7/7] Revert "tests: Add parameter to qtest_init_without_qmp_handshake" 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: Kevin Wolf , Peter Maydell , Thomas Huth , Fam Zheng , Eric Auger , John Snow , peterx@redhat.com, Max Reitz , Christian Borntraeger , "Dr . David Alan Gilbert" , Stefan Hajnoczi , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This reverts commit ddee57e0176f6ab53b13c6c97605b62737a8fd7a. Meanwhile, revert one line from fa198ad9bdef to make sure qtest_init_without_qmp_handshake() will only pass in one parameter. Reviewed-by: Markus Armbruster Signed-off-by: Peter Xu --- tests/libqtest.h | 4 +--- tests/libqtest.c | 10 ++++------ tests/qmp-test.c | 4 ++-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/libqtest.h b/tests/libqtest.h index ac52872cbe..180d2cc6ff 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -56,14 +56,12 @@ QTestState *qtest_init(const char *extra_args); =20 /** * qtest_init_without_qmp_handshake: - * @use_oob: true to have the server advertise OOB support * @extra_args: other arguments to pass to QEMU. CAUTION: these * arguments are subject to word splitting and shell evaluation. * * Returns: #QTestState instance. */ -QTestState *qtest_init_without_qmp_handshake(bool use_oob, - const char *extra_args); +QTestState *qtest_init_without_qmp_handshake(const char *extra_args); =20 /** * qtest_quit: diff --git a/tests/libqtest.c b/tests/libqtest.c index c5cb3f925c..51af4a289e 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -173,8 +173,7 @@ static const char *qtest_qemu_binary(void) return qemu_bin; } =20 -QTestState *qtest_init_without_qmp_handshake(bool use_oob, - const char *extra_args) +QTestState *qtest_init_without_qmp_handshake(const char *extra_args) { QTestState *s; int sock, qmpsock, i; @@ -207,13 +206,12 @@ QTestState *qtest_init_without_qmp_handshake(bool use= _oob, command =3D g_strdup_printf("exec %s " "-qtest unix:%s,nowait " "-qtest-log %s " - "-chardev socket,path=3D%s,nowait,id=3Dc= har0 " - "-mon chardev=3Dchar0,mode=3Dcontrol%s " + "-qmp unix:%s,nowait " "-machine accel=3Dqtest " "-display none " "%s", qemu_binary, socket_path, getenv("QTEST_LOG") ? "/dev/fd/2" : "/de= v/null", - qmp_socket_path, "", + qmp_socket_path, extra_args ?: ""); execlp("/bin/sh", "sh", "-c", command, NULL); exit(1); @@ -248,7 +246,7 @@ QTestState *qtest_init_without_qmp_handshake(bool use_o= ob, =20 QTestState *qtest_init(const char *extra_args) { - QTestState *s =3D qtest_init_without_qmp_handshake(false, extra_args); + QTestState *s =3D qtest_init_without_qmp_handshake(extra_args); =20 /* Read the QMP greeting and then do the handshake */ qtest_qmp_discard_response(s, ""); diff --git a/tests/qmp-test.c b/tests/qmp-test.c index 3747bf7fbb..7d23daba28 100644 --- a/tests/qmp-test.c +++ b/tests/qmp-test.c @@ -81,7 +81,7 @@ static void test_qmp_protocol(void) QList *capabilities; QTestState *qts; =20 - qts =3D qtest_init_without_qmp_handshake(false, common_args); + qts =3D qtest_init_without_qmp_handshake(common_args); =20 /* Test greeting */ resp =3D qtest_qmp_receive(qts); @@ -146,7 +146,7 @@ static void test_qmp_oob(void) QString *qstr; const char *cmd_id; =20 - qts =3D qtest_init_without_qmp_handshake(true, common_args); + qts =3D qtest_init_without_qmp_handshake(common_args); =20 /* Check the greeting message. */ resp =3D qtest_qmp_receive(qts); --=20 2.17.1