From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbslY-0002dP-9Y for qemu-devel@nongnu.org; Tue, 15 Sep 2015 12:07:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZbslV-0004us-47 for qemu-devel@nongnu.org; Tue, 15 Sep 2015 12:07:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbslU-0004uc-Vq for qemu-devel@nongnu.org; Tue, 15 Sep 2015 12:07:29 -0400 References: <1439563931-12352-1-git-send-email-guangrong.xiao@linux.intel.com> <1439563931-12352-9-git-send-email-guangrong.xiao@linux.intel.com> <20150825160353.GD8344@stefanha-thinkpad.redhat.com> <55DD979A.70804@linux.intel.com> From: Paolo Bonzini Message-ID: <55F8423A.3020600@redhat.com> Date: Tue, 15 Sep 2015 18:07:22 +0200 MIME-Version: 1.0 In-Reply-To: <55DD979A.70804@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 08/18] nvdimm: init backend memory mapping and config data area List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Xiao Guangrong , Stefan Hajnoczi Cc: ehabkost@redhat.com, kvm@vger.kernel.org, mst@redhat.com, gleb@kernel.org, mtosatti@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, imammedo@redhat.com, rth@twiddle.net On 26/08/2015 12:40, Xiao Guangrong wrote: >>> >>> + >>> + size = get_file_size(fd); >>> + buf = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); >> >> I guess the user will want to choose between MAP_SHARED and MAP_PRIVATE. >> This can be added in the future. > > Good idea, it will allow guest to write data but discards its content > after it exits. Will implement O_RDONLY + MAP_PRIVATE in the near future. FWIW, if Igor's backend/frontend idea is implemented, the choice between MAP_SHARED and MAP_PRIVATE should belong in the backend. Paolo