From nobody Thu Nov 6 08:29:45 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; dkim=fail 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 1497524097050130.1260893002617; Thu, 15 Jun 2017 03:54:57 -0700 (PDT) Received: from localhost ([::1]:53128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLSQR-0000pq-Lz for importer@patchew.org; Thu, 15 Jun 2017 06:54:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLSOl-00082n-Hx for qemu-devel@nongnu.org; Thu, 15 Jun 2017 06:53:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLSOi-0007Ou-AP for qemu-devel@nongnu.org; Thu, 15 Jun 2017 06:53:11 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:36414) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLSOi-0007Ny-3k for qemu-devel@nongnu.org; Thu, 15 Jun 2017 06:53:08 -0400 Received: by mail-wr0-x241.google.com with SMTP id 77so2745037wrb.3 for ; Thu, 15 Jun 2017 03:53:07 -0700 (PDT) Received: from 640k.lan (94-39-191-51.adsl-ull.clienti.tiscali.it. [94.39.191.51]) by smtp.gmail.com with ESMTPSA id f21sm3258597wra.5.2017.06.15.03.53.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Jun 2017 03:53:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CG9RLkwAImJYZVANqXMfv3Ag4IoHRDGovvsTlXiQYKQ=; b=Oy7zLc27TBbhDupttM8Jbfxgjhw9mR93klPldeLepBtDCuDA0nYUdjoso9PALojbvz WWgX0Y1yLGG9ReamSgi3p8MlRM/yA0KE6591EAzzHyzEaey6GrFd+bHOP1MZK40PLGwP KKmFjVPX1AlchBHv7AxaDuK7C3PSaArW8vm9fIvT27b1M2BwgzQW9CX/8tYc8eZqAlfs X3BEziSd0z9dyhkzJdaOoACHkyWy50n4qQ95SfANQFpszp42IeHnR6Sfr/4Jr+GORYDo 4KZ95BFjblU0qP23n0vcIMvXZFbn+GhvJNCMHJHi4Z+UKgFH2qjvFd2MOpyBsxMpI85/ 36LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=CG9RLkwAImJYZVANqXMfv3Ag4IoHRDGovvsTlXiQYKQ=; b=oPy6Z6fweYZxP+ESPNlRha3iaJ0j6jN4X50XQTuwv5voP+Gx9cpB/5x41GozNbvBw+ 0W0aZQ/9H6F1JPtQ+VJcNm3yjZuRRaFmwiD2IzrBi1MDDwvgGRf+JbZ+bmW1O3+o8nyP mAn6/+QpOI0uWQit7AL2ViqwBj3/vs4rwIwvD5dP5x8OeblyyyWo7+kSt7w/IAJSNCwE JKD5lQCVveWGeq+oVrgZ4Dx8L9GUlUvkvYJnYgxVW8Pg53vqJ+71XjuQ2Ec9Pdlp5D2i T0Pb94YZWljsGzMvwNYv51zxoUR8UZtJScI2UaP5EdJLJ5VnpEmk0ZqOJgl6sG9aSx47 CQEw== X-Gm-Message-State: AKS2vOyJ7ELeNgOundRQfx2A5gp6c5Nq0UklG3vVPG31+JzTysd4P3jd em6NeqL3RbMUyFIX4J8= X-Received: by 10.223.135.105 with SMTP id 38mr3096068wrz.23.1497523986857; Thu, 15 Jun 2017 03:53:06 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 15 Jun 2017 12:52:21 +0200 Message-Id: <1497523981-38449-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1497523981-38449-1-git-send-email-pbonzini@redhat.com> References: <1497523981-38449-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 01/41] 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Marc-Andr=C3=A9 Lureau 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 Message-Id: <20170602141229.15326-2-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- exec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/exec.c b/exec.c index a93e209..a5be851 100644 --- a/exec.c +++ b/exec.c @@ -1495,12 +1495,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) { @@ -1943,6 +1937,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 1.8.3.1