Received: from eggs.gnu.org ([2001:4830:134:3::10]:53177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1Zre-00081k-Ab for qemu-devel@nongnu.org; Tue, 01 Nov 2016 10:16:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1Zra-0006V4-9t for qemu-devel@nongnu.org; Tue, 01 Nov 2016 10:16:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34426) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c1Zra-0006Uv-2m for qemu-devel@nongnu.org; Tue, 01 Nov 2016 10:16:30 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (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 70B46C04B92A for ; Tue, 1 Nov 2016 14:16:29 +0000 (UTC) Date: Tue, 1 Nov 2016 12:16:27 -0200 From: Eduardo Habkost Message-ID: <20161101141627.GW5057@thinpad.lan.raisama.net> References: <1477924663-30950-1-git-send-email-pbonzini@redhat.com> <1477924663-30950-9-git-send-email-pbonzini@redhat.com> <20161031182010.GE2919@thinpad.lan.raisama.net> <1000890176.9817272.1477943273621.JavaMail.zimbra@redhat.com> <20161031222248.GV5057@thinpad.lan.raisama.net> <20161101093220.4agf4w7b6sotmdj3@hz-desktop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161101093220.4agf4w7b6sotmdj3@hz-desktop> Subject: Re: [Qemu-devel] [PULL 08/27] hostmem-file: make option 'size' optional List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org On Tue, Nov 01, 2016 at 05:32:20PM +0800, Haozhong Zhang wrote: > On 10/31/16 20:22 -0200, Eduardo Habkost wrote: > > On Mon, Oct 31, 2016 at 03:47:53PM -0400, Paolo Bonzini wrote: > > > > > > > > > ----- Original Message ----- > > > > From: "Eduardo Habkost" > > > > To: "Paolo Bonzini" > > > > Cc: qemu-devel@nongnu.org, "Haozhong Zhang" > > > > Sent: Monday, October 31, 2016 7:20:10 PM > > > > Subject: Re: [Qemu-devel] [PULL 08/27] hostmem-file: make option 'size' optional > > > > > > > > On Mon, Oct 31, 2016 at 03:37:24PM +0100, Paolo Bonzini wrote: > > > > [...] > > > > > @@ -1309,21 +1317,27 @@ static void *file_ram_alloc(RAMBlock *block, > > > > > > > > > > file_size = get_file_size(fd); > > > > > > > > > > - if (memory < block->page_size) { > > > > > + if (!mem_size && file_size > 0) { > > > > > + mem_size = file_size; > > > > > + memory_region_set_size(block->mr, mem_size); > > > > > + } > > > > > + > > > > > + if (mem_size < block->page_size) { > > > > > error_setg(errp, "memory size 0x" RAM_ADDR_FMT " must be equal to > > > > > " > > > > > "or larger than page size 0x%zx", > > > > > - memory, block->page_size); > > > > > + mem_size, block->page_size); > > > > > goto error; > > > > > } > > > > > > > > > > - if (file_size > 0 && file_size < memory) { > > > > > + if (file_size > 0 && file_size < mem_size) { > > > > > error_setg(errp, "backing store %s size %"PRId64 > > > > > " does not match 'size' option %"PRIu64, > > > > > - path, file_size, memory); > > > > > + path, file_size, mem_size); > > > > > goto error; > > > > > } > > > > > > > > > > - memory = ROUND_UP(memory, block->page_size); > > > > > + mem_size = ROUND_UP(mem_size, block->page_size); > > > > > + *memory = mem_size; > > > > > > > > I suggested not touching *memory unless it was zero, and setting > > > > it to the memory region size, not the rounded-up size. Haozhong > > > > said this was going to be changed. > > > > > > > > This will have the side-effect of setting block->used_length and > > > > block->max_length to the rounded up size in > > > > qemu_ram_alloc_from_file() (instead of the original memory region > > > > size). I don't know what could be the consequences of that. > > > > > > > > This patch also skip HOST_PAGE_ALIGN-ing mem_size after getting > > > > the file size, which would be different from the behavior when > > > > size is specified explicitly. (And I also don't know the > > > > consequences of that) > > > > > > > > Considering that this pull request failed to build, I suggest > > > > waiting for a new version from Haozhong. > > > > > > Yes, I'll drop these three patches. > > > > I believe you can keep the other two (as long as the build error > > is fixed). I was already going to include them in my pull > > request, but removed them. > > I'm a little confused. Do I need to send a following patch to fix this > build error? I was going to send a new version of the entire patch > series. I thought we could fix it while committing, to make sure it gets in a pull request for soft freeze. But: * Patch 1/3 ("do not truncate") is a bug fix for nvdimm, so eligible post-soft-freeze. * Patch 2/3 ("check file size") looks like a bug fix too. * Patch 3/3 ("make size optional") is not a bug fix and is riskier, so I believe it won't get into 2.8. So sending a new series is probably simpler, as patch 1-2 can be included after soft freeze. -- Eduardo