From patchwork Fri Sep 2 18:59:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 9311523 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DC5B260772 for ; Fri, 2 Sep 2016 19:04:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF59629815 for ; Fri, 2 Sep 2016 19:04:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C42D02984F; Fri, 2 Sep 2016 19:04:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 14D922984D for ; Fri, 2 Sep 2016 19:04:08 +0000 (UTC) Received: from localhost ([::1]:43482 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bftl1-0007Jb-5s for patchwork-qemu-devel@patchwork.kernel.org; Fri, 02 Sep 2016 15:04:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bftkM-00072l-08 for qemu-devel@nongnu.org; Fri, 02 Sep 2016 15:03:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bftkJ-0000O2-UR for qemu-devel@nongnu.org; Fri, 02 Sep 2016 15:03:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59728) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bftkJ-0000NZ-PP; Fri, 02 Sep 2016 15:03:23 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5B16B4E4D1; Fri, 2 Sep 2016 19:03:23 +0000 (UTC) Received: from localhost (ovpn-116-23.phx2.redhat.com [10.3.116.23]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u82J3M5l007137; Fri, 2 Sep 2016 15:03:22 -0400 From: Eduardo Habkost To: qemu-devel@nongnu.org, Paolo Bonzini Date: Fri, 2 Sep 2016 15:59:44 -0300 Message-Id: <1472842784-15399-3-git-send-email-ehabkost@redhat.com> In-Reply-To: <1472842784-15399-1-git-send-email-ehabkost@redhat.com> References: <1472842784-15399-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 02 Sep 2016 19:03:23 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/2] vl: Delay initialization of memory backends 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: mprivozn@redhat.com, Bandan Das , Markus Armbruster , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Initialization of memory backends may take a while when prealloc=yes is used, depending on their size. Initializing memory backends before chardevs may delay the creation of monitor sockets, and trigger timeouts on management software that waits until the monitor socket is created by QEMU. See, for example, the bug report at: https://bugzilla.redhat.com/show_bug.cgi?id=1371211 In addition to that, allocating memory before calling configure_accelerator() breaks the tcg_enabled() checks at memory_region_init_*(). This patch fixes those problems by adding "memory-backend-*" classes to the delayed-initialization list. Signed-off-by: Eduardo Habkost --- Changes series v1 -> series v2: * Changed comment and commit message to mention the dirty_log_mask initialization bug --- vl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vl.c b/vl.c index b3c80d5..ee557a1 100644 --- a/vl.c +++ b/vl.c @@ -2810,6 +2810,19 @@ static bool object_create_initial(const char *type) return false; } + /* Memory allocation by backends needs to be done + * after configure_accelerator() (due to the tcg_enabled() + * checks at memory_region_init_*()). + * + * Also, allocation of large amounts of memory may delay + * chardev initialization for too long, and trigger timeouts + * on software that waits for a monitor socket to be created + * (e.g. libvirt). + */ + if (g_str_has_prefix(type, "memory-backend-")) { + return false; + } + return true; }