From nobody Wed Nov 5 18:23:05 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496412871865387.005668343003; Fri, 2 Jun 2017 07:14:31 -0700 (PDT) Received: from localhost ([::1]:49968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGnLQ-0000Mo-Ay for importer@patchew.org; Fri, 02 Jun 2017 10:14:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGnJl-0007AS-Bo for qemu-devel@nongnu.org; Fri, 02 Jun 2017 10:12:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGnJk-00034w-Fb for qemu-devel@nongnu.org; Fri, 02 Jun 2017 10:12:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58464) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dGnJk-00034S-9k for qemu-devel@nongnu.org; Fri, 02 Jun 2017 10:12:44 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4CB98142A61; Fri, 2 Jun 2017 14:12:43 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id D32CE7FEA0; Fri, 2 Jun 2017 14:12:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4CB98142A61 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=marcandre.lureau@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4CB98142A61 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Fri, 2 Jun 2017 18:12:21 +0400 Message-Id: <20170602141229.15326-2-marcandre.lureau@redhat.com> In-Reply-To: <20170602141229.15326-1-marcandre.lureau@redhat.com> References: <20170602141229.15326-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 02 Jun 2017 14:12:43 +0000 (UTC) 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: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 1/9] exec: check kvm mmu notifiers earlier 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: ehabkost@redhat.com, Peter Crosthwaite , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , imammedo@redhat.com, Richard Henderson 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" Move kvm mmu notifiers check before calling file_ram_alloc(), with the other xen precondition. (file_ram_alloc() will be reused in other cases than -mem-path). Signed-off-by: Marc-Andr=C3=A9 Lureau --- exec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/exec.c b/exec.c index b1db12fe36..9c6c3cfe87 100644 --- a/exec.c +++ b/exec.c @@ -1496,12 +1496,6 @@ static void *file_ram_alloc(RAMBlock *block, int fd =3D -1; int64_t file_size; =20 - if (kvm_enabled() && !kvm_has_sync_mmu()) { - error_setg(errp, - "host lacks kvm mmu notifiers, -mem-path unsupported"); - return NULL; - } - for (;;) { fd =3D open(path, O_RDWR); if (fd >=3D 0) { @@ -1944,6 +1938,12 @@ RAMBlock *qemu_ram_alloc_from_file(ram_addr_t size, = MemoryRegion *mr, return NULL; } =20 + if (kvm_enabled() && !kvm_has_sync_mmu()) { + error_setg(errp, + "host lacks kvm mmu notifiers, -mem-path unsupported"); + return NULL; + } + if (phys_mem_alloc !=3D qemu_anon_ram_alloc) { /* * file_ram_alloc() needs to allocate just like --=20 2.13.0.91.g00982b8dd