Received: from eggs.gnu.org ([2001:4830:134:3::10]:52923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqF5X-0006XE-WD for qemu-devel@nongnu.org; Wed, 13 Apr 2016 03:19:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aqF5U-0007JC-Qb for qemu-devel@nongnu.org; Wed, 13 Apr 2016 03:19:47 -0400 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:51623) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqF5U-0007Gd-H3 for qemu-devel@nongnu.org; Wed, 13 Apr 2016 03:19:44 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 13 Apr 2016 08:19:42 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 298482190061 for ; Wed, 13 Apr 2016 08:19:19 +0100 (BST) Received: from d06av03.portsmouth.uk.ibm.com (d06av03.portsmouth.uk.ibm.com [9.149.37.213]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u3D7Jepg62783566 for ; Wed, 13 Apr 2016 07:19:40 GMT Received: from d06av03.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u3D7JddC020374 for ; Wed, 13 Apr 2016 01:19:39 -0600 Date: Wed, 13 Apr 2016 09:19:35 +0200 From: Dominik Dingel Message-ID: <20160413091935.6895fdfb@BR9TG4T3.de.ibm.com> In-Reply-To: <570D6C6E.5060600@redhat.com> References: <1460064711-93294-1-git-send-email-dingel@linux.vnet.ibm.com> <570D6C6E.5060600@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] exec.c: Ensure right alignment also for file backed ram List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, Peter Crosthwaite , Richard Henderson , Halil Pasic On Tue, 12 Apr 2016 23:45:18 +0200 Paolo Bonzini wrote: > > > On 07/04/2016 23:31, Dominik Dingel wrote: > > diff --git a/exec.c b/exec.c > > index c4f9036..1ae98e4 100644 > > --- a/exec.c > > +++ b/exec.c > > @@ -1241,6 +1241,7 @@ static void *file_ram_alloc(RAMBlock *block, > > void *area; > > int fd = -1; > > int64_t page_size; > > + int64_t alignment; > > > > if (kvm_enabled() && !kvm_has_sync_mmu()) { > > error_setg(errp, > > @@ -1296,7 +1297,8 @@ static void *file_ram_alloc(RAMBlock *block, > > } > > > > page_size = qemu_fd_getpagesize(fd); > > - block->mr->align = page_size; > > + alignment = MAX(page_size, QEMU_VMALLOC_ALIGN); > > + block->mr->align = alignment; > > > > if (memory < page_size) { > > error_setg(errp, "memory size 0x" RAM_ADDR_FMT " must be equal to " > > @@ -1305,7 +1307,7 @@ static void *file_ram_alloc(RAMBlock *block, > > goto error; > > } > > > > - memory = ROUND_UP(memory, page_size); > > + memory = ROUND_UP(memory, alignment); > > I think this change is not necessary either; it is enough to change the > qemu_ram_mmap below. You are right "memory" will never be back propagated to anything related to memory slots. On which we have such a size constraint. Thanks, Dominik