From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fR8VG-0004kW-Bn for qemu-devel@nongnu.org; Thu, 07 Jun 2018 23:55:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fR8VF-00076F-Mx for qemu-devel@nongnu.org; Thu, 07 Jun 2018 23:55:54 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47358 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 1fR8VF-000767-IE for qemu-devel@nongnu.org; Thu, 07 Jun 2018 23:55:53 -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 1D5ACBB42D for ; Fri, 8 Jun 2018 03:55:53 +0000 (UTC) From: Peter Xu Date: Fri, 8 Jun 2018 11:55:10 +0800 Message-Id: <20180608035511.7439-7-peterx@redhat.com> In-Reply-To: <20180608035511.7439-1-peterx@redhat.com> References: <20180608035511.7439-1-peterx@redhat.com> Subject: [Qemu-devel] [PATCH v10 6/7] monitor: move init global earlier List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Eric Blake , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , Stefan Hajnoczi , "Dr . David Alan Gilbert" , peterx@redhat.com Before this patch, monitor fd helpers might be called even earlier than monitor_init_globals(). This can be problematic. After previous work, now monitor_init_globals() does not depend on accelerator initialization any more. Call it earlier (before CLI parsing; that's where the monitor APIs might be called) to make sure it is called before any of the monitor APIs. Suggested-by: Markus Armbruster Reviewed-by: Stefan Hajnoczi Reviewed-by: Markus Armbruster Signed-off-by: Peter Xu --- vl.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/vl.c b/vl.c index 06031715ac..5ddea3d235 100644 --- a/vl.c +++ b/vl.c @@ -2978,6 +2978,7 @@ int main(int argc, char **argv, char **envp) runstate_init(); postcopy_infrastructure_init(); + monitor_init_globals(); if (qcrypto_init(&err) < 0) { error_reportf_err(err, "cannot initialize crypto: "); @@ -4412,12 +4413,6 @@ int main(int argc, char **argv, char **envp) default_drive(default_floppy, snapshot, IF_FLOPPY, 0, FD_OPTS); default_drive(default_sdcard, snapshot, IF_SD, 0, SD_OPTS); - /* - * Note: qtest_enabled() (which is used in monitor_qapi_event_init()) - * depends on configure_accelerator() above. - */ - monitor_init_globals(); - if (qemu_opts_foreach(qemu_find_opts("mon"), mon_init_func, NULL, NULL)) { exit(1); -- 2.17.1