From patchwork Tue Oct 27 18:21:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11861331 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C64E56A2 for ; Tue, 27 Oct 2020 18:28:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5BBFA206C1 for ; Tue, 27 Oct 2020 18:28:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dQGhbiuv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5BBFA206C1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:39762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXThV-0003x0-0D for patchwork-qemu-devel@patchwork.kernel.org; Tue, 27 Oct 2020 14:28:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXTbo-0004DO-Nw for qemu-devel@nongnu.org; Tue, 27 Oct 2020 14:22:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:35723) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kXTbg-00030Z-OE for qemu-devel@nongnu.org; Tue, 27 Oct 2020 14:22:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603822923; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jZZ0k71Ya+ZNqUqgfUXh8g5MPzr9WXuCNqKlg5WP5RQ=; b=dQGhbiuvCAumIEvkUGZhAjnEX7Q8XCdBFlNS5kjsFQeUG/SwV3/+ekKmaeP/wtgzqOlwNo Ex3ZkX2PIb5VtJ4MX0guH/tAb6axa1I8JCSJIBP8n2Dgrg61M4xgfY3z2kjnpgf2eBhz2v iWETkbETgn3eiElzDtR9pCNiwPfsl4Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-570-m4-dWWzrOjy2xMwNkZKrzQ-1; Tue, 27 Oct 2020 14:22:01 -0400 X-MC-Unique: m4-dWWzrOjy2xMwNkZKrzQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2E8B18AE65E for ; Tue, 27 Oct 2020 18:21:50 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id D54715D9E8; Tue, 27 Oct 2020 18:21:49 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 13/29] vl: load plugins as late as possible Date: Tue, 27 Oct 2020 14:21:28 -0400 Message-Id: <20201027182144.3315885-14-pbonzini@redhat.com> In-Reply-To: <20201027182144.3315885-1-pbonzini@redhat.com> References: <20201027182144.3315885-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 01:06:07 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" There is no need to load plugins in the middle of default device processing, move -plugin handling just before preconfig is entered. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index f643333f7e..53d53ef206 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -125,6 +125,7 @@ static const char *boot_order; static const char *boot_once; static const char *incoming; static const char *loadvm; +static QemuPluginList plugin_list = QTAILQ_HEAD_INITIALIZER(plugin_list); enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB; int mem_prealloc; /* force preallocation of physical target memory */ int display_opengl; @@ -3076,7 +3077,11 @@ static void qemu_finish_machine_init(void) create_default_memdev(current_machine, mem_path); } - /* from here on runstate is RUN_STATE_PRELAUNCH */ + /* process plugin before CPUs are created, but once -smp has been parsed */ + if (qemu_plugin_load_list(&plugin_list)) { + exit(1); + } + machine_run_board_init(current_machine); /* @@ -3211,7 +3216,6 @@ void qemu_init(int argc, char **argv, char **envp) Error *err = NULL; bool have_custom_ram_size; BlockdevOptionsQueue bdo_queue = QSIMPLEQ_HEAD_INITIALIZER(bdo_queue); - QemuPluginList plugin_list = QTAILQ_HEAD_INITIALIZER(plugin_list); qemu_add_opts(&qemu_drive_opts); qemu_add_drive_opts(&qemu_legacy_drive_opts); @@ -4183,11 +4187,6 @@ void qemu_init(int argc, char **argv, char **envp) machine_class->default_machine_opts, 0); } - /* process plugin before CPUs are created, but once -smp has been parsed */ - if (qemu_plugin_load_list(&plugin_list)) { - exit(1); - } - qemu_opts_foreach(qemu_find_opts("device"), default_driver_check, NULL, NULL); qemu_opts_foreach(qemu_find_opts("global"),