From patchwork Tue Jan 13 20:36:17 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 2212 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0DKWQc0008454 for ; Tue, 13 Jan 2009 12:32:27 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753498AbZAMUg2 (ORCPT ); Tue, 13 Jan 2009 15:36:28 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754216AbZAMUg2 (ORCPT ); Tue, 13 Jan 2009 15:36:28 -0500 Received: from mx2.redhat.com ([66.187.237.31]:41976 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753498AbZAMUg0 (ORCPT ); Tue, 13 Jan 2009 15:36:26 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n0DKaQ8S030550 for ; Tue, 13 Jan 2009 15:36:26 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n0DKaQFP008866; Tue, 13 Jan 2009 15:36:26 -0500 Received: from amt.cnet (vpn-10-8.str.redhat.com [10.32.10.8]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n0DKaOsx027220; Tue, 13 Jan 2009 15:36:25 -0500 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 75D586801E3; Tue, 13 Jan 2009 18:36:18 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n0DKaHTo008701; Tue, 13 Jan 2009 18:36:17 -0200 Date: Tue, 13 Jan 2009 18:36:17 -0200 From: Marcelo Tosatti To: kvm@vger.kernel.org Cc: Avi Kivity Subject: kvm: make --mem-path memory allocation depend on mmu notifiers Message-ID: <20090113203617.GA8671@amt.cnet> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Without mmu notifiers usage of hugepages to back guest memory can cause memory corruption. Signed-off-by: Marcelo Tosatti --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/qemu/vl.c b/qemu/vl.c index d0660ab..49cf066 100644 --- a/qemu/vl.c +++ b/qemu/vl.c @@ -4664,6 +4664,11 @@ void *alloc_mem_area(size_t memory, unsigned long *len, const char *path) void *area; int fd; + if (!kvm_has_sync_mmu()) { + fprintf(stderr, "host lacks mmu notifiers, disabling --mem-path\n"); + return NULL; + } + if (asprintf(&filename, "%s/kvm.XXXXXX", path) == -1) return NULL;